EVM API Reference

Web3 JSON-RPC protocol

eth_protocolVersion

Returns the current Fractal protocol version.

Parameters

none

Returns

String - The current ethereum protocol version

Example

Request

curl localhost:8545 \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"method":"eth_protocolVersion","params":[],"id":1,"jsonrpc":"2.0"}'

Response

{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "54"
}

eth_chainId

Returns the current Fractal chain ID

Parameters

none

Returns

String - The current Fractal chain ID

Example

Request

Response

eth_accounts

Returns a list of addresses owned by client.

Parameters

none

Returns

Array - 20 Bytes - addresses owned by the client.

Example

Request

Response

eth_getBalance

Returns a list of addresses owned by client.

Parameters

  1. Address - 20 Bytes - address to check for balance.

  2. Quantity or Tag - (optional) Integer block number, or the string 'latest', 'earliest' or 'pending'.

Returns

Quantity - integer of the current balance in wei.

Example

Request

Response

eth_sendTransaction

Creates new message call transaction or a contract creation, if the data field contains code.

Parameters

  1. Object - The transaction object

    • from: Address - 20 Bytes - The address the transaction is sent from.

    • to: Address - (optional) 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 gas price used for each paid gas.

    • value: Quantity - (optional) Integer of the value sent with this transaction.

    • data: Data - (optional) 4 byte hash of the method signature followed by encoded parameters. For details, see Ethereum Contract ABI.

    • nonce: Quantity - (optional) Integer of a nonce. This allows you to overwrite your own pending transactions that use the same nonce.

    • condition: Object - (optional) Conditional submission of the transaction. It can be either an integer block number { block: 1 } or UTC timestamp (in seconds) { time: 1491290692 } or null.

Returns

Hash - 32 Bytes - the transaction hash or the zero hash if the transaction is not yet available.

Use eth_getTransactionReceipt to get the contract address after the transaction was mined when you created a contract.

Example

Request

Response

back to top

eth_call

Creates new message call transaction or a contract creation if the data field contains code.

Parameters

  1. Object - The transaction call object

    • from: Address - 20 Bytes - The address the transaction is sent from.

    • to: Address - (optional) 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 gas price used for each paid gas.

    • value: Quantity - (optional) Integer of the value sent with this transaction.

    • data: Data - (optional) 4 byte hash of the method signature followed by encoded parameters. For details see Ethereum Contract ABI.

  2. Quantity or Tag - (optional) Integer block number, or the string 'latest', 'earliest' or 'pending'.

Returns

Data - the return value of the executed contract.

Example

Request

Response

back to top

eth_coinbase

Returns the client's coinbase address.

Parameters

none

Returns

Data - 20 bytes - the current coinbase address.

Example

Request

Response

back to top

eth_gasPrice

Returns the current price per gas in wei.

Parameters

none

Returns

Quantity - integer of the current gas price in wei.

Example

Request

Response

back to top

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

Request

Response

back to top

eth_getStorageAt

Returns the value from a storage position at a given address.

Parameters

  1. Address - 20 Bytes - address of the storage.

  2. Quantity - integer of the position in the storage.

  3. Quantity or Tag - (optional) integer block number, or the string 'latest', 'earliest' or 'pending'.

Returns

Data - the value at this storage position.

Example

Request

Response

back to top

eth_getBlockByHash

Returns information about a block by hash.

Parameters

  1. Data - 32 Bytes - Hash of a block

  2. 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. Null when it's a pending block.

  • hash: DATA, 32 Bytes - hash of the block. Null when it is a pending block.

  • parentHash: DATA, 32 Bytes - hash of the parent block.

  • nonce: DATA, 8 Bytes - hash of the generated proof-of-work. Null when it is a pending block.

  • 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. Null when it is a pending 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-byte transaction hashes, depending on the last given parameter.

  • uncles: Array - Array of uncle hashes.

Example

Request

Response

back to top

eth_getBlockByNumber

Returns information about a block by hash.

Parameters

  1. Quantity or Tag - integer of a block number, or the string 'earliest', 'latest' or 'pending'.

  2. 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. Null when it is a pending block.

  • hash: DATA, 32 Bytes - hash of the block. Null when it is a pending block.

  • parentHash: DATA, 32 Bytes - hash of the parent block.

  • author: Address - 20 Bytes - alias of 'author'

  • miner: DATA, 20 Bytes - the address of the beneficiary to whom the mining rewards were given.

  • 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-byte transaction hashes, depending on the last given parameter.

Example

Request

Response

back to top

eth_getTransactionCount

Returns the number of transactions sent from an address.

Parameters

  1. Address - 20 Bytes - address

  2. Quantity or Tag - (optional) integer block number, or the string 'latest', 'earliest' or 'pending'.

Returns

Quantity - integer of the number of transactions sent from this address.

Example

Request

Response

back to top

eth_getBlockTransactionCountByHash

Returns the number of transactions in a block from a block matching the given block hash.

Parameters

  1. Hash - 32 Bytes - hash of a block

Returns

Quantity - integer of the number of transactions in this block.

Example

Request

Response

back to top

eth_getBlockTransactionCountByNumber

Returns the number of transactions in a block matching the given block number.

Parameters

  1. Quantity or Tag - (optional) integer block number, or the string 'latest', 'earliest' or 'pending'.

Returns

Quantity - integer of the number of transactions in this block.

Example

Request

Response

back to top

eth_getCode

Returns code at a given address

Parameters

  1. Address - 20 bytes - address

  2. Quantity or Tag - (optional) integer block number, or the string 'latest', 'earliest' or 'pending'.

