ETH APIs
API endpoints and methods for interacting with the MAALCHAIN
eth_chainId
Returns the currently configured chain id, a value used in replay-protected transaction signing as introduced by EIP-155.
Parameters
None
Returns
QUANTITY - big integer of the current chain id.
Example for testnet
Example for mainnet
eth_syncing
Returns information about the sync status of the node
Parameters
None
Returns
* Boolean (FALSE) - if the node isn't syncing (which means it has fully synced)
* Object - an object with sync status data if the node is syncing
startingBlock: QUANTITY - The block at which the import started (will only be reset, after the sync reached his head)
currentBlock: QUANTITY - The current block, same as eth_blockNumber
highestBlock: QUANTITY - The estimated highest block
Example
eth_getBlockByNumber
Returns block information by number.
Parameters
QUANTITY|TAG - integer of a block number, or the string "latest"
Boolean - If true it returns the full transaction objects, if false only the hashes of the transactions.
Returns
Object - A block object, or null when no block was found:
number: QUANTITY - the block number.
hash: DATA, 32 Bytes - hash of the block.
parentHash: DATA, 32 Bytes - hash of the parent block.
nonce: DATA, 8 Bytes - hash of the generated proof-of-work.
sha3Uncles: DATA, 32 Bytes - SHA3 of the uncles data in the block.
logsBloom: DATA, 256 Bytes - the bloom filter for the logs of the block.
transactionsRoot: DATA, 32 Bytes - the root of the transaction trie of the block.
stateRoot: DATA, 32 Bytes - the root of the final state trie of the block.
receiptsRoot: DATA, 32 Bytes - the root of the receipts trie of the block.
miner: DATA, 20 Bytes - the address of the beneficiary to whom the mining rewards were given.
difficulty: QUANTITY - integer of the difficulty for this block.
totalDifficulty: QUANTITY - integer of the total difficulty of the chain until this block.
extraData: DATA - the “extra data” field of this block.
size: QUANTITY - integer the size of this block in bytes.
gasLimit: QUANTITY - the maximum gas allowed in this block.
gasUsed: QUANTITY - the total used gas by all transactions in this block.
timestamp: QUANTITY - the unix timestamp for when the block was collated.
transactions: Array - Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter.
uncles: Array - Array of uncle hashes.
Example
eth_getBlockByHash
Returns block information by hash.
Parameters
DATA , 32 Bytes - Hash of a block.
Boolean - If true it returns the full transaction objects, if false only the hashes of the transactions.
Returns
Object - A block object, or null when no block was found:
number: QUANTITY - the block number.
hash: DATA, 32 Bytes - hash of the block.
parentHash: DATA, 32 Bytes - hash of the parent block.
nonce: DATA, 8 Bytes - hash of the generated proof-of-work.
sha3Uncles: DATA, 32 Bytes - SHA3 of the uncles data in the block.
logsBloom: DATA, 256 Bytes - the bloom filter for the logs of the block.
transactionsRoot: DATA, 32 Bytes - the root of the transaction trie of the block.
stateRoot: DATA, 32 Bytes - the root of the final state trie of the block.
receiptsRoot: DATA, 32 Bytes - the root of the receipts trie of the block.
miner: DATA, 20 Bytes - the address of the beneficiary to whom the mining rewards were given.
difficulty: QUANTITY - integer of the difficulty for this block.
totalDifficulty: QUANTITY - integer of the total difficulty of the chain until this block.
extraData: DATA - the “extra data” field of this block.
size: QUANTITY - integer the size of this block in bytes.
gasLimit: QUANTITY - the maximum gas allowed in this block.
gasUsed: QUANTITY - the total used gas by all transactions in this block.
timestamp: QUANTITY - the unix timestamp for when the block was collated.
transactions: Array - Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter.
uncles: Array - Array of uncle hashes.
Example
eth_blockNumber
Returns the number of the most recent block.
Parameters
None
Returns
QUANTITY - integer of the current block number the client is on.
Example
eth_gasPrice
Returns the current price of gas in wei. If minimum gas price is enforced by setting the --price-limit
flag, this endpoint will return the value defined by this flag as minimum gas price.
Parameters
None
Returns
QUANTITY - integer of the current gas price in wei.
Example
eth_getBalance
Returns the balance of the account of the given address.
Parameters
DATA, 20 Bytes - address to check for balance.
QUANTITY|TAG - integer block number, or the string "latest"
Returns
QUANTITY - integer of the current balance in wei.
Example
eth_sendRawTransaction
Creates new message call transaction or a contract creation for signed transactions.
Parameters
DATA - The signed transaction data.
Returns
DATA, 32 Bytes - the transaction hash, or the zero hash if the transaction is not yet available.
Example
eth_getTransactionByHash
Returns the information about a transaction requested by transaction hash.
Parameters
DATA, 32 Bytes - hash of a transaction
Returns
Object - A transaction object, or null when no transaction was found:
blockHash: DATA, 32 Bytes - hash of the block where this transaction was in.
blockNumber: QUANTITY - block number where this transaction was in.
from: DATA, 20 Bytes - address of the sender.
gas: QUANTITY - gas provided by the sender.
gasPrice: QUANTITY - gas price provided by the sender in Wei.
hash: DATA, 32 Bytes - hash of the transaction.
input: DATA - the data send along with the transaction.
nonce: QUANTITY - the number of transactions made by the sender prior to this one.
to: DATA, 20 Bytes - address of the receiver. null when its a contract creation transaction.
transactionIndex: QUANTITY - integer of the transactions index position in the block.
value: QUANTITY - value transferred in Wei.
v: QUANTITY - ECDSA recovery id
r: DATA, 32 Bytes - ECDSA signature r
s: DATA, 32 Bytes - ECDSA signature s
Example
eth_getTransactionReceipt
Returns the receipt of a transaction by transaction hash.
Note That the receipt is not available for pending transactions.
Parameters
DATA, 32 Bytes - hash of a transaction
Returns
Object - A transaction receipt object, or null when no receipt was found:
transactionHash : DATA, 32 Bytes - hash of the transaction.
transactionIndex: QUANTITY - integer of the transactions index position in the block.
blockHash: DATA, 32 Bytes - hash of the block where this transaction was in.
blockNumber: QUANTITY - block number where this transaction was in.
from: DATA, 20 Bytes - address of the sender.
to: DATA, 20 Bytes - address of the receiver. null when its a contract creation transaction.
cumulativeGasUsed : QUANTITY - The total amount of gas used when this transaction was executed in the block.
gasUsed : QUANTITY - The amount of gas used by this specific transaction alone.
contractAddress : DATA, 20 Bytes - The contract address created, if the transaction was a contract creation, otherwise null.
logs: Array - Array of log objects, which this transaction generated.
logsBloom: DATA, 256 Bytes - Bloom filter for light clients to quickly retrieve related logs.
It also returns either :
root : DATA 32 bytes - post-transaction stateroot (pre Byzantium)
status: QUANTITY - either 1 (success) or 0 (failure)
Example
eth_getTransactionCount
Returns the number of transactions sent from an address.
Parameters
DATA, 20 Bytes - address.
QUANTITY|TAG - integer block number, or the string "latest"
Returns
QUANTITY - integer of the number of transactions send from this address.
Example
eth_getBlockTransactionCountByNumber
Returns the number of transactions in a block matching the given block number.
Parameters
QUANTITY|TAG - integer of a block number, or the string "latest"
Returns
QUANTITY - integer of the number of transactions in this block.
Example
eth_getLogs
Returns an array of all logs matching a given filter object.
Parameters
Object - The filter options:
fromBlock: QUANTITY|TAG - (optional, default: "latest") Integer block number, or "latest" for the last mined block
toBlock: QUANTITY|TAG - (optional, default: "latest") Integer block number, or "latest" for the last mined block
address: DATA|Array, 20 Bytes - (optional) Contract address or a list of addresses from which logs should originate.
topics: Array of DATA - (optional) Array of 32 Bytes DATA topics. Topics are order-dependent. Each topic can also be an array of DATA with “or” options.
blockhash: DATA, 32 Bytes - (optional, future) With the addition of EIP-234, blockHash will be a new filter option which restricts the logs returned to the single block with the 32-byte hash blockHash. Using blockHash is equivalent to fromBlock = toBlock = the block number with hash blockHash. If blockHash is present in the filter criteria, then neither fromBlock nor toBlock is allowed.
Returns
QUANTITY - integer of the number of transactions send from this address.
Example
eth_getCode
Returns code at a given address.
Parameters
DATA, 20 Bytes - address
QUANTITY|TAG - integer block number, or the string "latest"
Returns
DATA - the code from the given address.
Example
eth_call
Executes a new message call immediately without creating a transaction on the blockchain.
Parameters
Object - The transaction call object
from: DATA, 20 Bytes - (optional) The address the transaction is sent from.
to: DATA, 20 Bytes - The address the transaction is directed to.
gas: QUANTITY - (optional) Integer of the gas provided for the transaction execution. eth_call consumes zero gas, but this parameter may be needed by some executions.
gasPrice: QUANTITY - (optional) Integer of the gasPrice used for each paid gas
value: QUANTITY - (optional) Integer of the value sent with this transaction
data: DATA - (optional) Hash of the method signature and encoded parameters. For details see Ethereum Contract ABI in the Solidity documentation
QUANTITY|TAG - integer block number, or the string "latest", see the default block paramete
Returns
DATA - the return value of executed contract.
Example
eth_getStorageAt
Returns the value from a storage position at a given address.
Parameters
DATA, 20 Bytes - address of the storage.
QUANTITY - integer of the position in the storage.
QUANTITY|TAG - integer block number, or the string "latest"
Returns
DATA - the value at this storage position.
Example
eth_estimateGas
Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain. Note that the estimate may be significantly more than the amount of gas actually used by the transaction, for a variety of reasons including EVM mechanics and node performance.
Parameters
Expect that all properties are optional.
Object - The transaction call object
from: DATA, 20 Bytes - The address the transaction is sent from.
to: DATA, 20 Bytes - The address the transaction is directed to.
gas: QUANTITY - Integer of the gas provided for the transaction execution. eth_call consumes zero gas, but this parameter may be needed by some executions.
gasPrice: QUANTITY - Integer of the gasPrice used for each paid gas
value: QUANTITY - Integer of the value sent with this transaction
data: DATA - Hash of the method signature and encoded parameters. For details see Ethereum Contract ABI in the Solidity documentation
QUANTITY|TAG - integer block number, or the string "latest", see the default block paramete
Returns
QUANTITY - the amount of gas used.
Example
eth_newFilter
Creates a filter object, based on filter options. To get all matching logs for specific filter, call eth_getFilterLogs. To check if the state has changed, call eth_getFilterChanges.
Parameters
Object - The filter options:
fromBlock: QUANTITY|TAG - (optional, default: "latest") Integer block number, or "latest" for the last mined block
toBlock: QUANTITY|TAG - (optional, default: "latest") Integer block number, or "latest" for the last mined block
address: DATA|Array, 20 Bytes - (optional) Contract address or a list of addresses from which logs should originate.
topics: Array of DATA - (optional) Array of 32 Bytes DATA topics. Topics are order-dependent. Each topic can also be an array of DATA with “or” options.
Returns
QUANTITY - A filter id.
Example
eth_newBlockFilter
Creates a filter in the node, to notify when a new block arrives. To check if the state has changed, call eth_getFilterChanges.
Parameters
None
Returns
QUANTITY - A filter id.
Example
eth_getFilterLogs
Returns an array of all logs matching filter with given id.
ETH_GETLOGS VS. ETH_GETFILTERLOGS
These 2 methods will return the same results for same filter options:
eth_getLogs with params [options]
eth_newFilter with params [options], getting a [filterId] back, then calling eth_getFilterLogs with [filterId]
Parameters
QUANTITY - the filter id.
Returns
Array - Array of log objects, or an empty array
For filters created with eth_newFilter logs are objects with the following params:
removed: TAG - true when the log was removed, due to a chain reorganization. false if its a valid log.
logIndex: QUANTITY - integer of the log index position in the block. null when its pending log.
transactionIndex: QUANTITY - integer of the transactions index position log was created from. null when its pending log.
transactionHash: DATA, 32 Bytes - hash of the transactions this log was created from. null when its pending log.
blockHash: DATA, 32 Bytes - hash of the block where this log was in. null when its pending log.
blockNumber: QUANTITY - the block number where this log was in. null when its pending log.
address: DATA, 20 Bytes - address from which this log originated.
data: DATA - contains one or more 32 Bytes non-indexed arguments of the log.
topics: Array of DATA - Array of 0 to 4 32 Bytes DATA of indexed log arguments. (In solidity: The first topic is the hash of the signature of the event (e.g. Deposit(address,bytes32,uint256)), except you declared the event with the anonymous specifier.)
Example
eth_getFilterChanges
Polling method for a filter, which returns an array of logs that occurred since the last poll.
Parameters
QUANTITY - the filter id.
Returns
Array - Array of log objects, or an empty array if nothing has changed since last poll.
For filters created with eth_newBlockFilter the return are block hashes (DATA, 32 Bytes), e.g. ["0x3454645634534..."].
For filters created with eth_newFilter logs are objects with the following params:
removed: TAG - true when the log was removed, due to a chain reorganization. false if its a valid log.
logIndex: QUANTITY - integer of the log index position in the block. null when its pending log.
transactionIndex: QUANTITY - integer of the transactions index position log was created from. null when its pending log.
transactionHash: DATA, 32 Bytes - hash of the transactions this log was created from. null when its pending log.
blockHash: DATA, 32 Bytes - hash of the block where this log was in. null when its pending log.
blockNumber: QUANTITY - the block number where this log was in. null when its pending log.
address: DATA, 20 Bytes - address from which this log originated.
data: DATA - contains one or more 32 Bytes non-indexed arguments of the log.
topics: Array of DATA - Array of 0 to 4 32 Bytes DATA of indexed log arguments. (In solidity: The first topic is the hash of the signature of the event (e.g. Deposit(address,bytes32,uint256)), except you declared the event with the anonymous specifier.)
Example
eth_uninstallFilter
Uninstalls a filter with a given id. Should always be called when a watch is no longer needed. Additionally, filters timeout when they aren’t requested with eth_getFilterChanges for some time.
Parameters
QUANTITY - The filter id.
Returns
Boolean - true if the filter was successfully uninstalled, otherwise false.
Example
eth_unsubscribe
Subscriptions are cancelled with a regular RPC call with eth_unsubscribe as a method and the subscription id as the first parameter. It returns a bool indicating if the subscription was cancelled successfully.
Parameters
SUBSCRIPTION ID
Returns
UNSUBSCRIBED FLAG - true if the subscription was cancelled successful.
Example
Last updated