pyetherscan.ethereum module¶
Library for building ethereum objects using the ETherscan API.
-
class
pyetherscan.ethereum.Address(address)[source]¶ Bases:
objectRepresents a base address.
This uses the
Clientobject to retrieve information about, and construct, theAddress.- Public Attributes:
addressbalanceblocks_mined
- Public Methods:
Example Usage:
In [1]: address = '0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae' In [2]: ethereum_address = Address(address) In [3]: ethereum_address.balance Out[3]: 748997604382925139479303.0 In [4]: for txn in ethereum_address.transactions: ...: print(txn.value)
Initializes an ethereum address object.
-
balance¶ The balance in ether for this address.
-
blocks_mined¶
-
token_balance(contract_address)[source]¶ Obtains an address’s ERC-20 compliant token balance given a token contract address.
Parameters: contract_address (str) – The address of the token contract. Returns: The balance of the token as a float.
-
transactions¶ returns a
ethereum.TransactionContainerobject. This object can be treated as a sequence object containing transactions this address was involved in.
-
class
pyetherscan.ethereum.Block(block_number)[source]¶ Bases:
objectRepresents an ethereum block.
This uses the
Clientobject to retrieve information about, and construct, theBlock.- Public Attributes:
time_stampblock_minerblock_rewardunclesdatetime_mineduncle_inclusion_reward
Example Usage:
In [1]: address = '0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae' In [2]: ethereum_address = Address(address) In [3]: ethereum_address.balance Out[3]: 748997604382925139479303.0 In [4]: for txn in ethereum_address.transactions: ...: print(txn.value)
-
block_miner¶
-
block_reward¶
-
datetime_mined¶
-
time_stamp¶
-
uncle_inclusion_reward¶
-
uncles¶
-
class
pyetherscan.ethereum.BlockContainer(block_list)[source]¶ Bases:
objectRepresents a sequence of blocks.
-
class
pyetherscan.ethereum.Token(contract_address)[source]¶ Bases:
objectRepresents an ERC-20 compliant token.
Parameters: contract_address (str) – The address of the Token contract -
supply¶
-
-
class
pyetherscan.ethereum.Transaction(data)[source]¶ Bases:
objectRepresents a generic ethereum transaction. The object is built to lazily parse transactions. Attributes are only evaluated when called for the first time.
Public Attributes:
noncecontract_addresscumulative_gas_usedhashblock_hashtime_stampgasgas_pricevalueblock_numberblocktofrom_confirmationsinputtransaction_indextypedatetime_executedgas_used
Initializes the Transaction object.
Parameters: data (dict) – The dictionary of data that makes up the transaction. -
block¶
-
block_hash¶
-
block_number¶
-
confirmations¶
-
contract_address¶
-
cumulative_gas_used¶
-
datetime_executed¶
-
from_¶
-
gas¶
-
gas_price¶
-
gas_used¶
-
hash¶
-
input¶
-
nonce¶
-
time_stamp¶
-
to¶
-
transaction_index¶
-
type¶
-
value¶