Returns

Data - the code from the given address.

Example

Request

Response

back to top

eth_sendRawTransaction

Creates new message call transactions or a contract creation for signed transactions.

Parameters

  1. Data - The signed transaction data.

Returns

Hash - 32 bytes - the transaction hash or the zero hash if the transaction is not yet available.

Example

Request

Response

back to top

eth_estimateGas

Makes a call or transaction, which won't be added to the blockchain, and returns the used gas, which can be used for estimating the used gas.

Parameters

  1. Object - Same as eth_call parameters, except that all properties are optional.

    • from: Address - (optional) 20 Bytes - The address the transaction is sent from.

    • to: Address - (optional when creating new contract) 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 gas price used for each paid gas.

    • value: Quantity - (optional) Integer of the value sent with this transaction.

    • data: Data - (optional) 4 byte hash of the method signature followed by encoded parameters. For details,` see Ethereum Contract ABI.

  2. Quantity or Tag - (optional) Integer block number, or the string 'latest', 'earliest' or 'pending', see the default block parameter.

Returns

Quantity - The amount of gas used.

Example

Request

Response

back to top

eth_getTransactionByHash

Returns the information about a transaction requested by transaction hash.

Parameters

  1. Hash - 32 Bytes - hash of a transaction.

Returns

  1. Object - A transaction object, or null when no transaction was found:

    • hash: Hash - 32 Bytes - hash of the transaction.

    • nonce: Quantity - the number of transactions made by the sender prior to this one.

    • blockHash: Hash - 32 Bytes - hash of the block where this transaction was in. null when its pending.

    • blockNumber: Quantity or Tag - block number where this transaction was in. null when its pending.

    • transactionIndex: Quantity - integer of the transactions index position in the block. null when its pending.

    • from: Address - 20 Bytes - address of the sender.

    • to: Address - 20 Bytes - address of the receiver. null when its a contract creation transaction.

    • value: Quantity - value transferred in Wei.

    • gasPrice: Quantity - gas price provided by the sender in Wei.

    • gas: Quantity - gas provided by the sender.

    • input: Data - the data send along with the transaction.

    • v: Quantity - the standardised V field of the signature.

    • standardV: Quantity - the standardised V field of the signature (0 or 1).

    • r: Quantity - the R field of the signature.

    • raw: Data - raw transaction data

    • publicKey: Hash - public key of the signer.

    • chainId: Quantity - the chain id of the transaction, if any.

    • creates: Hash - creates contract hash

    • condition: Object - (optional) conditional submission, Block number in block or timestamp in time or null.

Example

Request

Response

back to top

eth_getTransactionByBlockHashAndIndex

Returns information about a transaction by block hash and transaction index position.

Parameters

  1. Data - 32 bytes - hash of a block

  2. Quantity - integer of the transaction index position

Returns

See eth_getTransactionByHash

Example

Request

Response See eth_getTransactionByHash

back to top

eth_getTransactionByBlockNumberAndIndex

Returns information about a transaction by block number and transaction index position.

Parameters

  1. Quantity or Tag - a block number, or the string "earliest", "latest" or "pending".

  2. Quantity - integer of the transaction index position

Returns

See eth_getTransactionByHash

Example

Request

Response See eth_getTransactionByHash

back to top

eth_getTransactionReceipt

Returns the receipt of a transaction by transaction hash.

Parameters

  1. Hash - hash of a transaction.

Returns

  1. Object - A transaction receipt object, or null when no receipt was found:

    • blockHash: Hash - 32 Bytes - hash of the block where this transaction was in.

    • blockNumber: Quantity or Tag - block number where this transaction was in.

    • contractAddress: Address - 20 Bytes - The contract address created, if the transaction was a contract creation, otherwise null.

    • cumulativeGasUsed: Quantity - The total amount of gas used when this transaction was executed in the block.

    • from: Address - 20 Bytes - The address of the sender.

    • to: Address - 20 Bytes - The address of the receiver. null when it’s a contract creation transaction.

    • gasUsed: Quantity - The amount of gas used by this specific transaction alone.

    • logs: Array - Array of log objects, which this transaction generated.

    • logsBloom: Hash - 256 Bytes - A bloom filter of logs/events generated by contracts during transaction execution. Used to efficiently rule out transactions without expected logs.

    • root: Hash - 32 Bytes - Merkle root of the state trie after the transaction has been executed (optional after Byzantium hard fork EIP609)

    • status: Quantity - 0x0 indicates transaction failure , 0x1 indicates transaction success. Set for blocks mined after Byzantium hard fork EIP609, null before.

    • transactionHash: Hash - 32 Bytes - hash of the transaction.

    • transactionIndex: Quantity - Integer of the transactions index position in the block.

Example

Request

Response

back to top

eth_getLogs

Returns an array of all logs matching a given filter object.

Parameters

  1. Object - The filter options:

    • fromBlock: QUANTITY|TAG - (optional, default: "latest") Integer block number, or "latest" for the last mined block or "pending", "earliest" for not yet mined transactions.

    • toBlock: QUANTITY|TAG - (optional, default: "latest") Integer block number, or "latest" for the last mined block or "pending", "earliest" for not yet mined transactions.

    • 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 in the filter criteria, then neither fromBlock nor toBlock are allowed.

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_newPendingTransactionFilter the return are transaction hashes (DATA, 32 Bytes), e.g. ["0x6345343454645..."].

  • For filters created with eth_newFilter logs are objects with 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. null when its pending log.

    • blockNumber: QUANTITY - the block number where this log was in. null when its pending. 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

Request

Response

Last updated