Tron Explorer’s documentation
Explore
- class tron_explorer.explore.Explore
instantiate an object that contains methods for all requests.
- static get_account_properties()
get available properties for accounts.
- Returns
list of properties
- Return type
list
- static get_block_properties()
get available properties for blocks.
- Returns
list of properties
- Return type
list
- static get_proposals_properties()
get available properties for proposals.
- Returns
list of properties
- Return type
list
- static get_smart_contract_properties()
get available properties for smart contracts.
- Returns
list of properties
- Return type
list
- static get_sr_properties()
get available properties for sr.
- Returns
list of properties
- Return type
list
- static get_transaction_properties()
get available properties for transaction.
- Returns
list of properties
- Return type
list
- static get_token_single_properties_trc10()
get available properties for single token query (trc10).
- Returns
list of properties
- Return type
list
- static get_token_single_properties_trc20()
get available properties for single token query (trc20).
- Returns
list of properties
- Return type
list
- static get_token_list_properties()
get available properties for list token query.
- Returns
list of properties
- Return type
list
- get_account(account_address: str, properties: Optional[list] = None)
get data for a specific account.
- Parameters
account_address (str) – address of the account.
- Args
- properties (
list) properties of accounts that will be returned. default is all.
- properties (
- Returns
the desired account data.
- Return type
- get_account_list(save_live: bool = False, save_path: str = '', sort: str = 'power', order: str = 'DESC', properties: Optional[list] = None, count: int = 10000)
get data for a list of accounts.
- Args
- start_timestamp (
int) start timestamp of query. default is None. (milliseconds)
- start_timestamp (
- end_timestamp (
int) end timestamp of query. default is None. (milliseconds)
- end_timestamp (
- properties (
list) properties of accounts that will be returned. default is all.
- properties (
- sort (
str) the property that accounts are ordered by. can be sorted by “power”, “balance”. default is “power”.
- sort (
- order (
str) order of accounts by sort (“ASC” : Ascending , “DESC” : descending).
- order (
- count (
int) number of desired accounts. default is 10000. is ignored when both times are specified.
- count (
- save_live (
bool) if set to True the downloaded data will be saved to a file in each page downloaded to avoid losing data in case of an error.
- save_live (
- save_path (
str) path of folder that data is saved to. default is “”
- save_path (
- Returns
a panda dataframe containing data of desired accounts.
- Return type
Pandas Dataframe
- get_account_analysis(type_: str, account_address: str, start_timestamp: int = 1)
get analysis for an account.
- Parameters
type (int) – indicates type of analysis. balance: balance analysis token_transfer: token transfer analysis energy: energy usage analysis bandwidth: bandwidth usage analysis
account_address (str) – address of desired account.
- Args
- start_timestamp (
int) start timestamp of query. default is 1 (for this specific query input 0 returns only 100 items). (milliseconds)
- start_timestamp (
- Returns
a panda dataframe containing data of desired accounts.
- Return type
Pandas Dataframe
- get_latest_block(properties: Optional[list] = None)
get the latest block data.
- Args
- properties (
list) properties of blocks that will be returned. default is all.
- properties (
- Returns
the latest block data.
- Return type
- get_block(number: int, properties: Optional[list] = None)
get a specific block.
- Parameters
number (int) – the number of desired block.
- Args
- properties (
list) properties of blocks that will be returned. default is all.
- properties (
- Returns
the desired block data.
- Return type
- get_block_list(start_timestamp: Optional[int] = None, end_timestamp: Optional[int] = None, save_live: bool = False, save_path: str = '', order: str = 'DESC', properties: Optional[list] = None, count: int = 10000)
get multiple blocks data.
- Args
- start_timestamp (
int) start timestamp of query. default is None. (milliseconds)
- start_timestamp (
- end_timestamp (
int) end timestamp of query. default is None. (milliseconds)
- end_timestamp (
- properties (
list) properties of blocks that will be returned. default is all.
- properties (
- order (
str) order of blocks by time (“ASC” : Ascending , “DESC” : descending).
- order (
- count (
int) number of desired blocks. default is 10000. is ignored when both times are specified.
- count (
- save_live (
bool) if set to True the downloaded data will be saved to a file in each page downloaded to avoid losing data in case of an error.
- save_live (
- save_path (
str) path of folder that data is saved to. default is “”
- save_path (
- Returns
a panda dataframe containing data of desired blocks.
- Return type
Pandas Dataframe
- get_list_proposals(save_live: bool = False, save_path: str = '', properties: Optional[list] = None, count: int = 100)
get data for a list of proposals.
- Args
- properties (
list) properties of proposals that will be returned. default is all.
- properties (
- count (
int) number of desired proposals. default is 100. is ignored when both times are specified.
- count (
- save_live (
bool) if set to True the downloaded data will be saved to a file in each page downloaded to avoid losing data in case of an error.
- save_live (
- save_path (
str) path of folder that data is saved to. default is “”
- save_path (
- Returns
a panda dataframe containing data of desired proposals.
- Return type
Pandas Dataframe
- get_list_network_parameters()
get data for a list of network parameters.
- Returns
a list containing network parameters and their current value.
- Return type
list
- get_smart_contract(contract_address: str, properties: Optional[list] = None)
get data for a specific smart contract.
- Parameters
contract_address (str) – address of the contract.
- Args
- properties (
list) properties of accounts that will be returned. default is all.
- properties (
- Returns
the desired account data.
- Return type
- get_smart_contract_list_blockchain(start_timestamp: Optional[int] = None, end_timestamp: Optional[int] = None, save_live: bool = False, save_path: str = '', sort: str = 'timestamp', order: str = 'DESC', properties: Optional[list] = None, count: int = 10000, verified_only: bool = False, open_source_only: bool = False)
get data for a list of account.
- Args
- start_timestamp (
int) start timestamp of query. default is None. (milliseconds)
- start_timestamp (
- end_timestamp (
int) end timestamp of query. default is None. (milliseconds)
- end_timestamp (
- properties (
list) properties of contracts that will be returned. default is all.
- properties (
- sort (
str) the property that contracts are ordered by. can be sorted by “number_of_calls”, “balance”, “timestamp”. default is “timestamp”.
- sort (
- order (
str) order of contracts by sort (“ASC” : Ascending , “DESC” : descending).
- order (
- count (
int) number of desired contracts. default is 10000. is ignored when both times are specified.
- count (
- verified_only (
bool) get only verified contracts.
- verified_only (
- open_source_only (
bool) get only open_source_only contracts.
- open_source_only (
- save_live (
bool) if set to True the downloaded data will be saved to a file in each page downloaded to avoid losing data in case of an error.
- save_live (
- save_path (
str) path of folder that data is saved to. default is “”
- save_path (
- Returns
a panda dataframe containing data of desired contracts.
- Return type
Pandas Dataframe
- get_sr(sr_address: str, properties: Optional[list] = None)
get a specific SR.
- Parameters
sr_address (str) – the number of desired block.
- Args
- properties (
list) properties of blocks that will be returned. default is all.
- properties (
- Returns
the desired block data.
- Return type
- get_sr_list(sr_type: str = 'all', properties: Optional[list] = None)
get multiple SR data.
- Args
- sr_type (
int) all : returns all SRs. sr : returns only SR. sr_partners : returns only SR partners. sr_candidates : returns only SR candidates. default is all.
- sr_type (
- Returns
a panda dataframe containing data of desired blocks.
- Return type
Pandas Dataframe
- get_transaction(hash_: str, properties: Optional[list] = None)
get a specific transaction.
- Parameters
hash (str) – the hash of desired transaction.
- Kwargs
- properties (
list) properties of transaction that will be returned. default is all.
- properties (
- Returns
the desired transaction data.
- Return type
- get_transaction_list_block(number: str, save_live: bool = False, save_path: str = '', order: str = 'DESC', properties: Optional[list] = None, count: int = 10000)
get transactions in a block.
- Args
- properties (
list) properties of transaction that will be returned. default is all.
- properties (
- sort (
str) the property that transaction are ordered by.
- sort (
- order (
str) order of transaction by time (“ASC” : Ascending , “DESC” : descending).
- order (
- count (
int) number of desired transaction. default is 10000. is ignored when both times are specified.
- count (
- save_live (
bool) if set to True the downloaded data will be saved to a file in each page downloaded to avoid losing data in case of an error.
- save_live (
- save_path (
str) path of folder that data is saved to. default is “”
- save_path (
- Returns
a panda dataframe containing data of desired transactions.
- Return type
Pandas Dataframe
- get_transaction_list_account(address: str, save_live: bool = False, save_path: str = '', order: str = 'DESC', properties: Optional[list] = None, count: int = 10000)
get transactions related to an account.
- Args
- properties (
list) properties of transaction that will be returned. default is all.
- properties (
- sort (
str) the property that transaction are ordered by.
- sort (
- order (
str) order of transaction by time (“ASC” : Ascending , “DESC” : descending).
- order (
- count (
int) number of desired transaction. default is 10000. is ignored when both times are specified.
- count (
- save_live (
bool) if set to True the downloaded data will be saved to a file in each page downloaded to avoid losing data in case of an error.
- save_live (
- save_path (
str) path of folder that data is saved to. default is “”
- save_path (
- Returns
a panda dataframe containing data of desired transactions.
- Return type
Pandas Dataframe
- get_transaction_list_blockchain(start_timestamp: Optional[int] = None, end_timestamp: Optional[int] = None, save_live: bool = False, save_path: str = '', order: str = 'DESC', properties: Optional[list] = None, count: int = 10000)
get transactions in blockchain.
- Args
- start_timestamp (
int) start timestamp of query. default is None. (milliseconds)
- start_timestamp (
- end_timestamp (
int) end timestamp of query. default is None. (milliseconds)
- end_timestamp (
- properties (
list) properties of transaction that will be returned. default is all.
- properties (
- order (
str) order of transaction by time (“ASC” : Ascending , “DESC” : descending).
- order (
- count (
int) number of desired transactions. default is 10000. is ignored when both times are specified.
- count (
- save_live (
bool) if set to True the downloaded data will be saved to a file in each page downloaded to avoid losing data in case of an error.
- save_live (
- save_path (
str) path of folder that data is saved to. default is “”
- save_path (
- Returns
a panda dataframe containing data of desired transactions.
- Return type
Pandas Dataframe
- get_token_list(save_live: bool = False, save_path: str = '', sort: str = 'gain', order: str = 'DESC', properties: Optional[list] = None, count: int = 10000, token_type: str = 'all')
get data for a list of tokens.
- Args
- start_timestamp (
int) start timestamp of query. default is None. (milliseconds)
- start_timestamp (
- end_timestamp (
int) end timestamp of query. default is None. (milliseconds)
- end_timestamp (
- properties (
list) properties of tokens that will be returned. default is all.
- properties (
- sort (
str) the property that tokens are ordered by. can be sorted by “gain”, “market_cap”, “number_of holders”, “volume_24h”. default is “gain”.
- sort (
- order (
str) order of tokens by sort (“ASC” : Ascending , “DESC” : descending).
- order (
- count (
int) number of desired tokens. default is 10000. is ignored when both times are specified.
- count (
- save_live (
bool) if set to True the downloaded data will be saved to a file in each page downloaded to avoid losing data in case of an error.
- save_live (
- save_path (
str) path of folder that data is saved to. default is “”
- save_path (
- token_type (
str) all : return all tokens trc10 : return only and all trc10 tokens. trc20 : return only and all trc20 tokens. trc721 : return only and all trc721 tokens. trc1155 : return only and all trc1155 tokens. default is all.
- token_type (
- Returns
a panda dataframe containing data of desired tokens.
- Return type
Pandas Dataframe
- get_trc10_token(token_id: str, properties: Optional[list] = None)
get data for a specific trc10 token.
- Parameters
token_id (str) – unique identifier of trc10 token.
- Args
- properties (
list) properties of token that will be returned. default is all.
- properties (
- Returns
the desired account data.
- Return type
- get_trc20_token(contract_address: str, properties: Optional[list] = None)
get data for a specific trc20 token.
- Parameters
contract_address (str) – contract address of trc20 token.
- Args
- properties (
list) properties of token that will be returned. default is all.
- properties (
- Returns
the desired account data.
- Return type
Block
- class tron_explorer.block.BlockDataMap(data, properties)
- properties_dict = {'bandwidth_used': 'netUsage', 'block_reward': 'blockReward', 'confirmed': 'confirmed', 'energy_used': 'energyUsage', 'hash': 'hash', 'number': 'number', 'number_of_transactions': 'nrOfTrx', 'parent_hash': 'parentHash', 'size': 'size', 'sr_address': 'witnessAddress', 'sr_name': 'witnessName', 'timestamp': 'timestamp'}
a DataMap type class that is responsible for filtering properties of block data instances.
- Parameters
data (dict) – the data instance.
properties (list) – properties of block instance that will be returned. to see what properties are included see below
- Properties
- number (
int) number of the block.
- number (
- hash (
str) hash of the block.
- hash (
- parent_hash (
str) hash of the parent block of this one.
- parent_hash (
- timestamp (
int) timestamp of the block creation. (milliseconds)
- timestamp (
- size (
int) size of the block in bytes.
- size (
- confirmed (
bool) whether if the block is confirmed or not.
- confirmed (
- number_of_transactions (
int) number of transactions in the block.
- number_of_transactions (
- block_reward (
float) number of tokens awarded to producer of the block. (trx)
- block_reward (
- bandwidth_used (
float) amount of bandwidth used to create the block.
- bandwidth_used (
- energy_used (
float) amount of energy used to create the block.
- energy_used (
- sr_name (
str) name of the super representative that produced the block.
- sr_name (
- sr_address (
str) address of the super representative that produced the block.
- sr_address (
- filter_data()
filters data based on parameter properties.
- class tron_explorer.block.Block
instantiate an object that contains methods for multiple request related to blocks.
- _get_latest_block_number()
get the latest block number.
- Returns
the latest block number.
- Return type
int
- get_latest_block(properties: Optional[list] = None)
get the latest block data.
- Args
- properties (
list) properties of blocks that will be returned. default is all.
- properties (
- Returns
the latest block data.
- Return type
- get_block(number: int, properties: Optional[list] = None)
get a specific block.
- Parameters
number (int) – the number of desired block.
- Args
- properties (
list) properties of blocks that will be returned. default is all.
- properties (
- Returns
the desired block data.
- Return type
- get_block_list(start_timestamp: Optional[int] = None, end_timestamp: Optional[int] = None, save_live: bool = False, save_path: str = '', order: str = 'DESC', properties: Optional[list] = None, count: int = 10000)
get multiple blocks data.
- Args
- start_timestamp (
int) start timestamp of query. default is None. (milliseconds)
- start_timestamp (
- end_timestamp (
int) end timestamp of query. default is None. (milliseconds)
- end_timestamp (
- properties (
list) properties of blocks that will be returned. default is all.
- properties (
- order (
str) order of blocks by time (“ASC” : Ascending , “DESC” : descending).
- order (
- count (
int) number of desired blocks. default is 10000. is ignored when both times are specified.
- count (
- save_live (
bool) if set to True the downloaded data will be saved to a file in each page downloaded to avoid losing data in case of an error.
- save_live (
- save_path (
str) path of folder that data is saved to. default is “”
- save_path (
- Returns
a panda dataframe containing data of desired blocks.
- Return type
Pandas Dataframe
Transaction
- class tron_explorer.transaction.TransactionDataMap(data, properties)
- properties_list = ['number', 'hash', 'timestamp', 'from_address', 'to_address', 'token_name', 'token_abbr', 'value', 'confirmed', 'result', 'trx_burned_bandwidth', 'trx_burned_energy', 'trx_burned_total', 'energy_used', 'bandwidth_used', 'contract_address', 'contract_data', 'method', 'resources']
a DataMap type class that is responsible for filtering properties of transaction data instances.
- Parameters
data (dict) – the data instance.
properties (list) – properties of transaction instance that will be returned. to see what properties are included see below
- Standard
the token standard transaction of tron network.
- Properties
- number (
int) number of the block that transaction is in.
- number (
- hash (
str) hash of transaction.
- hash (
- timestamp (
int) timestamp of the transaction. (milliseconds)
- timestamp (
- from_address (
str) address of transaction creator.
- from_address (
- to_address (
str) address of transaction recipient.
- to_address (
- token_name (
str) name of the transferred token.
- token_name (
- token_abbr (
str) name abbreviation of the transferred token.
- token_abbr (
- value (
int) amount of the transferred token.
- value (
- confirmed (
str) whether if transaction is confirmed.
- confirmed (
- result (
str) whether if transaction is successful.
- result (
- trx_burned_bandwidth (
int) amount of trx burned(fee) for bandwidth usage.
- trx_burned_bandwidth (
- trx_burned_energy (
int) amount of trx burned(fee) for energy usage.
- trx_burned_energy (
- trx_burned_total (
int) total amount of trx burned(fee).
- trx_burned_total (
- energy_used (
float) energy used for verifying transaction.
- energy_used (
- bandwidth_used (
float) bandwidth used for verifying transaction.
- bandwidth_used (
- Smart contract
transactions related to a smart contract.
- Properties
- number (
int) number of the block that transaction is in.
- number (
- hash (
str) hash of transaction.
- hash (
- timestamp (
int) timestamp of the transaction. (milliseconds)
- timestamp (
- from_address (
str) address of transaction creator.
- from_address (
- to_address (
str) address of transaction recipient.
- to_address (
- value (
int) amount of the transferred token.
- value (
- contract_address (
str) contract address of the transaction.
- contract_address (
- contract_data (
str) contract data of the transaction.
- contract_data (
- method (
str) method name of used in contract to create the transaction.
- method (
- confirmed (
str) whether if transaction is confirmed.
- confirmed (
- result (
str) whether if transaction is successful.
- result (
- trx_burned_bandwidth (
int) amount of trx burned(fee) for bandwidth usage.
- trx_burned_bandwidth (
- trx_burned_energy (
int) amount of trx burned(fee) for energy usage.
- trx_burned_energy (
- trx_burned_total (
int) total amount of trx burned(fee).
- trx_burned_total (
- energy_used (
float) energy used for verifying transaction.
- energy_used (
- bandwidth_used (
float) bandwidth used for verifying transaction.
- bandwidth_used (
- Staking
transaction related to staking.
- Properties
- number (
int) number of the block that transaction is in.
- number (
- hash (
str) hash of transaction.
- hash (
- timestamp (
int) timestamp of the transaction. (milliseconds)
- timestamp (
- from_address (
str) address of transaction creator.
- from_address (
- to_address (
str) the resource receiving address.
- to_address (
- token_name (
str) name of the transferred token.
- token_name (
- token_abbr (
str) name abbreviation of the transferred token.
- token_abbr (
- value (
int) amount of the staked token.
- value (
- confirmed (
str) whether if transaction is confirmed.
- confirmed (
- result (
str) whether if transaction is successful.
- result (
- trx_burned_bandwidth (
int) amount of trx burned(fee) for bandwidth usage.
- trx_burned_bandwidth (
- trx_burned_energy (
int) amount of trx burned(fee) for energy usage.
- trx_burned_energy (
- trx_burned_total (
int) total amount of trx burned(fee).
- trx_burned_total (
- energy_used (
float) energy used for verifying transaction.
- energy_used (
- bandwidth_used (
float) bandwidth used for verifying transaction.
- bandwidth_used (
- Unstaking
transaction related to unstaking.
- Properties
- number (
int) number of the block that transaction is in.
- number (
- hash (
str) hash of transaction.
- hash (
- timestamp (
int) timestamp of the transaction. (milliseconds)
- timestamp (
- from_address (
str) address of transaction the gate.
- from_address (
- to_address (
str) address of transaction recipient.
- to_address (
- token_name (
str) name of the transferred token.
- token_name (
- token_abbr (
str) name abbreviation of the transferred token.
- token_abbr (
- value (
int) amount of the staked token.
- value (
- confirmed (
str) whether if transaction is confirmed.
- confirmed (
- result (
str) whether if transaction is successful.
- result (
- trx_burned_bandwidth (
int) amount of trx burned(fee) for bandwidth usage.
- trx_burned_bandwidth (
- trx_burned_energy (
int) amount of trx burned(fee) for energy usage.
- trx_burned_energy (
- trx_burned_total (
int) total amount of trx burned(fee).
- trx_burned_total (
- energy_used (
float) energy used for verifying transaction.
- energy_used (
- bandwidth_used (
float) bandwidth used for verifying transaction.
- bandwidth_used (
- Reward
transaction related to reward claiming.
- Properties
- number (
int) number of the block that transaction is in.
- number (
- hash (
str) hash of transaction.
- hash (
- timestamp (
int) timestamp of the transaction. (milliseconds)
- timestamp (
- from_address (
str) address of the reward receiver.
- from_address (
- token_name (
str) name of the transferred token.
- token_name (
- token_abbr (
str) name abbreviation of the transferred token.
- token_abbr (
- value (
int) amount of the reward.
- value (
- confirmed (
str) whether if transaction is confirmed.
- confirmed (
- result (
str) whether if transaction is successful.
- result (
- trx_burned_bandwidth (
int) amount of trx burned(fee) for bandwidth usage.
- trx_burned_bandwidth (
- trx_burned_energy (
int) amount of trx burned(fee) for energy usage.
- trx_burned_energy (
- trx_burned_total (
int) total amount of trx burned(fee).
- trx_burned_total (
- energy_used (
float) energy used for verifying transaction.
- energy_used (
- bandwidth_used (
float) bandwidth used for verifying transaction.
- bandwidth_used (
- Vote
transaction related to voting.
- Properties
- number (
int) number of the block that transaction is in.
- number (
- hash (
str) hash of transaction
- hash (
- timestamp (
int) timestamp of the transaction. (milliseconds)
- timestamp (
- to_address (
str) address of candidate.
- to_address (
- from_address (
str) address of the voter.
- from_address (
- token_name (
str) name of the transferred token.
- token_name (
- token_abbr (
str) name abbreviation of the transferred token.
- token_abbr (
- value (
int) amount of the reward.
- value (
- confirmed (
str) whether if transaction is confirmed.
- confirmed (
- result (
str) whether if transaction is successful.
- result (
- trx_burned_bandwidth (
int) amount of trx burned(fee) for bandwidth usage.
- trx_burned_bandwidth (
- trx_burned_energy (
int) amount of trx burned(fee) for energy usage.
- trx_burned_energy (
- trx_burned_total (
int) total amount of trx burned(fee).
- trx_burned_total (
- energy_used (
float) energy used for verifying transaction.
- energy_used (
- bandwidth_used (
float) bandwidth used for verifying transaction.
- bandwidth_used (
- filter_data()
filters data based on parameter properties.
- class tron_explorer.transaction.Transaction
instantiate an object that contains a methods for multiple request related to transactions.
- get_transaction(hash_: str, properties: Optional[list] = None)
get a specific transaction.
- Parameters
hash (str) – the hash of desired transaction.
- Kwargs
- properties (
list) properties of transaction that will be returned. default is all.
- properties (
- Returns
the desired transaction data.
- Return type
- get_transaction_list_block(number: str, save_live: bool = False, save_path: str = '', order: str = 'DESC', properties: Optional[list] = None, count: int = 10000)
get transactions in a block.
- Args
- properties (
list) properties of transaction that will be returned. default is all.
- properties (
- sort (
str) the property that transaction are ordered by.
- sort (
- order (
str) order of transaction by time (“ASC” : Ascending , “DESC” : descending).
- order (
- count (
int) number of desired transaction. default is 10000. is ignored when both times are specified.
- count (
- save_live (
bool) if set to True the downloaded data will be saved to a file in each page downloaded to avoid losing data in case of an error.
- save_live (
- save_path (
str) path of folder that data is saved to. default is “”
- save_path (
- Returns
a panda dataframe containing data of desired transactions.
- Return type
Pandas Dataframe
- get_transaction_list_account(address: str, save_live: bool = False, save_path: str = '', order: str = 'DESC', properties: Optional[list] = None, count: int = 10000)
get transactions related to an account.
- Args
- properties (
list) properties of transaction that will be returned. default is all.
- properties (
- sort (
str) the property that transaction are ordered by.
- sort (
- order (
str) order of transaction by time (“ASC” : Ascending , “DESC” : descending).
- order (
- count (
int) number of desired transaction. default is 10000. is ignored when both times are specified.
- count (
- save_live (
bool) if set to True the downloaded data will be saved to a file in each page downloaded to avoid losing data in case of an error.
- save_live (
- save_path (
str) path of folder that data is saved to. default is “”
- save_path (
- Returns
a panda dataframe containing data of desired transactions.
- Return type
Pandas Dataframe
- get_transaction_list_blockchain(start_timestamp: Optional[int] = None, end_timestamp: Optional[int] = None, save_live: bool = False, save_path: str = '', order: str = 'DESC', properties: Optional[list] = None, count: int = 10000)
get transactions in blockchain.
- Args
- start_timestamp (
int) start timestamp of query. default is None. (milliseconds)
- start_timestamp (
- end_timestamp (
int) end timestamp of query. default is None. (milliseconds)
- end_timestamp (
- properties (
list) properties of transaction that will be returned. default is all.
- properties (
- order (
str) order of transaction by time (“ASC” : Ascending , “DESC” : descending).
- order (
- count (
int) number of desired transactions. default is 10000. is ignored when both times are specified.
- count (
- save_live (
bool) if set to True the downloaded data will be saved to a file in each page downloaded to avoid losing data in case of an error.
- save_live (
- save_path (
str) path of folder that data is saved to. default is “”
- save_path (
- Returns
a panda dataframe containing data of desired transactions.
- Return type
Pandas Dataframe
Smart Contracts
- class tron_explorer.smart_contract.SmartContractDataMap(data, properties)
- properties_list = ['contract_address', 'name', 'tag', 'timestamp', 'balance', 'number_of_calls', 'creator_address', 'creation_address', 'creation_transaction_id', 'energy_consumption_ratio', 'remaining_energy', 'token_name', 'token_abbr', 'token_issuer_address']
a DataMap type class that is responsible for filtering properties of smart contract data instances.
- Parameters
data (dict) – the data instance.
properties (list) – properties of smart contract instance that will be returned. to see what properties are included see below
- Properties
- contract_address (
str) address of the contract.
- contract_address (
- name (
str) name of the contract.
- name (
- tag (
str) public tag of contract.
- tag (
- timestamp (
int) timestamp of the contract creation. (milliseconds)
- timestamp (
- balance (
int) balance of contract. (trx)
- balance (
- number_of_calls (
int) number of times that contract has been triggered.
- number_of_calls (
- creator_address (
str) address of the creator.
only available when getting data for a single contract.
- creator_address (
- creation_transaction_id (
str) hash of the transaction that was used to create the contract.
only available when getting data for a single contract.
- creation_transaction_id (
- energy_consumption_ratio (
list) energy usage percentage by the user and contract.([“user”,”contract”])
only available when getting data for a single contract.
- energy_consumption_ratio (
- token_name (
str) name of trc20 contract token issued by the contract.
- token_name (
- token_abbr (
str) name abbreviation of token issued by contract.
- token_abbr (
- token_issuer_address (
str) address of the account that issued the token.
- token_issuer_address (
- filter_data()
filters data based on parameter properties.
- class tron_explorer.smart_contract.SmartContract
instantiate an object that contains a methods for multiple request related to smart contracts.
- static _check_list_params(sort)
checks list request params for exceptions.
- Parameters
sort (str) – the property that accounts are ordered by.
- get_smart_contract(contract_address: str, properties: Optional[list] = None)
get data for a specific smart contract.
- Parameters
contract_address (str) – address of the contract.
- Args
- properties (
list) properties of accounts that will be returned. default is all.
- properties (
- Returns
the desired account data.
- Return type
- get_smart_contract_list_blockchain(start_timestamp: Optional[int] = None, end_timestamp: Optional[int] = None, save_live: bool = False, save_path: str = '', sort: str = 'timestamp', order: str = 'DESC', properties: Optional[list] = None, count: int = 10000, verified_only: bool = False, open_source_only: bool = False)
get data for a list of account.
- Args
- start_timestamp (
int) start timestamp of query. default is None. (milliseconds)
- start_timestamp (
- end_timestamp (
int) end timestamp of query. default is None. (milliseconds)
- end_timestamp (
- properties (
list) properties of contracts that will be returned. default is all.
- properties (
- sort (
str) the property that contracts are ordered by. can be sorted by “number_of_calls”, “balance”, “timestamp”. default is “timestamp”.
- sort (
- order (
str) order of contracts by sort (“ASC” : Ascending , “DESC” : descending).
- order (
- count (
int) number of desired contracts. default is 10000. is ignored when both times are specified.
- count (
- verified_only (
bool) get only verified contracts.
- verified_only (
- open_source_only (
bool) get only open_source_only contracts.
- open_source_only (
- save_live (
bool) if set to True the downloaded data will be saved to a file in each page downloaded to avoid losing data in case of an error.
- save_live (
- save_path (
str) path of folder that data is saved to. default is “”
- save_path (
- Returns
a panda dataframe containing data of desired contracts.
- Return type
Pandas Dataframe
TokenList
- class tron_explorer.token_list.TokenListDataMap(data, properties)
- properties_dict = {'contract_address': 'contractAddress', 'description': 'description', 'gain': 'gain', 'market_cap': 'marketcap', 'name': 'name', 'name_abbr': 'abbr', 'number_of_holders': 'nrOfTokenHolders', 'number_of_transactions': 'transferCount', 'owner_address': 'ownerAddress', 'price_in_trx': 'priceInTrx', 'price_in_usd': 'priceInUsd', 'supply': 'supply', 'timestamp': 'dateCreated', 'token_hash': 'hash', 'token_id': 'tokenId', 'vip': 'vip', 'volume_24h': 'volume24hInTrx'}
a DataMap type class that is responsible for filtering properties of token data instances.
- Parameters
data (dict) – the data instance.
properties (list) – properties of token instance that will be returned. to see what properties are included see below
- Trc10
- Properties
- name (
str) name of the token.
- name (
- name_abbr (
str) abbreviation of token name.
- name_abbr (
- owner_address (
str) token’s owner address.
- owner_address (
- token_id (
str) id of the token.
- token_id (
- description (
str) token description.
- description (
- vip (
str) vip status of token.
- vip (
- token_hash (
str) hash of the token.
- token_hash (
- timestamp (
int) timestamp of token’s creation.
- timestamp (
- gain (
float) price changed in last 24 hours. (percentage)
- gain (
- supply (
int) number of token in circulation.
- supply (
- market_cap (
int) market cap of token.
- market_cap (
- volume_24h (
int) token volume traded in last 24h.
- volume_24h (
- price_int_trx (
int) price of token in trx.
- price_int_trx (
- price_int_usd (
int) price of token in usd.
- price_int_usd (
- number_of_holders (
int) number of accounts that hold the token.
- number_of_holders (
- number_of_transactions (
int) number of transactions related to token.
- number_of_transactions (
- Trc20
- Properties
- name (
str) name of the token.
- name (
- name_abbr (
str) abbreviation of token name.
- name_abbr (
- owner_address (
str) token’s owner address.
- owner_address (
- contract_address (
str) address of token’s contract.
- contract_address (
- vip (
str) vip status of token.
- vip (
- timestamp (
int) timestamp of token’s creation.
- timestamp (
- gain (
float) price changed in last 24 hours. (percentage)
- gain (
- supply (
int) number of token in circulation.
- supply (
- market_cap (
int) market cap of token.
- market_cap (
- volume_24h (
int) token volume traded in last 24h.
- volume_24h (
- price_int_trx (
int) price of token in trx.
- price_int_trx (
- price_int_usd (
int) price of token in usd.
- price_int_usd (
- number_of_holders (
int) number of accounts that hold the token.
- number_of_holders (
- number_of_transactions (
int) number of transactions related to token.
- number_of_transactions (
- Trc721 or trc1155
- Properties
- name (
str) name of the token.
- name (
- name_abbr (
str) abbreviation of token name.
- name_abbr (
- contract_address (
str) address of token’s contract.
- contract_address (
- timestamp (
int) timestamp of token’s creation.
- timestamp (
- vip (
str) vip status of token.
- vip (
- supply (
int) number of token in circulation.
- supply (
- number_of_holders (
int) number of accounts that hold the token.
- number_of_holders (
- number_of_transactions (
int) number of transactions related to token.
- number_of_transactions (
- filter_data()
filters data based on parameter properties.
TokenSingle
- class tron_explorer.token_single.TokenSingleDataMap(data, properties)
- properties_dict_trc20 = {'contract_name': 'contract_name', 'gain': '', 'name': 'symbol', 'number_of_holders': 'holder_count', 'number_of_transactions': 'transfer_num', 'owner_address': 'issue_address', 'price_in_usd': '', 'price_int_trx': '', 'supply': '', 'timestamp': '', 'volume_24h': 'volume24h'}
a DataMap type class that is responsible for filtering properties of token data instances.
- Parameters
data (dict) – the data instance.
properties (list) – properties of token instance that will be returned. to see what properties are included see below
- Trc10
- Properties
- name (
str) name of the token.
- name (
- name_abbr (
str) abbreviation of token name.
- name_abbr (
- owner_address (
str) token’s owner address.
- owner_address (
- token_id (
str) id of the token.
- token_id (
- description (
str) token description.
- description (
- timestamp (
int) timestamp of token’s creation.
- timestamp (
- gain (
float) price changed in last 24 hours. (percentage)
- gain (
- supply (
int) number of token in circulation.
- supply (
- market_cap (
int) market cap of token. (trx)
- market_cap (
- volume_24h (
int) token volume traded in last 24h.
- volume_24h (
- price_int_trx (
int) price of token in trx.
- price_int_trx (
- price_int_usd (
int) price of token in usd.
- price_int_usd (
- number_of_holders (
int) number of accounts that hold the token.
- number_of_holders (
- number_of_transactions (
int) number of transactions related to token.
- number_of_transactions (
- Trc20
- Properties
- name (
str) name of the token.
- name (
- owner_address (
str) token’s owner address.
- owner_address (
- contract_address (
str) address of token’s contract.
- contract_address (
- timestamp (
int) timestamp of token’s issue date.
- timestamp (
- gain (
float) price changed in last 24 hours. (percentage)
- gain (
- supply (
int) number of token in circulation.
- supply (
- market_cap (
int) market cap of token.
- market_cap (
- volume_24h (
int) token volume traded in last 24h.
- volume_24h (
- price_int_trx (
int) price of token in trx.
- price_int_trx (
- price_int_usd (
int) price of token in usd.
- price_int_usd (
- number_of_holders (
int) number of accounts that hold the token.
- number_of_holders (
- number_of_transactions (
int) number of transactions related to token.
- number_of_transactions (
- filter_data()
filters data based on parameter properties.
Account
- class tron_explorer.account.AccountDataMap(data: dict, properties: list)
- properties_dict = {'address': 'address', 'address_tag': 'addressTag', 'balance': 'balance', 'latest_operation_time': 'latestOperationTime', 'number_of_transactions': 'totalTransactionCount', 'power': 'power'}
a DataMap type class that is responsible for filtering properties of account data instances.
- Parameters
data (dict) – the data instance.
properties (list) – properties of account instance that will be returned. to see what properties are included see below
- Properties
- address (
str) address of the account.
- address (
- address_tag (
str) name of the account.
- address_tag (
- balance (
int) balance of the account (trx).
- balance (
- power (
int) amount of votes that this account has.
- power (
- total_transactions (
int) number of transaction related to the account.
- total_transactions (
- latest_operation_time (
int) timestamp of last operation the account has performed.
- latest_operation_time (
- filter_data()
filters data based on parameter properties.
- class tron_explorer.account.Account
instantiate an object that contains a methods for multiple request related to accounts.
- static _check_list_params(sort)
checks list request params for exceptions.
- Parameters
sort (str) – the property that accounts are ordered by.
- get_account(account_address: str, properties: Optional[list] = None)
get data for a specific account.
- Parameters
account_address (str) – address of the account.
- Args
- properties (
list) properties of accounts that will be returned. default is all.
- properties (
- Returns
the desired account data.
- Return type
- get_account_list(save_live: bool = False, save_path: str = '', sort: str = 'power', order: str = 'DESC', properties: Optional[list] = None, count: int = 10000)
get data for a list of accounts.
- Args
- start_timestamp (
int) start timestamp of query. default is None. (milliseconds)
- start_timestamp (
- end_timestamp (
int) end timestamp of query. default is None. (milliseconds)
- end_timestamp (
- properties (
list) properties of accounts that will be returned. default is all.
- properties (
- sort (
str) the property that accounts are ordered by. can be sorted by “power”, “balance”. default is “power”.
- sort (
- order (
str) order of accounts by sort (“ASC” : Ascending , “DESC” : descending).
- order (
- count (
int) number of desired accounts. default is 10000. is ignored when both times are specified.
- count (
- save_live (
bool) if set to True the downloaded data will be saved to a file in each page downloaded to avoid losing data in case of an error.
- save_live (
- save_path (
str) path of folder that data is saved to. default is “”
- save_path (
- Returns
a panda dataframe containing data of desired accounts.
- Return type
Pandas Dataframe
- get_account_analysis(type_: int, account_address: str, start_timestamp: int = 1)
get analysis for an account.
- Parameters
type (int) – indicates type of analysis. 0: balance analysis 1: token transfer analysis 2: energy usage analysis 3: bandwidth usage analysis
account_address (str) – address of desired account.
- Args
- start_timestamp (
int) start timestamp of query. default is 1 (for this specific query input 0 returns only 100 items). (milliseconds)
- start_timestamp (
- Returns
a panda dataframe containing data of desired accounts.
- Return type
Pandas Dataframe
SR
- class tron_explorer.sr.SrDataMap(data, properties)
- properties_dict = {'address': 'address', 'annual_rate': 'annualizedRate', 'change_votes': 'changeVotes', 'distribution': '', 'name': 'name', 'produced_percentage': '', 'produced_total': 'producedTotal', 'rank': '', 'realtime_votes': 'realTimeVotes', 'url': 'url', 'votes_percentage': 'votesPercentage'}
a DataMap type class that is responsible for filtering properties of SR data instances.
- Parameters
data (dict) – the data instance.
properties (list) – properties of SR instance that will be returned. to see what properties are included see below
- Properties
- address (
str) address of the SR account.
- address (
- name (
str) name of the SR.
- name (
- url (
str) SR’s official website.
- url (
- produced_total (
int) numbers of blocks produced by this by the SR.
- produced_total (
- produced_percentage (
float) percentage of blocks produced correctly by the SR.
- produced_percentage (
- realtime_votes (
int) number of SR votes at this moment.
- realtime_votes (
- change_votes (
int) change in number of the votes for since the last cycle.
- change_votes (
- annual_rate (
float) annual profit rate for voters.
- annual_rate (
- distribution_ratio (
list) distribution of reward between voters and SR.([“voters”,”SR”])
- distribution_ratio (
- rank (
int) rank of SR based on number of votes.
- rank (
- filter_data()
filters data based on parameter properties.
- class tron_explorer.sr.SR
instantiate an object that contains a methods for multiple request related to SRs.
- static _check_list_params(sr_type)
checks list request params for exceptions.
- Parameters
sort (str) – type of sr.
- get_sr(sr_address: str, properties: Optional[list] = None)
get a specific SR.
- Parameters
sr_address (str) – the number of desired block.
- Args
- properties (
list) properties of blocks that will be returned. default is all.
- properties (
- Returns
the desired block data.
- Return type
- get_sr_list(sr_type: str = 'all', properties: Optional[list] = None)
get multiple SR data.
- Args
- sr_type (
int) all : returns all SRs. sr : returns only SR. sr_partners : returns only SR partners. sr_candidates : returns only SR candidates. default is all.
- sr_type (
- Returns
a panda dataframe containing data of desired blocks.
- Return type
Pandas Dataframe
Proposals
- class tron_explorer.proposals.ProposalsDataMap(data, properties)
- properties_dict = {'network_parameter': 'parameters', 'proposal_hash': 'proposalHash', 'proposal_id': 'proposalId', 'proposer_address': '', 'timestamp_creation': 'createTime', 'timestamp_expiration': 'expirationTime', 'total_votes': 'totalVotes', 'valid_votes': 'validVotes', 'votes': ''}
a DataMap type class that is responsible for filtering properties of proposal data instances.
- Parameters
data (dict) – the data instance.
properties (list) – properties of proposal instance that will be returned. to see what properties are included see below
- Properties
- proposal_id (
str) id of proposal.
- proposal_id (
- proposer_address (
str) proposer account address.
- proposer_address (
- proposal_hash (
str) hash of proposal.
- proposal_hash (
- network_parameter (
list) list of proposed parameters to changed (key) and proposed new value (value).[“key”,”value”]
- network_parameter (
- timestamp_expiration (
int) creation timestamp of proposal.
- timestamp_expiration (
- timestamp_expiration (
int) expiration timestamp of proposal.
- timestamp_expiration (
- total_votes (
int) total number of votes on proposal.
- total_votes (
- total_votes (
int) number of valid votes on proposal.
- total_votes (
- total_votes (
votes) number of approvals and vetos. [“approvals”,”veto”]
- total_votes (
- filter_data()
filters data based on parameter properties.
- class tron_explorer.proposals.Proposals
instantiate an object that contains a methods for multiple request related to proposals.
- get_list_proposals(save_live: bool = False, save_path: str = '', properties: Optional[list] = None, count: int = 100)
get data for a list of proposals.
- Args
- properties (
list) properties of proposals that will be returned. default is all.
- properties (
- count (
int) number of desired proposals. default is 100. is ignored when both times are specified.
- count (
- save_live (
bool) if set to True the downloaded data will be saved to a file in each page downloaded to avoid losing data in case of an error.
- save_live (
- save_path (
str) path of folder that data is saved to. default is “”
- save_path (
- Returns
a panda dataframe containing data of desired proposals.
- Return type
Pandas Dataframe
- get_list_network_parameters()
get data for a list of network parameters.
- Returns
a list containing network parameters and their current value.
- Return type
list
Utils
- class tron_explorer.utils.SendRequestSingle(address, params: Optional[dict] = None)
sends get request to get one instance of data.
- Parameters
address (string) – The address of api segment to get data from.
params (dict) – parameters of api request
- Variables
BASE_API – base url of api.
- _add_address()
adds the address to base url.
- _param_builder()
removes potential None values in request params.
- _send_request()
sends get request and passes the data.
- Returns
the data returned by api.
- Return type
dict
- get_data()
creates the request and passes data.
- Returns
the data returned by api.
- Return type
dict
- class tron_explorer.utils.SendRequestMultiple(address: str, save_live: bool, save_path: str, params: Optional[dict] = None, max_query: int = 10000)
uses SendRequest class to get paginated data from queries with more than one instance.
- Parameters
address (string) – The address of used api segment.
params (dict) – parameters of api request.
MAX (int) – the maximum number of instances returned for a query.
save_live – if set to True the downloaded data will be saved to a file in each page downloaded
to avoid losing data. :type save_live: bool
- Parameters
save_path (str) – path of folder that data is saved to.
- Variables
LIMIT – the number of instances in each page of query.
- _save_live(all_data)
saves data to csv file.
- _time_both(properties, data_map, data_key)
uses SendRequest class to get paginated data from multiple queries with more than one instance when both start and end time are specified, and return the combined data.
- Parameters
properties (list) – properties of instances that will be returned.
data_map (DataMap) – the DataMap type class name that is responsible for filtering properties.
data_key (str) – the key to data segment of request result.
- Returns
desired data instances.
- Return type
list
- _time_one(count, properties, data_map, side, data_key)
uses SendRequest class to get paginated data from multiple queries with more than one instance when start or end times are specified, and return the combined data.
- Parameters
count (int) – number of instances that will be returned.
properties (list) – properties of instances that will be returned.
data_map (DataMap) – the DataMap type class name that is responsible for filtering properties.
data_key (str) – the key to data segment of request result.
side (str) – indicates which of start or end time is specified.
- Returns
desired data instances.
- Return type
list
- _time_none(count, properties, data_map, data_key)
uses SendRequest class to get paginated data from multiple queries with more than one instance when none of start or end times are specified.
- Parameters
count (int) – number of instances that will be returned.
properties (list) – properties of instances that will be returned.
data_key (str) – the key to data segment of request result.
data_map (DataMap) – the DataMap type class name that is responsible for filtering properties.
- Returns
desired data instances.
- Return type
list
- static _check_list_params(start_timestamp: int, end_timestamp: int, order: str, count: int, delete_order)
checks list request params for exceptions.
- Parameters
start_timestamp – start timestamp for query. (in milliseconds)
end_timestamp – end timestamp for query. (in milliseconds)
order (str) – the order of blocks by time.
delete_order (bool) – whether if order param should be removed before sending request.
- Raise
ParameterException
- _build_params(count: int, order: str, sort: str, delete_order)
make full request params.
- Parameters
count (int) – number of instances that will be returned.
order (str) – the order of blocks by sort.
sort (str) – the property that data is ordered by.
delete_order (bool) – whether if order param should be removed before sending request.
- get_data_multiple(count: int, properties: list, data_map, delete_order: bool = True, data_key: str = 'data')
determines which of the data gathering methods should be used based on start or end time parameters.
- Parameters
data_key (str) – the key to data segment of request result.
count (int) – number of instances that will be returned.
properties (list) – properties of instances that will be returned.
data_map (DataMap) – the DataMap type class name that is responsible for filtering properties.
delete_order (bool) – whether if order param should be removed before sending request.
- Returns
a panda dataframe containing data of desired data instances.
- Return type
Pandas Dataframe
Exceptions
- exception tron_explorer.exceptions.PropertiesException(properties, datamap)
used to raise exceptions related to properties.
- exception tron_explorer.exceptions.ParameterWarning(message, parameter)
used to raise warnings related to parameters.
- Variables
ORDER_WARNING_MESSAGE – a warning message for incorrect use of “order” parameter.
COUNT_WARNING_MESSAGE – a warning message for incorrect use of “count” parameter.
TIME_WARNING_MESSAGE – a warning message for when timestamp is given in seconds
- exception tron_explorer.exceptions.ParameterException(message, parameter)
used to raise exceptions related to parameters.
- Variables
ORDER_EXCEPTION_MESSAGE – an error message for incorrect use of “order” parameter.
TIME_EXCEPTION_BIGGER_MESSAGE – an error message for incorrect use of “start_timestamp” or “end_timestamp” parameters.
TIME_EXCEPTION_NEGATIVE_MESSAGE – an error message for incorrect use of “start_timestamp” or “end_timestamp” parameters.
SORT_EXCEPTION_MESSAGE – an error message for incorrect use of “start_timestamp” or “end_timestamp” parameters.