GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • etclabscore/core-geth
  • CoreGeth
  • JSON RPC API
  • Core
  • Developers
  • Getting started
  • Postmortems
  • Tutorials
  • OpenRPC Discovery
  • "trace" Module Overview
  • Admin
  • Debug
  • Eth
  • Ethash

This view

  • Original page
  • New address

GeezerVison is showing etclabscore.github.io (truncated) — Eth - CoreGeth Documentation

Eth

Entity Version
Source 1.12.14-unstable/generated-at:2023-09-04T08:02:34-06:00
OpenRPC 1.2.6

eth_accounts¶

Accounts returns the collection of accounts this node manages.

Params (0)¶

None

Result¶

commonAddress []common.Address

  • Required: ✓ Yes
Schema
1
2
3
4
5
6
7
8
9
- items: 

        - description: `Hex representation of a Keccak 256 hash POINTER`
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: string


- type: array
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
{
    "items": [
        {
            "description": "Hex representation of a Keccak 256 hash POINTER",
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": [
                "string"
            ]
        }
    ],
    "type": [
        "array"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_accounts", "params": []}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_accounts", "params": []}'
Javascript Console
1
eth.accounts();
Source code

1
2
3
4
func (s *EthereumAccountAPI) Accounts() [ // Accounts returns the collection of accounts this node manages.
]common.Address {
    return s.am.Accounts()
}
View on GitHub →


eth_blockNumber¶

BlockNumber returns the block number of the chain head.

Params (0)¶

None

Result¶

hexutil.Uint64

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a uint64`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint64`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a uint64",
    "pattern": "^0x([a-fA-F\\d])+$",
    "title": "uint64",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_blockNumber", "params": []}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_blockNumber", "params": []}'
Javascript Console
1
eth.blockNumber();
Source code

1
2
3
4
func (s *BlockChainAPI) BlockNumber() hexutil.Uint64 {
    header, _ := s.b.HeaderByNumber(context.Background(), rpc.LatestBlockNumber)
    return hexutil.Uint64(header.Number.Uint64())
}// BlockNumber returns the block number of the chain head.
View on GitHub →


eth_call¶

Call executes the given transaction on the state for the given block number.

Additionally, the caller can specify a batch of contract for fields overriding.

Note, this function doesn’t make and changes in the state/blockchain and is useful to execute and retrieve values.

Params (4)¶

Parameters must be given by position.

1: args TransactionArgs

  • Required: ✓ Yes
Schema
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
- additionalProperties: `false`
- properties: 
    - accessList: 
        - items: 
            - additionalProperties: `false`
            - properties: 
                - address: 
                    - pattern: `^0x[a-fA-F\d]{64}$`
                    - title: `keccak`
                    - type: `string`

                - storageKeys: 
                    - items: 
                        - description: `Hex representation of a Keccak 256 hash`
                        - pattern: `^0x[a-fA-F\d]{64}$`
                        - title: `keccak`
                        - type: `string`

                    - type: `array`


            - type: `object`

        - type: `array`

    - chainId: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - data: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `dataWord`
        - type: `string`

    - from: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - gas: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - gasPrice: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - input: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `dataWord`
        - type: `string`

    - maxFeePerGas: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - maxPriorityFeePerGas: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - nonce: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - to: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - value: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`


- type: object
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{
    "additionalProperties": false,
    "properties": {
        "accessList": {
            "items": {
                "additionalProperties": false,
                "properties": {
                    "address": {
                        "pattern": "^0x[a-fA-F\\d]{64}$",
                        "title": "keccak",
                        "type": "string"
                    },
                    "storageKeys": {
                        "items": {
                            "description": "Hex representation of a Keccak 256 hash",
                            "pattern": "^0x[a-fA-F\\d]{64}$",
                            "title": "keccak",
                            "type": "string"
                        },
                        "type": "array"
                    }
                },
                "type": "object"
            },
            "type": "array"
        },
        "chainId": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "data": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "dataWord",
            "type": "string"
        },
        "from": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "gas": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "gasPrice": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "input": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "dataWord",
            "type": "string"
        },
        "maxFeePerGas": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "maxPriorityFeePerGas": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "nonce": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "to": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "value": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        }
    },
    "type": [
        "object"
    ]
}

2: blockNrOrHash rpc.BlockNumberOrHash

  • Required: ✓ Yes

3: overrides *StateOverride

  • Required: ✓ Yes
Schema
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
- patternProperties: 
    - .*: 
        - additionalProperties: `false`
        - properties: 
            - balance: 
                - pattern: `^0x[a-fA-F0-9]+$`
                - title: `integer`
                - type: `string`

            - code: 
                - pattern: `^0x([a-fA-F\d])+$`
                - title: `dataWord`
                - type: `string`

            - nonce: 
                - pattern: `^0x([a-fA-F\d])+$`
                - title: `uint64`
                - type: `string`

            - state: 
                - patternProperties: 
                    - .*: 
                        - description: `Hex representation of a Keccak 256 hash`
                        - pattern: `^0x[a-fA-F\d]{64}$`
                        - title: `keccak`
                        - type: `string`


                - type: `object`

            - stateDiff: 
                - patternProperties: 
                    - .*: 
                        - description: `Hex representation of a Keccak 256 hash`
                        - pattern: `^0x[a-fA-F\d]{64}$`
                        - title: `keccak`
                        - type: `string`


                - type: `object`


        - type: `object`


- type: object
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{
    "patternProperties": {
        ".*": {
            "additionalProperties": false,
            "properties": {
                "balance": {
                    "pattern": "^0x[a-fA-F0-9]+$",
                    "title": "integer",
                    "type": "string"
                },
                "code": {
                    "pattern": "^0x([a-fA-F\\d])+$",
                    "title": "dataWord",
                    "type": "string"
                },
                "nonce": {
                    "pattern": "^0x([a-fA-F\\d])+$",
                    "title": "uint64",
                    "type": "string"
                },
                "state": {
                    "patternProperties": {
                        ".*": {
                            "description": "Hex representation of a Keccak 256 hash",
                            "pattern": "^0x[a-fA-F\\d]{64}$",
                            "title": "keccak",
                            "type": "string"
                        }
                    },
                    "type": "object"
                },
                "stateDiff": {
                    "patternProperties": {
                        ".*": {
                            "description": "Hex representation of a Keccak 256 hash",
                            "pattern": "^0x[a-fA-F\\d]{64}$",
                            "title": "keccak",
                            "type": "string"
                        }
                    },
                    "type": "object"
                }
            },
            "type": "object"
        }
    },
    "type": [
        "object"
    ]
}

4: blockOverrides *BlockOverrides

  • Required: ✓ Yes
Schema
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
- additionalProperties: `false`
- properties: 
    - BaseFee: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - Coinbase: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - Difficulty: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - GasLimit: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - Number: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - Random: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - Time: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`


- type: object
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{
    "additionalProperties": false,
    "properties": {
        "BaseFee": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "Coinbase": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "Difficulty": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "GasLimit": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "Number": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "Random": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "Time": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        }
    },
    "type": [
        "object"
    ]
}

Result¶

hexutil.Bytes

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of some bytes`
- pattern: `^0x([a-fA-F\d])+$`
- title: `dataWord`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of some bytes",
    "pattern": "^0x([a-fA-F\\d])+$",
    "title": "dataWord",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_call", "params": [<args>, <blockNrOrHash>, <overrides>, <blockOverrides>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_call", "params": [<args>, <blockNrOrHash>, <overrides>, <blockOverrides>]}'
Javascript Console
1
eth.call(args,blockNrOrHash,overrides,blockOverrides);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
func (s *BlockChainAPI) Call(ctx context.Context, args TransactionArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *StateOverride, blockOverrides *BlockOverrides) (hexutil.Bytes, error) {
    result, err := DoCall(ctx, s.b, args, blockNrOrHash, overrides, blockOverrides, s.b.RPCEVMTimeout(), s.b.RPCGasCap())
    if err != nil {
        return nil, err
    }
    if len(result.Revert()) > 0 {
        return nil, newRevertError(result)
    }
    return result.Return(), result.Err
}// Call executes the given transaction on the state for the given block number.
//
// Additionally, the caller can specify a batch of contract for fields overriding.
//
// Note, this function doesn't make and changes in the state/blockchain and is
// useful to execute and retrieve values.
View on GitHub →


eth_chainId¶

ChainId is the EIP-155 replay-protection chain id for the current Ethereum chain config.

Note, this method does not conform to EIP-695 because the configured chain ID is always returned, regardless of the current head block. We used to return an error when the chain wasn’t synced up to a block where EIP-155 is enabled, but this behavior caused issues in CL clients.

Params (0)¶

None

Result¶

*hexutil.Big

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of the integer`
- pattern: `^0x[a-fA-F0-9]+$`
- title: `integer`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of the integer",
    "pattern": "^0x[a-fA-F0-9]+$",
    "title": "integer",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_chainId", "params": []}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_chainId", "params": []}'
Javascript Console
1
eth.chainId();
Source code

1
2
3
4
5
6
7
8
func (api *BlockChainAPI) ChainId() *hexutil.Big {
    return (*hexutil.Big)(api.b.ChainConfig().GetChainID())
}// ChainId is the EIP-155 replay-protection chain id for the current Ethereum chain config.
//
// Note, this method does not conform to EIP-695 because the configured chain ID is always
// returned, regardless of the current head block. We used to return an error when the chain
// wasn't synced up to a block where EIP-155 is enabled, but this behavior caused issues
// in CL clients.
View on GitHub →


eth_coinbase¶

Coinbase is the address that mining rewards will be sent to (alias for Etherbase).

Params (0)¶

None

Result¶

common.Address

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a Keccak 256 hash POINTER`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a Keccak 256 hash POINTER",
    "pattern": "^0x[a-fA-F\\d]{64}$",
    "title": "keccak",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_coinbase", "params": []}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_coinbase", "params": []}'
Javascript Console
1
eth.coinbase();
Source code

1
2
3
func (api *EthereumAPI) Coinbase() (common.Address, error) {
    return api.Etherbase()
}// Coinbase is the address that mining rewards will be sent to (alias for Etherbase).
View on GitHub →


eth_createAccessList¶

CreateAccessList creates an EIP-2930 type AccessList for the given transaction. Reexec and BlockNrOrHash can be specified to create the accessList on top of a certain state.

Params (2)¶

Parameters must be given by position.

1: args TransactionArgs

  • Required: ✓ Yes
Schema
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
- additionalProperties: `false`
- properties: 
    - accessList: 
        - items: 
            - additionalProperties: `false`
            - properties: 
                - address: 
                    - pattern: `^0x[a-fA-F\d]{64}$`
                    - title: `keccak`
                    - type: `string`

                - storageKeys: 
                    - items: 
                        - description: `Hex representation of a Keccak 256 hash`
                        - pattern: `^0x[a-fA-F\d]{64}$`
                        - title: `keccak`
                        - type: `string`

                    - type: `array`


            - type: `object`

        - type: `array`

    - chainId: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - data: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `dataWord`
        - type: `string`

    - from: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - gas: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - gasPrice: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - input: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `dataWord`
        - type: `string`

    - maxFeePerGas: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - maxPriorityFeePerGas: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - nonce: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - to: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - value: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`


- type: object
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{
    "additionalProperties": false,
    "properties": {
        "accessList": {
            "items": {
                "additionalProperties": false,
                "properties": {
                    "address": {
                        "pattern": "^0x[a-fA-F\\d]{64}$",
                        "title": "keccak",
                        "type": "string"
                    },
                    "storageKeys": {
                        "items": {
                            "description": "Hex representation of a Keccak 256 hash",
                            "pattern": "^0x[a-fA-F\\d]{64}$",
                            "title": "keccak",
                            "type": "string"
                        },
                        "type": "array"
                    }
                },
                "type": "object"
            },
            "type": "array"
        },
        "chainId": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "data": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "dataWord",
            "type": "string"
        },
        "from": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "gas": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "gasPrice": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "input": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "dataWord",
            "type": "string"
        },
        "maxFeePerGas": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "maxPriorityFeePerGas": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "nonce": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "to": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "value": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        }
    },
    "type": [
        "object"
    ]
}

2: blockNrOrHash *rpc.BlockNumberOrHash

  • Required: ✓ Yes

Result¶

*accessListResult

  • Required: ✓ Yes
Schema
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
- additionalProperties: `false`
- properties: 
    - accessList: 
        - items: 
            - additionalProperties: `false`
            - properties: 
                - address: 
                    - pattern: `^0x[a-fA-F\d]{64}$`
                    - title: `keccak`
                    - type: `string`

                - storageKeys: 
                    - items: 
                        - description: `Hex representation of a Keccak 256 hash`
                        - pattern: `^0x[a-fA-F\d]{64}$`
                        - title: `keccak`
                        - type: `string`

                    - type: `array`


            - type: `object`

        - type: `array`

    - error: 
        - type: `string`

    - gasUsed: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`


- type: object
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{
    "additionalProperties": false,
    "properties": {
        "accessList": {
            "items": {
                "additionalProperties": false,
                "properties": {
                    "address": {
                        "pattern": "^0x[a-fA-F\\d]{64}$",
                        "title": "keccak",
                        "type": "string"
                    },
                    "storageKeys": {
                        "items": {
                            "description": "Hex representation of a Keccak 256 hash",
                            "pattern": "^0x[a-fA-F\\d]{64}$",
                            "title": "keccak",
                            "type": "string"
                        },
                        "type": "array"
                    }
                },
                "type": "object"
            },
            "type": "array"
        },
        "error": {
            "type": "string"
        },
        "gasUsed": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        }
    },
    "type": [
        "object"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_createAccessList", "params": [<args>, <blockNrOrHash>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_createAccessList", "params": [<args>, <blockNrOrHash>]}'
Javascript Console
1
eth.createAccessList(args,blockNrOrHash);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
func (s *BlockChainAPI) CreateAccessList(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash) (*accessListResult, error) {
    bNrOrHash := rpc.BlockNumberOrHashWithNumber(rpc.PendingBlockNumber)
    if blockNrOrHash != nil {
        bNrOrHash = *blockNrOrHash
    }
    acl, gasUsed, vmerr, err := AccessList(ctx, s.b, bNrOrHash, args)
    if err != nil {
        return nil, err
    }
    result := &accessListResult{Accesslist: &acl, GasUsed: hexutil.Uint64(gasUsed)}
    if vmerr != nil {
        result.Error = vmerr.Error()
    }
    return result, nil
}// CreateAccessList creates an EIP-2930 type AccessList for the given transaction.
// Reexec and BlockNrOrHash can be specified to create the accessList on top of a certain state.
View on GitHub →


eth_estimateGas¶

EstimateGas returns an estimate of the amount of gas needed to execute the given transaction against the current pending block.

Params (3)¶

Parameters must be given by position.

1: args TransactionArgs

  • Required: ✓ Yes
Schema
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
- additionalProperties: `false`
- properties: 
    - accessList: 
        - items: 
            - additionalProperties: `false`
            - properties: 
                - address: 
                    - pattern: `^0x[a-fA-F\d]{64}$`
                    - title: `keccak`
                    - type: `string`

                - storageKeys: 
                    - items: 
                        - description: `Hex representation of a Keccak 256 hash`
                        - pattern: `^0x[a-fA-F\d]{64}$`
                        - title: `keccak`
                        - type: `string`

                    - type: `array`


            - type: `object`

        - type: `array`

    - chainId: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - data: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `dataWord`
        - type: `string`

    - from: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - gas: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - gasPrice: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - input: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `dataWord`
        - type: `string`

    - maxFeePerGas: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - maxPriorityFeePerGas: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - nonce: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - to: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - value: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`


- type: object
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{
    "additionalProperties": false,
    "properties": {
        "accessList": {
            "items": {
                "additionalProperties": false,
                "properties": {
                    "address": {
                        "pattern": "^0x[a-fA-F\\d]{64}$",
                        "title": "keccak",
                        "type": "string"
                    },
                    "storageKeys": {
                        "items": {
                            "description": "Hex representation of a Keccak 256 hash",
                            "pattern": "^0x[a-fA-F\\d]{64}$",
                            "title": "keccak",
                            "type": "string"
                        },
                        "type": "array"
                    }
                },
                "type": "object"
            },
            "type": "array"
        },
        "chainId": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "data": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "dataWord",
            "type": "string"
        },
        "from": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "gas": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "gasPrice": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "input": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "dataWord",
            "type": "string"
        },
        "maxFeePerGas": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "maxPriorityFeePerGas": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "nonce": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "to": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "value": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        }
    },
    "type": [
        "object"
    ]
}

2: blockNrOrHash *rpc.BlockNumberOrHash

  • Required: ✓ Yes

3: overrides *StateOverride

  • Required: ✓ Yes
Schema
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
- patternProperties: 
    - .*: 
        - additionalProperties: `false`
        - properties: 
            - balance: 
                - pattern: `^0x[a-fA-F0-9]+$`
                - title: `integer`
                - type: `string`

            - code: 
                - pattern: `^0x([a-fA-F\d])+$`
                - title: `dataWord`
                - type: `string`

            - nonce: 
                - pattern: `^0x([a-fA-F\d])+$`
                - title: `uint64`
                - type: `string`

            - state: 
                - patternProperties: 
                    - .*: 
                        - description: `Hex representation of a Keccak 256 hash`
                        - pattern: `^0x[a-fA-F\d]{64}$`
                        - title: `keccak`
                        - type: `string`


                - type: `object`

            - stateDiff: 
                - patternProperties: 
                    - .*: 
                        - description: `Hex representation of a Keccak 256 hash`
                        - pattern: `^0x[a-fA-F\d]{64}$`
                        - title: `keccak`
                        - type: `string`


                - type: `object`


        - type: `object`


- type: object
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{
    "patternProperties": {
        ".*": {
            "additionalProperties": false,
            "properties": {
                "balance": {
                    "pattern": "^0x[a-fA-F0-9]+$",
                    "title": "integer",
                    "type": "string"
                },
                "code": {
                    "pattern": "^0x([a-fA-F\\d])+$",
                    "title": "dataWord",
                    "type": "string"
                },
                "nonce": {
                    "pattern": "^0x([a-fA-F\\d])+$",
                    "title": "uint64",
                    "type": "string"
                },
                "state": {
                    "patternProperties": {
                        ".*": {
                            "description": "Hex representation of a Keccak 256 hash",
                            "pattern": "^0x[a-fA-F\\d]{64}$",
                            "title": "keccak",
                            "type": "string"
                        }
                    },
                    "type": "object"
                },
                "stateDiff": {
                    "patternProperties": {
                        ".*": {
                            "description": "Hex representation of a Keccak 256 hash",
                            "pattern": "^0x[a-fA-F\\d]{64}$",
                            "title": "keccak",
                            "type": "string"
                        }
                    },
                    "type": "object"
                }
            },
            "type": "object"
        }
    },
    "type": [
        "object"
    ]
}

Result¶

hexutil.Uint64

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a uint64`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint64`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a uint64",
    "pattern": "^0x([a-fA-F\\d])+$",
    "title": "uint64",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_estimateGas", "params": [<args>, <blockNrOrHash>, <overrides>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_estimateGas", "params": [<args>, <blockNrOrHash>, <overrides>]}'
Javascript Console
1
eth.estimateGas(args,blockNrOrHash,overrides);
Source code

1
2
3
4
5
6
7
8
func (s *BlockChainAPI) EstimateGas(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash, overrides *StateOverride) (hexutil.Uint64, error) {
    bNrOrHash := rpc.BlockNumberOrHashWithNumber(rpc.LatestBlockNumber)
    if blockNrOrHash != nil {
        bNrOrHash = *blockNrOrHash
    }
    return DoEstimateGas(ctx, s.b, args, bNrOrHash, overrides, s.b.RPCGasCap())
}// EstimateGas returns an estimate of the amount of gas needed to execute the
// given transaction against the current pending block.
View on GitHub →


eth_etherbase¶

Etherbase is the address that mining rewards will be sent to.

Params (0)¶

None

Result¶

common.Address

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a Keccak 256 hash POINTER`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a Keccak 256 hash POINTER",
    "pattern": "^0x[a-fA-F\\d]{64}$",
    "title": "keccak",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_etherbase", "params": []}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_etherbase", "params": []}'
Javascript Console
1
eth.etherbase();
Source code

1
2
3
func (api *EthereumAPI) Etherbase() (common.Address, error) {
    return api.e.Etherbase()
}// Etherbase is the address that mining rewards will be sent to.
View on GitHub →


eth_feeHistory¶

FeeHistory returns the fee market history.

Params (3)¶

Parameters must be given by position.

1: blockCount math.HexOrDecimal64

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of the integer`
- pattern: `^0x[a-fA-F0-9]+$`
- title: `integer`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of the integer",
    "pattern": "^0x[a-fA-F0-9]+$",
    "title": "integer",
    "type": [
        "string"
    ]
}

2: lastBlock rpc.BlockNumber

  • Required: ✓ Yes
Schema
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
- oneOf: 

        - description: `The block height description`
        - enum: earliest, latest, pending
        - title: `blockNumberTag`
        - type: string


        - description: `Hex representation of a uint64`
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: string


- title: `blockNumberIdentifier`
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
    "oneOf": [
        {
            "description": "The block height description",
            "enum": [
                "earliest",
                "latest",
                "pending"
            ],
            "title": "blockNumberTag",
            "type": [
                "string"
            ]
        },
        {
            "description": "Hex representation of a uint64",
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": [
                "string"
            ]
        }
    ],
    "title": "blockNumberIdentifier"
}

3: rewardPercentiles []float64

  • Required: ✓ Yes
Schema
1
2
3
4
5
6
- items: 

        - type: number


- type: array
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
{
    "items": [
        {
            "type": [
                "number"
            ]
        }
    ],
    "type": [
        "array"
    ]
}

Result¶

*feeHistoryResult

  • Required: ✓ Yes
Schema
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
- additionalProperties: `false`
- properties: 
    - baseFeePerGas: 
        - items: 
            - description: `Hex representation of the integer`
            - pattern: `^0x[a-fA-F0-9]+$`
            - title: `integer`
            - type: `string`

        - type: `array`

    - gasUsedRatio: 
        - items: 
            - type: `number`

        - type: `array`

    - oldestBlock: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - reward: 
        - items: 
            - items: 
                - description: `Hex representation of the integer`
                - pattern: `^0x[a-fA-F0-9]+$`
                - title: `integer`
                - type: `string`

            - type: `array`

        - type: `array`


- type: object
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{
    "additionalProperties": false,
    "properties": {
        "baseFeePerGas": {
            "items": {
                "description": "Hex representation of the integer",
                "pattern": "^0x[a-fA-F0-9]+$",
                "title": "integer",
                "type": "string"
            },
            "type": "array"
        },
        "gasUsedRatio": {
            "items": {
                "type": "number"
            },
            "type": "array"
        },
        "oldestBlock": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "reward": {
            "items": {
                "items": {
                    "description": "Hex representation of the integer",
                    "pattern": "^0x[a-fA-F0-9]+$",
                    "title": "integer",
                    "type": "string"
                },
                "type": "array"
            },
            "type": "array"
        }
    },
    "type": [
        "object"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_feeHistory", "params": [<blockCount>, <lastBlock>, <rewardPercentiles>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_feeHistory", "params": [<blockCount>, <lastBlock>, <rewardPercentiles>]}'
Javascript Console
1
eth.feeHistory(blockCount,lastBlock,rewardPercentiles);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
func (s *EthereumAPI) FeeHistory(ctx context.Context, blockCount math.HexOrDecimal64, lastBlock rpc.BlockNumber, rewardPercentiles [ // FeeHistory returns the fee market history.
]float64) (*feeHistoryResult, error) {
    oldest, reward, baseFee, gasUsed, err := s.b.FeeHistory(ctx, uint64(blockCount), lastBlock, rewardPercentiles)
    if err != nil {
        return nil, err
    }
    results := &feeHistoryResult{OldestBlock: (*hexutil.Big)(oldest), GasUsedRatio: gasUsed}
    if reward != nil {
        results.Reward = make([][]*hexutil.Big, len(reward))
        for i, w := range reward {
            results.Reward[i] = make([]*hexutil.Big, len(w))
            for j, v := range w {
                results.Reward[i][j] = (*hexutil.Big)(v)
            }
        }
    }
    if baseFee != nil {
        results.BaseFee = make([]*hexutil.Big, len(baseFee))
        for i, v := range baseFee {
            results.BaseFee[i] = (*hexutil.Big)(v)
        }
    }
    return results, nil
}
View on GitHub →


eth_fillTransaction¶

FillTransaction fills the defaults (nonce, gas, gasPrice or 1559 fields) on a given unsigned transaction, and returns it to the caller for further processing (signing + broadcast).

Params (1)¶

Parameters must be given by position.

1: args TransactionArgs

  • Required: ✓ Yes
Schema
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
- additionalProperties: `false`
- properties: 
    - accessList: 
        - items: 
            - additionalProperties: `false`
            - properties: 
                - address: 
                    - pattern: `^0x[a-fA-F\d]{64}$`
                    - title: `keccak`
                    - type: `string`

                - storageKeys: 
                    - items: 
                        - description: `Hex representation of a Keccak 256 hash`
                        - pattern: `^0x[a-fA-F\d]{64}$`
                        - title: `keccak`
                        - type: `string`

                    - type: `array`


            - type: `object`

        - type: `array`

    - chainId: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - data: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `dataWord`
        - type: `string`

    - from: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - gas: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - gasPrice: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - input: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `dataWord`
        - type: `string`

    - maxFeePerGas: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - maxPriorityFeePerGas: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - nonce: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - to: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - value: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`


- type: object
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{
    "additionalProperties": false,
    "properties": {
        "accessList": {
            "items": {
                "additionalProperties": false,
                "properties": {
                    "address": {
                        "pattern": "^0x[a-fA-F\\d]{64}$",
                        "title": "keccak",
                        "type": "string"
                    },
                    "storageKeys": {
                        "items": {
                            "description": "Hex representation of a Keccak 256 hash",
                            "pattern": "^0x[a-fA-F\\d]{64}$",
                            "title": "keccak",
                            "type": "string"
                        },
                        "type": "array"
                    }
                },
                "type": "object"
            },
            "type": "array"
        },
        "chainId": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "data": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "dataWord",
            "type": "string"
        },
        "from": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "gas": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "gasPrice": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "input": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "dataWord",
            "type": "string"
        },
        "maxFeePerGas": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "maxPriorityFeePerGas": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "nonce": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "to": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "value": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        }
    },
    "type": [
        "object"
    ]
}

Result¶

*SignTransactionResult

  • Required: ✓ Yes
Schema
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
- additionalProperties: `false`
- properties: 
    - raw: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `dataWord`
        - type: `string`

    - tx: 
        - additionalProperties: `false`
        - type: `object`


- type: object
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
{
    "additionalProperties": false,
    "properties": {
        "raw": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "dataWord",
            "type": "string"
        },
        "tx": {
            "additionalProperties": false,
            "type": "object"
        }
    },
    "type": [
        "object"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_fillTransaction", "params": [<args>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_fillTransaction", "params": [<args>]}'
Javascript Console
1
eth.fillTransaction(args);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
func (s *TransactionAPI) FillTransaction(ctx context.Context, args TransactionArgs) (*SignTransactionResult, error) {
    if err := args.setDefaults(ctx, s.b); err != nil {
        return nil, err
    }
    tx := args.toTransaction()
    data, err := tx.MarshalBinary()
    if err != nil {
        return nil, err
    }
    return &SignTransactionResult{data, tx}, nil
}// FillTransaction fills the defaults (nonce, gas, gasPrice or 1559 fields)
// on a given unsigned transaction, and returns it to the caller for further
// processing (signing + broadcast).
View on GitHub →


eth_gasPrice¶

GasPrice returns a suggestion for a gas price for legacy transactions.

Params (0)¶

None

Result¶

*hexutil.Big

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of the integer`
- pattern: `^0x[a-fA-F0-9]+$`
- title: `integer`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of the integer",
    "pattern": "^0x[a-fA-F0-9]+$",
    "title": "integer",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_gasPrice", "params": []}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_gasPrice", "params": []}'
Javascript Console
1
eth.gasPrice();
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
func (s *EthereumAPI) GasPrice(ctx context.Context) (*hexutil.Big, error) {
    tipcap, err := s.b.SuggestGasTipCap(ctx)
    if err != nil {
        return nil, err
    }
    if head := s.b.CurrentHeader(); head.BaseFee != nil {
        tipcap.Add(tipcap, head.BaseFee)
    }
    return (*hexutil.Big)(tipcap), err
}// GasPrice returns a suggestion for a gas price for legacy transactions.
View on GitHub →


eth_getBalance¶

GetBalance returns the amount of wei for the given address in the state of the given block number. The rpc.LatestBlockNumber and rpc.PendingBlockNumber meta block numbers are also allowed.

Params (2)¶

Parameters must be given by position.

1: address common.Address

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a Keccak 256 hash POINTER`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a Keccak 256 hash POINTER",
    "pattern": "^0x[a-fA-F\\d]{64}$",
    "title": "keccak",
    "type": [
        "string"
    ]
}

2: blockNrOrHash rpc.BlockNumberOrHash

  • Required: ✓ Yes

Result¶

*hexutil.Big

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of the integer`
- pattern: `^0x[a-fA-F0-9]+$`
- title: `integer`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of the integer",
    "pattern": "^0x[a-fA-F0-9]+$",
    "title": "integer",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getBalance", "params": [<address>, <blockNrOrHash>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getBalance", "params": [<address>, <blockNrOrHash>]}'
Javascript Console
1
eth.getBalance(address,blockNrOrHash);
Source code

1
2
3
4
5
6
7
8
9
func (s *BlockChainAPI) GetBalance(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Big, error) {
    state, _, err := s.b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash)
    if state == nil || err != nil {
        return nil, err
    }
    return (*hexutil.Big)(state.GetBalance(address)), state.Error()
}// GetBalance returns the amount of wei for the given address in the state of the
// given block number. The rpc.LatestBlockNumber and rpc.PendingBlockNumber meta
// block numbers are also allowed.
View on GitHub →


eth_getBlockByHash¶

GetBlockByHash returns the requested block. When fullTx is true all transactions in the block are returned in full detail, otherwise only the transaction hash is returned.

Params (2)¶

Parameters must be given by position.

1: hash common.Hash

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a Keccak 256 hash",
    "pattern": "^0x[a-fA-F\\d]{64}$",
    "title": "keccak",
    "type": [
        "string"
    ]
}

2: fullTx bool

  • Required: ✓ Yes

Result¶

*RPCMarshalBlockT

  • Required: ✓ Yes
Schema
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
- additionalProperties: `false`
- properties: 
    - baseFeePerGas: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - difficulty: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - error: 
        - type: `string`

    - extraData: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `dataWord`
        - type: `string`

    - gasLimit: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - gasUsed: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - hash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - logsBloom: 
        - items: 
            - description: `Hex representation of the integer`
            - pattern: `^0x[a-fA-F0-9]+$`
            - title: `integer`
            - type: `string`

        - maxItems: `256`
        - minItems: `256`
        - type: `array`

    - miner: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - mixHash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - nonce: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - number: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - parentHash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - receiptsRoot: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - sha3Uncles: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - size: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - stateRoot: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - timestamp: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - totalDifficulty: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - transactions: 
        - items: 
            - additionalProperties: `true`

        - type: `array`

    - transactionsRoot: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - uncles: 
        - items: 
            - description: `Hex representation of a Keccak 256 hash`
            - pattern: `^0x[a-fA-F\d]{64}$`
            - title: `keccak`
            - type: `string`

        - type: `array`

    - withdrawals: 
        - items: 
            - additionalProperties: `false`
            - properties: 
                - address: 
                    - pattern: `^0x[a-fA-F\d]{64}$`
                    - title: `keccak`
                    - type: `string`

                - amount: 
                    - pattern: `^0x[a-fA-F0-9]+$`
                    - title: `integer`
                    - type: `string`

                - index: 
                    - pattern: `^0x[a-fA-F0-9]+$`
                    - title: `integer`
                    - type: `string`

                - validatorIndex: 
                    - pattern: `^0x[a-fA-F0-9]+$`
                    - title: `integer`
                    - type: `string`


            - type: `object`

        - type: `array`

    - withdrawalsRoot: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`


- type: object
Raw
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
{
    "additionalProperties": false,
    "properties": {
        "baseFeePerGas": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "difficulty": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "error": {
            "type": "string"
        },
        "extraData": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "dataWord",
            "type": "string"
        },
        "gasLimit": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "gasUsed": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "hash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "logsBloom": {
            "items": {
                "description": "Hex representation of the integer",
                "pattern": "^0x[a-fA-F0-9]+$",
                "title": "integer",
                "type": "string"
            },
            "maxItems": 256,
            "minItems": 256,
            "type": "array"
        },
        "miner": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "mixHash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "nonce": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "number": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "parentHash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "receiptsRoot": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "sha3Uncles": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "size": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "stateRoot": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "timestamp": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "totalDifficulty": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "transactions": {
            "items": {
                "additionalProperties": true
            },
            "type": "array"
        },
        "transactionsRoot": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "uncles": {
            "items": {
                "description": "Hex representation of a Keccak 256 hash",
                "pattern": "^0x[a-fA-F\\d]{64}$",
                "title": "keccak",
                "type": "string"
            },
            "type": "array"
        },
        "withdrawals": {
            "items": {
                "additionalProperties": false,
                "properties": {
                    "address": {
                        "pattern": "^0x[a-fA-F\\d]{64}$",
                        "title": "keccak",
                        "type": "string"
                    },
                    "amount": {
                        "pattern": "^0x[a-fA-F0-9]+$",
                        "title": "integer",
                        "type": "string"
                    },
                    "index": {
                        "pattern": "^0x[a-fA-F0-9]+$",
                        "title": "integer",
                        "type": "string"
                    },
                    "validatorIndex": {
                        "pattern": "^0x[a-fA-F0-9]+$",
                        "title": "integer",
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "type": "array"
        },
        "withdrawalsRoot": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        }
    },
    "type": [
        "object"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getBlockByHash", "params": [<hash>, <fullTx>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getBlockByHash", "params": [<hash>, <fullTx>]}'
Javascript Console
1
eth.getBlockByHash(hash,fullTx);
Source code

1
2
3
4
5
6
7
8
func (s *BlockChainAPI) GetBlockByHash(ctx context.Context, hash common.Hash, fullTx bool) (*RPCMarshalBlockT, error) {
    block, err := s.b.BlockByHash(ctx, hash)
    if block != nil {
        return s.rpcMarshalBlock(ctx, block, true, fullTx)
    }
    return nil, err
}// GetBlockByHash returns the requested block. When fullTx is true all transactions in the block are returned in full
// detail, otherwise only the transaction hash is returned.
View on GitHub →


eth_getBlockByNumber¶

GetBlockByNumber returns the requested canonical block. - When blockNr is -1 the chain pending block is returned. - When blockNr is -2 the chain latest block is returned. - When blockNr is -3 the chain finalized block is returned. - When blockNr is -4 the chain safe block is returned. - When fullTx is true all transactions in the block are returned, otherwise only the transaction hash is returned.

Params (2)¶

Parameters must be given by position.

1: number rpc.BlockNumber

  • Required: ✓ Yes
Schema
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
- oneOf: 

        - description: `The block height description`
        - enum: earliest, latest, pending
        - title: `blockNumberTag`
        - type: string


        - description: `Hex representation of a uint64`
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: string


- title: `blockNumberIdentifier`
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
    "oneOf": [
        {
            "description": "The block height description",
            "enum": [
                "earliest",
                "latest",
                "pending"
            ],
            "title": "blockNumberTag",
            "type": [
                "string"
            ]
        },
        {
            "description": "Hex representation of a uint64",
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": [
                "string"
            ]
        }
    ],
    "title": "blockNumberIdentifier"
}

2: fullTx bool

  • Required: ✓ Yes

Result¶

*RPCMarshalBlockT

  • Required: ✓ Yes
Schema
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
- additionalProperties: `false`
- properties: 
    - baseFeePerGas: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - difficulty: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - error: 
        - type: `string`

    - extraData: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `dataWord`
        - type: `string`

    - gasLimit: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - gasUsed: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - hash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - logsBloom: 
        - items: 
            - description: `Hex representation of the integer`
            - pattern: `^0x[a-fA-F0-9]+$`
            - title: `integer`
            - type: `string`

        - maxItems: `256`
        - minItems: `256`
        - type: `array`

    - miner: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - mixHash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - nonce: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - number: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - parentHash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - receiptsRoot: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - sha3Uncles: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - size: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - stateRoot: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - timestamp: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - totalDifficulty: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - transactions: 
        - items: 
            - additionalProperties: `true`

        - type: `array`

    - transactionsRoot: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - uncles: 
        - items: 
            - description: `Hex representation of a Keccak 256 hash`
            - pattern: `^0x[a-fA-F\d]{64}$`
            - title: `keccak`
            - type: `string`

        - type: `array`

    - withdrawals: 
        - items: 
            - additionalProperties: `false`
            - properties: 
                - address: 
                    - pattern: `^0x[a-fA-F\d]{64}$`
                    - title: `keccak`
                    - type: `string`

                - amount: 
                    - pattern: `^0x[a-fA-F0-9]+$`
                    - title: `integer`
                    - type: `string`

                - index: 
                    - pattern: `^0x[a-fA-F0-9]+$`
                    - title: `integer`
                    - type: `string`

                - validatorIndex: 
                    - pattern: `^0x[a-fA-F0-9]+$`
                    - title: `integer`
                    - type: `string`


            - type: `object`

        - type: `array`

    - withdrawalsRoot: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`


- type: object
Raw
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
{
    "additionalProperties": false,
    "properties": {
        "baseFeePerGas": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "difficulty": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "error": {
            "type": "string"
        },
        "extraData": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "dataWord",
            "type": "string"
        },
        "gasLimit": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "gasUsed": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "hash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "logsBloom": {
            "items": {
                "description": "Hex representation of the integer",
                "pattern": "^0x[a-fA-F0-9]+$",
                "title": "integer",
                "type": "string"
            },
            "maxItems": 256,
            "minItems": 256,
            "type": "array"
        },
        "miner": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "mixHash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "nonce": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "number": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "parentHash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "receiptsRoot": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "sha3Uncles": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "size": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "stateRoot": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "timestamp": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "totalDifficulty": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "transactions": {
            "items": {
                "additionalProperties": true
            },
            "type": "array"
        },
        "transactionsRoot": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "uncles": {
            "items": {
                "description": "Hex representation of a Keccak 256 hash",
                "pattern": "^0x[a-fA-F\\d]{64}$",
                "title": "keccak",
                "type": "string"
            },
            "type": "array"
        },
        "withdrawals": {
            "items": {
                "additionalProperties": false,
                "properties": {
                    "address": {
                        "pattern": "^0x[a-fA-F\\d]{64}$",
                        "title": "keccak",
                        "type": "string"
                    },
                    "amount": {
                        "pattern": "^0x[a-fA-F0-9]+$",
                        "title": "integer",
                        "type": "string"
                    },
                    "index": {
                        "pattern": "^0x[a-fA-F0-9]+$",
                        "title": "integer",
                        "type": "string"
                    },
                    "validatorIndex": {
                        "pattern": "^0x[a-fA-F0-9]+$",
                        "title": "integer",
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "type": "array"
        },
        "withdrawalsRoot": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        }
    },
    "type": [
        "object"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getBlockByNumber", "params": [<number>, <fullTx>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getBlockByNumber", "params": [<number>, <fullTx>]}'
Javascript Console
1
eth.getBlockByNumber(number,fullTx);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
func (s *BlockChainAPI) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (*RPCMarshalBlockT, error) {
    block, err := s.b.BlockByNumber(ctx, number)
    if block != nil && err == nil {
        response, err := s.rpcMarshalBlock(ctx, block, true, fullTx)
        if err == nil && number == rpc.PendingBlockNumber {
            response.setAsPending()
        }
        return response, err
    }
    return nil, err
}// GetBlockByNumber returns the requested canonical block.
//   - When blockNr is -1 the chain pending block is returned.
//   - When blockNr is -2 the chain latest block is returned.
//   - When blockNr is -3 the chain finalized block is returned.
//   - When blockNr is -4 the chain safe block is returned.
//   - When fullTx is true all transactions in the block are returned, otherwise
//     only the transaction hash is returned.
View on GitHub →


eth_getBlockTransactionCountByHash¶

GetBlockTransactionCountByHash returns the number of transactions in the block with the given hash.

Params (1)¶

Parameters must be given by position.

1: blockHash common.Hash

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a Keccak 256 hash",
    "pattern": "^0x[a-fA-F\\d]{64}$",
    "title": "keccak",
    "type": [
        "string"
    ]
}

Result¶

*hexutil.Uint

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a uint`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a uint",
    "pattern": "^0x([a-fA-F\\d])+$",
    "title": "uint",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getBlockTransactionCountByHash", "params": [<blockHash>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getBlockTransactionCountByHash", "params": [<blockHash>]}'
Javascript Console
1
eth.getBlockTransactionCountByHash(blockHash);
Source code

1
2
3
4
5
6
7
func (s *TransactionAPI) GetBlockTransactionCountByHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint {
    if block, _ := s.b.BlockByHash(ctx, blockHash); block != nil {
        n := hexutil.Uint(len(block.Transactions()))
        return &n
    }
    return nil
}// GetBlockTransactionCountByHash returns the number of transactions in the block with the given hash.
View on GitHub →


eth_getBlockTransactionCountByNumber¶

GetBlockTransactionCountByNumber returns the number of transactions in the block with the given block number.

Params (1)¶

Parameters must be given by position.

1: blockNr rpc.BlockNumber

  • Required: ✓ Yes
Schema
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
- oneOf: 

        - description: `The block height description`
        - enum: earliest, latest, pending
        - title: `blockNumberTag`
        - type: string


        - description: `Hex representation of a uint64`
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: string


- title: `blockNumberIdentifier`
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
    "oneOf": [
        {
            "description": "The block height description",
            "enum": [
                "earliest",
                "latest",
                "pending"
            ],
            "title": "blockNumberTag",
            "type": [
                "string"
            ]
        },
        {
            "description": "Hex representation of a uint64",
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": [
                "string"
            ]
        }
    ],
    "title": "blockNumberIdentifier"
}

Result¶

*hexutil.Uint

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a uint`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a uint",
    "pattern": "^0x([a-fA-F\\d])+$",
    "title": "uint",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getBlockTransactionCountByNumber", "params": [<blockNr>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getBlockTransactionCountByNumber", "params": [<blockNr>]}'
Javascript Console
1
eth.getBlockTransactionCountByNumber(blockNr);
Source code

1
2
3
4
5
6
7
func (s *TransactionAPI) GetBlockTransactionCountByNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint {
    if block, _ := s.b.BlockByNumber(ctx, blockNr); block != nil {
        n := hexutil.Uint(len(block.Transactions()))
        return &n
    }
    return nil
}// GetBlockTransactionCountByNumber returns the number of transactions in the block with the given block number.
View on GitHub →


eth_getCode¶

GetCode returns the code stored at the given address in the state for the given block number.

Params (2)¶

Parameters must be given by position.

1: address common.Address

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a Keccak 256 hash POINTER`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a Keccak 256 hash POINTER",
    "pattern": "^0x[a-fA-F\\d]{64}$",
    "title": "keccak",
    "type": [
        "string"
    ]
}

2: blockNrOrHash rpc.BlockNumberOrHash

  • Required: ✓ Yes

Result¶

hexutil.Bytes

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of some bytes`
- pattern: `^0x([a-fA-F\d])+$`
- title: `dataWord`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of some bytes",
    "pattern": "^0x([a-fA-F\\d])+$",
    "title": "dataWord",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getCode", "params": [<address>, <blockNrOrHash>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getCode", "params": [<address>, <blockNrOrHash>]}'
Javascript Console
1
eth.getCode(address,blockNrOrHash);
Source code

1
2
3
4
5
6
7
8
func (s *BlockChainAPI) GetCode(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error) {
    state, _, err := s.b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash)
    if state == nil || err != nil {
        return nil, err
    }
    code := state.GetCode(address)
    return code, state.Error()
}// GetCode returns the code stored at the given address in the state for the given block number.
View on GitHub →


eth_getFilterChanges¶

GetFilterChanges returns the logs for the filter with the given id since last time it was called. This can be used for polling.

For pending transaction and block filters the result is []common.Hash. (pending)Log filters return []Log.

Params (1)¶

Parameters must be given by position.

1: id rpc.ID

  • Required: ✓ Yes
Schema
1
2
3
- description: `Subscription identifier`
- title: `subscriptionID`
- type: string
Raw
1
2
3
4
5
6
7
{
    "description": "Subscription identifier",
    "title": "subscriptionID",
    "type": [
        "string"
    ]
}

Result¶

interface interface{}

  • Required: ✓ Yes

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getFilterChanges", "params": [<id>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getFilterChanges", "params": [<id>]}'
Javascript Console
1
eth.getFilterChanges(id);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
func (api *FilterAPI) GetFilterChanges(id rpc.ID) (interface{}, error) {
    api.filtersMu.Lock()
    defer api.filtersMu.Unlock()
    chainConfig := api.sys.backend.ChainConfig()
    latest := api.sys.backend.CurrentHeader()
    if f, found := api.filters[id]; found {
        if !f.deadline.Stop() {
            <-f.deadline.C
        }
        f.deadline.Reset(api.timeout)
        switch f.typ {
        case BlocksSubscription, SideBlocksSubscription:
            hashes := f.hashes
            f.hashes = nil
            return returnHashes(hashes), nil
        case PendingTransactionsSubscription:
            if f.fullTx {
                txs := make([ // GetFilterChanges returns the logs for the filter with the given id since
                // last time it was called. This can be used for polling.
                //
                // For pending transaction and block filters the result is []common.Hash.
                // (pending)Log filters return []Log.
                ]*ethapi.RPCTransaction, 0, len(f.txs))
                for _, tx := range f.txs {
                    txs = append(txs, ethapi.NewRPCPendingTransaction(tx, latest, chainConfig))
                }
                f.txs = nil
                return txs, nil
            } else {
                hashes := make([]common.Hash, 0, len(f.txs))
                for _, tx := range f.txs {
                    hashes = append(hashes, tx.Hash())
                }
                f.txs = nil
                return hashes, nil
            }
        case LogsSubscription, MinedAndPendingLogsSubscription:
            logs := f.logs
            f.logs = nil
            return returnLogs(logs), nil
        }
    }
    return []interface{}{}, errFilterNotFound
}
View on GitHub →


eth_getFilterLogs¶

GetFilterLogs returns the logs for the filter with the given id. If the filter could not be found an empty array of logs is returned.

Params (1)¶

Parameters must be given by position.

1: id rpc.ID

  • Required: ✓ Yes
Schema
1
2
3
- description: `Subscription identifier`
- title: `subscriptionID`
- type: string
Raw
1
2
3
4
5
6
7
{
    "description": "Subscription identifier",
    "title": "subscriptionID",
    "type": [
        "string"
    ]
}

Result¶

typesLog []*types.Log

  • Required: ✓ Yes
Schema
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
- items: 

        - additionalProperties: `false`
        - properties: 
            - address: 
                - pattern: `^0x[a-fA-F\d]{64}$`
                - title: `keccak`
                - type: `string`

            - blockHash: 
                - pattern: `^0x[a-fA-F\d]{64}$`
                - title: `keccak`
                - type: `string`

            - blockNumber: 
                - pattern: `^0x[a-fA-F0-9]+$`
                - title: `integer`
                - type: `string`

            - data: 
                - pattern: `^0x([a-fA-F0-9]?)+$`
                - title: `bytes`
                - type: `string`

            - logIndex: 
                - pattern: `^0x[a-fA-F0-9]+$`
                - title: `integer`
                - type: `string`

            - removed: 
                - type: `boolean`

            - topics: 
                - items: 
                    - description: `Hex representation of a Keccak 256 hash`
                    - pattern: `^0x[a-fA-F\d]{64}$`
                    - title: `keccak`
                    - type: `string`

                - type: `array`

            - transactionHash: 
                - pattern: `^0x[a-fA-F\d]{64}$`
                - title: `keccak`
                - type: `string`

            - transactionIndex: 
                - pattern: `^0x[a-fA-F0-9]+$`
                - title: `integer`
                - type: `string`


        - type: object


- type: array
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
{
    "items": [
        {
            "additionalProperties": false,
            "properties": {
                "address": {
                    "pattern": "^0x[a-fA-F\\d]{64}$",
                    "title": "keccak",
                    "type": "string"
                },
                "blockHash": {
                    "pattern": "^0x[a-fA-F\\d]{64}$",
                    "title": "keccak",
                    "type": "string"
                },
                "blockNumber": {
                    "pattern": "^0x[a-fA-F0-9]+$",
                    "title": "integer",
                    "type": "string"
                },
                "data": {
                    "pattern": "^0x([a-fA-F0-9]?)+$",
                    "title": "bytes",
                    "type": "string"
                },
                "logIndex": {
                    "pattern": "^0x[a-fA-F0-9]+$",
                    "title": "integer",
                    "type": "string"
                },
                "removed": {
                    "type": "boolean"
                },
                "topics": {
                    "items": {
                        "description": "Hex representation of a Keccak 256 hash",
                        "pattern": "^0x[a-fA-F\\d]{64}$",
                        "title": "keccak",
                        "type": "string"
                    },
                    "type": "array"
                },
                "transactionHash": {
                    "pattern": "^0x[a-fA-F\\d]{64}$",
                    "title": "keccak",
                    "type": "string"
                },
                "transactionIndex": {
                    "pattern": "^0x[a-fA-F0-9]+$",
                    "title": "integer",
                    "type": "string"
                }
            },
            "type": [
                "object"
            ]
        }
    ],
    "type": [
        "array"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getFilterLogs", "params": [<id>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getFilterLogs", "params": [<id>]}'
Javascript Console
1
eth.getFilterLogs(id);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
func (api *FilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) ([ // GetFilterLogs returns the logs for the filter with the given id.
// If the filter could not be found an empty array of logs is returned.
]*types.Log, error) {
    api.filtersMu.Lock()
    f, found := api.filters[id]
    api.filtersMu.Unlock()
    if !found || f.typ != LogsSubscription {
        return nil, errFilterNotFound
    }
    var filter *Filter
    if f.crit.BlockHash != nil {
        filter = api.sys.NewBlockFilter(*f.crit.BlockHash, f.crit.Addresses, f.crit.Topics)
    } else {
        begin := rpc.LatestBlockNumber.Int64()
        if f.crit.FromBlock != nil {
            begin = f.crit.FromBlock.Int64()
        }
        end := rpc.LatestBlockNumber.Int64()
        if f.crit.ToBlock != nil {
            end = f.crit.ToBlock.Int64()
        }
        filter = api.sys.NewRangeFilter(begin, end, f.crit.Addresses, f.crit.Topics)
    }
    logs, err := filter.Logs(ctx)
    if err != nil {
        return nil, err
    }
    return returnLogs(logs), nil
}
View on GitHub →


eth_getHashrate¶

GetHashrate returns the current hashrate for local CPU miner and remote miner.

Params (0)¶

None

Result¶

uint64

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of the integer`
- pattern: `^0x[a-fA-F0-9]+$`
- title: `integer`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of the integer",
    "pattern": "^0x[a-fA-F0-9]+$",
    "title": "integer",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getHashrate", "params": []}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getHashrate", "params": []}'
Javascript Console
1
eth.getHashrate();
Source code

1
2
3
func (api *API) GetHashrate() uint64 {
    return uint64(api.ethash.Hashrate())
}// GetHashrate returns the current hashrate for local CPU miner and remote miner.
View on GitHub →


eth_getHeaderByHash¶

GetHeaderByHash returns the requested header by hash.

Params (1)¶

Parameters must be given by position.

1: hash common.Hash

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a Keccak 256 hash",
    "pattern": "^0x[a-fA-F\\d]{64}$",
    "title": "keccak",
    "type": [
        "string"
    ]
}

Result¶

*RPCMarshalHeaderT

  • Required: ✓ Yes
Schema
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
- additionalProperties: `false`
- properties: 
    - baseFeePerGas: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - difficulty: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - extraData: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `dataWord`
        - type: `string`

    - gasLimit: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - gasUsed: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - hash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - logsBloom: 
        - items: 
            - description: `Hex representation of the integer`
            - pattern: `^0x[a-fA-F0-9]+$`
            - title: `integer`
            - type: `string`

        - maxItems: `256`
        - minItems: `256`
        - type: `array`

    - miner: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - mixHash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - nonce: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - number: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - parentHash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - receiptsRoot: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - sha3Uncles: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - stateRoot: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - timestamp: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - totalDifficulty: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - transactionsRoot: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - withdrawalsRoot: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`


- type: object
Raw
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
{
    "additionalProperties": false,
    "properties": {
        "baseFeePerGas": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "difficulty": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "extraData": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "dataWord",
            "type": "string"
        },
        "gasLimit": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "gasUsed": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "hash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "logsBloom": {
            "items": {
                "description": "Hex representation of the integer",
                "pattern": "^0x[a-fA-F0-9]+$",
                "title": "integer",
                "type": "string"
            },
            "maxItems": 256,
            "minItems": 256,
            "type": "array"
        },
        "miner": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "mixHash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "nonce": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "number": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "parentHash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "receiptsRoot": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "sha3Uncles": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "stateRoot": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "timestamp": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "totalDifficulty": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "transactionsRoot": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "withdrawalsRoot": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        }
    },
    "type": [
        "object"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getHeaderByHash", "params": [<hash>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getHeaderByHash", "params": [<hash>]}'
Javascript Console
1
eth.getHeaderByHash(hash);
Source code

1
2
3
4
5
6
7
func (s *BlockChainAPI) GetHeaderByHash(ctx context.Context, hash common.Hash) *RPCMarshalHeaderT {
    header, _ := s.b.HeaderByHash(ctx, hash)
    if header != nil {
        return s.rpcMarshalHeader(ctx, header)
    }
    return nil
}// GetHeaderByHash returns the requested header by hash.
View on GitHub →


eth_getHeaderByNumber¶

GetHeaderByNumber returns the requested canonical block header. - When blockNr is -1 the chain pending header is returned. - When blockNr is -2 the chain latest header is returned. - When blockNr is -3 the chain finalized header is returned. - When blockNr is -4 the chain safe header is returned.

Params (1)¶

Parameters must be given by position.

1: number rpc.BlockNumber

  • Required: ✓ Yes
Schema
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
- oneOf: 

        - description: `The block height description`
        - enum: earliest, latest, pending
        - title: `blockNumberTag`
        - type: string


        - description: `Hex representation of a uint64`
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: string


- title: `blockNumberIdentifier`
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
    "oneOf": [
        {
            "description": "The block height description",
            "enum": [
                "earliest",
                "latest",
                "pending"
            ],
            "title": "blockNumberTag",
            "type": [
                "string"
            ]
        },
        {
            "description": "Hex representation of a uint64",
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": [
                "string"
            ]
        }
    ],
    "title": "blockNumberIdentifier"
}

Result¶

*RPCMarshalHeaderT

  • Required: ✓ Yes
Schema
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
- additionalProperties: `false`
- properties: 
    - baseFeePerGas: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - difficulty: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - extraData: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `dataWord`
        - type: `string`

    - gasLimit: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - gasUsed: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - hash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - logsBloom: 
        - items: 
            - description: `Hex representation of the integer`
            - pattern: `^0x[a-fA-F0-9]+$`
            - title: `integer`
            - type: `string`

        - maxItems: `256`
        - minItems: `256`
        - type: `array`

    - miner: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - mixHash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - nonce: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - number: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - parentHash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - receiptsRoot: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - sha3Uncles: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - stateRoot: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - timestamp: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - totalDifficulty: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - transactionsRoot: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - withdrawalsRoot: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`


- type: object
Raw
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
{
    "additionalProperties": false,
    "properties": {
        "baseFeePerGas": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "difficulty": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "extraData": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "dataWord",
            "type": "string"
        },
        "gasLimit": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "gasUsed": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "hash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "logsBloom": {
            "items": {
                "description": "Hex representation of the integer",
                "pattern": "^0x[a-fA-F0-9]+$",
                "title": "integer",
                "type": "string"
            },
            "maxItems": 256,
            "minItems": 256,
            "type": "array"
        },
        "miner": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "mixHash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "nonce": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "number": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "parentHash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "receiptsRoot": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "sha3Uncles": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "stateRoot": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "timestamp": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "totalDifficulty": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "transactionsRoot": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "withdrawalsRoot": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        }
    },
    "type": [
        "object"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getHeaderByNumber", "params": [<number>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getHeaderByNumber", "params": [<number>]}'
Javascript Console
1
eth.getHeaderByNumber(number);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
func (s *BlockChainAPI) GetHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*RPCMarshalHeaderT, error) {
    header, err := s.b.HeaderByNumber(ctx, number)
    if header != nil && err == nil {
        response := s.rpcMarshalHeader(ctx, header)
        if number == rpc.PendingBlockNumber {
            response.setAsPending()
        }
        return response, err
    }
    return nil, err
}// GetHeaderByNumber returns the requested canonical block header.
//   - When blockNr is -1 the chain pending header is returned.
//   - When blockNr is -2 the chain latest header is returned.
//   - When blockNr is -3 the chain finalized header is returned.
//   - When blockNr is -4 the chain safe header is returned.
View on GitHub →


eth_getLogs¶

GetLogs returns logs matching the given argument that are stored within the state.

Params (1)¶

Parameters must be given by position.

1: crit FilterCriteria

  • Required: ✓ Yes
Schema
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
- additionalProperties: `false`
- properties: 
    - Addresses: 
        - items: 
            - description: `Hex representation of a Keccak 256 hash POINTER`
            - pattern: `^0x[a-fA-F\d]{64}$`
            - title: `keccak`
            - type: `string`

        - type: `array`

    - BlockHash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - FromBlock: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - ToBlock: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - Topics: 
        - items: 
            - items: 
                - description: `Hex representation of a Keccak 256 hash`
                - pattern: `^0x[a-fA-F\d]{64}$`
                - title: `keccak`
                - type: `string`

            - type: `array`

        - type: `array`


- type: object
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{
    "additionalProperties": false,
    "properties": {
        "Addresses": {
            "items": {
                "description": "Hex representation of a Keccak 256 hash POINTER",
                "pattern": "^0x[a-fA-F\\d]{64}$",
                "title": "keccak",
                "type": "string"
            },
            "type": "array"
        },
        "BlockHash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "FromBlock": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "ToBlock": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "Topics": {
            "items": {
                "items": {
                    "description": "Hex representation of a Keccak 256 hash",
                    "pattern": "^0x[a-fA-F\\d]{64}$",
                    "title": "keccak",
                    "type": "string"
                },
                "type": "array"
            },
            "type": "array"
        }
    },
    "type": [
        "object"
    ]
}

Result¶

typesLog []*types.Log

  • Required: ✓ Yes
Schema
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
- items: 

        - additionalProperties: `false`
        - properties: 
            - address: 
                - pattern: `^0x[a-fA-F\d]{64}$`
                - title: `keccak`
                - type: `string`

            - blockHash: 
                - pattern: `^0x[a-fA-F\d]{64}$`
                - title: `keccak`
                - type: `string`

            - blockNumber: 
                - pattern: `^0x[a-fA-F0-9]+$`
                - title: `integer`
                - type: `string`

            - data: 
                - pattern: `^0x([a-fA-F0-9]?)+$`
                - title: `bytes`
                - type: `string`

            - logIndex: 
                - pattern: `^0x[a-fA-F0-9]+$`
                - title: `integer`
                - type: `string`

            - removed: 
                - type: `boolean`

            - topics: 
                - items: 
                    - description: `Hex representation of a Keccak 256 hash`
                    - pattern: `^0x[a-fA-F\d]{64}$`
                    - title: `keccak`
                    - type: `string`

                - type: `array`

            - transactionHash: 
                - pattern: `^0x[a-fA-F\d]{64}$`
                - title: `keccak`
                - type: `string`

            - transactionIndex: 
                - pattern: `^0x[a-fA-F0-9]+$`
                - title: `integer`
                - type: `string`


        - type: object


- type: array
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
{
    "items": [
        {
            "additionalProperties": false,
            "properties": {
                "address": {
                    "pattern": "^0x[a-fA-F\\d]{64}$",
                    "title": "keccak",
                    "type": "string"
                },
                "blockHash": {
                    "pattern": "^0x[a-fA-F\\d]{64}$",
                    "title": "keccak",
                    "type": "string"
                },
                "blockNumber": {
                    "pattern": "^0x[a-fA-F0-9]+$",
                    "title": "integer",
                    "type": "string"
                },
                "data": {
                    "pattern": "^0x([a-fA-F0-9]?)+$",
                    "title": "bytes",
                    "type": "string"
                },
                "logIndex": {
                    "pattern": "^0x[a-fA-F0-9]+$",
                    "title": "integer",
                    "type": "string"
                },
                "removed": {
                    "type": "boolean"
                },
                "topics": {
                    "items": {
                        "description": "Hex representation of a Keccak 256 hash",
                        "pattern": "^0x[a-fA-F\\d]{64}$",
                        "title": "keccak",
                        "type": "string"
                    },
                    "type": "array"
                },
                "transactionHash": {
                    "pattern": "^0x[a-fA-F\\d]{64}$",
                    "title": "keccak",
                    "type": "string"
                },
                "transactionIndex": {
                    "pattern": "^0x[a-fA-F0-9]+$",
                    "title": "integer",
                    "type": "string"
                }
            },
            "type": [
                "object"
            ]
        }
    ],
    "type": [
        "array"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getLogs", "params": [<crit>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getLogs", "params": [<crit>]}'
Javascript Console
1
eth.getLogs(crit);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
func (api *FilterAPI) GetLogs(ctx context.Context, crit FilterCriteria) ([ // GetLogs returns logs matching the given argument that are stored within the state.
]*types.Log, error) {
    var filter *Filter
    if crit.BlockHash != nil {
        filter = api.sys.NewBlockFilter(*crit.BlockHash, crit.Addresses, crit.Topics)
    } else {
        begin := rpc.LatestBlockNumber.Int64()
        if crit.FromBlock != nil {
            begin = crit.FromBlock.Int64()
        }
        end := rpc.LatestBlockNumber.Int64()
        if crit.ToBlock != nil {
            end = crit.ToBlock.Int64()
        }
        filter = api.sys.NewRangeFilter(begin, end, crit.Addresses, crit.Topics)
    }
    logs, err := filter.Logs(ctx)
    if err != nil {
        return nil, err
    }
    return returnLogs(logs), err
}
View on GitHub →


eth_getProof¶

GetProof returns the Merkle-proof for a given account and optionally some storage keys.

Params (3)¶

Parameters must be given by position.

1: address common.Address

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a Keccak 256 hash POINTER`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a Keccak 256 hash POINTER",
    "pattern": "^0x[a-fA-F\\d]{64}$",
    "title": "keccak",
    "type": [
        "string"
    ]
}

2: storageKeys []string

  • Required: ✓ Yes
Schema
1
2
3
4
5
6
- items: 

        - type: string


- type: array
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
{
    "items": [
        {
            "type": [
                "string"
            ]
        }
    ],
    "type": [
        "array"
    ]
}

3: blockNrOrHash rpc.BlockNumberOrHash

  • Required: ✓ Yes

Result¶

*AccountResult

  • Required: ✓ Yes
Schema
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
- additionalProperties: `false`
- properties: 
    - accountProof: 
        - items: 
            - type: `string`

        - type: `array`

    - address: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - balance: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - codeHash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - nonce: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - storageHash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - storageProof: 
        - items: 
            - additionalProperties: `false`
            - properties: 
                - key: 
                    - type: `string`

                - proof: 
                    - items: 
                        - type: `string`

                    - type: `array`

                - value: 
                    - pattern: `^0x[a-fA-F0-9]+$`
                    - title: `integer`
                    - type: `string`


            - type: `object`

        - type: `array`


- type: object
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
{
    "additionalProperties": false,
    "properties": {
        "accountProof": {
            "items": {
                "type": "string"
            },
            "type": "array"
        },
        "address": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "balance": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "codeHash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "nonce": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "storageHash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "storageProof": {
            "items": {
                "additionalProperties": false,
                "properties": {
                    "key": {
                        "type": "string"
                    },
                    "proof": {
                        "items": {
                            "type": "string"
                        },
                        "type": "array"
                    },
                    "value": {
                        "pattern": "^0x[a-fA-F0-9]+$",
                        "title": "integer",
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "type": "array"
        }
    },
    "type": [
        "object"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getProof", "params": [<address>, <storageKeys>, <blockNrOrHash>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getProof", "params": [<address>, <storageKeys>, <blockNrOrHash>]}'
Javascript Console
1
eth.getProof(address,storageKeys,blockNrOrHash);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
func (s *BlockChainAPI) GetProof(ctx context.Context, address common.Address, storageKeys [ // GetProof returns the Merkle-proof for a given account and optionally some storage keys.
]string, blockNrOrHash rpc.BlockNumberOrHash) (*AccountResult, error) {
    var (
        keys        = make([]common.Hash, len(storageKeys))
        keyLengths  = make([]int, len(storageKeys))
        storageProof    = make([]StorageResult, len(storageKeys))
        storageTrie state.Trie
        storageHash = types.EmptyRootHash
        codeHash    = types.EmptyCodeHash
    )
    for i, hexKey := range storageKeys {
        var err error
        keys[i], keyLengths[i], err = decodeHash(hexKey)
        if err != nil {
            return nil, err
        }
    }
    state, _, err := s.b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash)
    if state == nil || err != nil {
        return nil, err
    }
    if storageTrie, err = state.StorageTrie(address); err != nil {
        return nil, err
    }
    if storageTrie != nil {
        storageHash = storageTrie.Hash()
        codeHash = state.GetCodeHash(address)
    }
    for i, key := range keys {
        var outputKey string
        if keyLengths[i] != 32 {
            outputKey = hexutil.EncodeBig(key.Big())
        } else {
            outputKey = hexutil.Encode(key[ // Output key encoding is a bit special: if the input was a 32-byte hash, it is
            // returned as such. Otherwise, we apply the QUANTITY encoding mandated by the
            // JSON-RPC spec for getProof. This behavior exists to preserve backwards
            // compatibility with older client versions.
            :])
        }
        if storageTrie == nil {
            storageProof[i] = StorageResult{outputKey, &hexutil.Big{}, []string{}}
            continue
        }
        var proof proofList
        if err := storageTrie.Prove(crypto.Keccak256(key.Bytes()), &proof); err != nil {
            return nil, err
        }
        value := (*hexutil.Big)(state.GetState(address, key).Big())
        storageProof[i] = StorageResult{outputKey, value, proof}
    }
    accountProof, proofErr := state.GetProof(address)
    if proofErr != nil {
        return nil, proofErr
    }
    return &AccountResult{Address: address, AccountProof: toHexSlice(accountProof), Balance: (*hexutil.Big)(state.GetBalance(address)), CodeHash: codeHash, Nonce: hexutil.Uint64(state.GetNonce(address)), StorageHash: storageHash, StorageProof: storageProof}, state.Error()
}
View on GitHub →


eth_getRawTransactionByBlockHashAndIndex¶

GetRawTransactionByBlockHashAndIndex returns the bytes of the transaction for the given block hash and index.

Params (2)¶

Parameters must be given by position.

1: blockHash common.Hash

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a Keccak 256 hash",
    "pattern": "^0x[a-fA-F\\d]{64}$",
    "title": "keccak",
    "type": [
        "string"
    ]
}

2: index hexutil.Uint

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a uint`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a uint",
    "pattern": "^0x([a-fA-F\\d])+$",
    "title": "uint",
    "type": [
        "string"
    ]
}

Result¶

hexutil.Bytes

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of some bytes`
- pattern: `^0x([a-fA-F\d])+$`
- title: `dataWord`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of some bytes",
    "pattern": "^0x([a-fA-F\\d])+$",
    "title": "dataWord",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getRawTransactionByBlockHashAndIndex", "params": [<blockHash>, <index>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getRawTransactionByBlockHashAndIndex", "params": [<blockHash>, <index>]}'
Javascript Console
1
eth.getRawTransactionByBlockHashAndIndex(blockHash,index);
Source code

1
2
3
4
5
6
func (s *TransactionAPI) GetRawTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) hexutil.Bytes {
    if block, _ := s.b.BlockByHash(ctx, blockHash); block != nil {
        return newRPCRawTransactionFromBlockIndex(block, uint64(index))
    }
    return nil
}// GetRawTransactionByBlockHashAndIndex returns the bytes of the transaction for the given block hash and index.
View on GitHub →


eth_getRawTransactionByBlockNumberAndIndex¶

GetRawTransactionByBlockNumberAndIndex returns the bytes of the transaction for the given block number and index.

Params (2)¶

Parameters must be given by position.

1: blockNr rpc.BlockNumber

  • Required: ✓ Yes
Schema
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
- oneOf: 

        - description: `The block height description`
        - enum: earliest, latest, pending
        - title: `blockNumberTag`
        - type: string


        - description: `Hex representation of a uint64`
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: string


- title: `blockNumberIdentifier`
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
    "oneOf": [
        {
            "description": "The block height description",
            "enum": [
                "earliest",
                "latest",
                "pending"
            ],
            "title": "blockNumberTag",
            "type": [
                "string"
            ]
        },
        {
            "description": "Hex representation of a uint64",
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": [
                "string"
            ]
        }
    ],
    "title": "blockNumberIdentifier"
}

2: index hexutil.Uint

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a uint`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a uint",
    "pattern": "^0x([a-fA-F\\d])+$",
    "title": "uint",
    "type": [
        "string"
    ]
}

Result¶

hexutil.Bytes

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of some bytes`
- pattern: `^0x([a-fA-F\d])+$`
- title: `dataWord`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of some bytes",
    "pattern": "^0x([a-fA-F\\d])+$",
    "title": "dataWord",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getRawTransactionByBlockNumberAndIndex", "params": [<blockNr>, <index>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getRawTransactionByBlockNumberAndIndex", "params": [<blockNr>, <index>]}'
Javascript Console
1
eth.getRawTransactionByBlockNumberAndIndex(blockNr,index);
Source code

1
2
3
4
5
6
func (s *TransactionAPI) GetRawTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) hexutil.Bytes {
    if block, _ := s.b.BlockByNumber(ctx, blockNr); block != nil {
        return newRPCRawTransactionFromBlockIndex(block, uint64(index))
    }
    return nil
}// GetRawTransactionByBlockNumberAndIndex returns the bytes of the transaction for the given block number and index.
View on GitHub →


eth_getRawTransactionByHash¶

GetRawTransactionByHash returns the bytes of the transaction for the given hash.

Params (1)¶

Parameters must be given by position.

1: hash common.Hash

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a Keccak 256 hash",
    "pattern": "^0x[a-fA-F\\d]{64}$",
    "title": "keccak",
    "type": [
        "string"
    ]
}

Result¶

hexutil.Bytes

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of some bytes`
- pattern: `^0x([a-fA-F\d])+$`
- title: `dataWord`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of some bytes",
    "pattern": "^0x([a-fA-F\\d])+$",
    "title": "dataWord",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getRawTransactionByHash", "params": [<hash>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getRawTransactionByHash", "params": [<hash>]}'
Javascript Console
1
eth.getRawTransactionByHash(hash);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
func (s *TransactionAPI) GetRawTransactionByHash(ctx context.Context, hash common.Hash) (hexutil.Bytes, error) {
    tx, _, _, _, err := s.b.GetTransaction(ctx, hash)
    if err != nil {
        return nil, err
    }
    if tx == nil {
        if tx = s.b.GetPoolTransaction(hash); tx == nil {
            return nil, nil
        }
    }
    return tx.MarshalBinary()
}// GetRawTransactionByHash returns the bytes of the transaction for the given hash.
View on GitHub →


eth_getStorageAt¶

GetStorageAt returns the storage from the state at the given address, key and block number. The rpc.LatestBlockNumber and rpc.PendingBlockNumber meta block numbers are also allowed.

Params (3)¶

Parameters must be given by position.

1: address common.Address

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a Keccak 256 hash POINTER`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a Keccak 256 hash POINTER",
    "pattern": "^0x[a-fA-F\\d]{64}$",
    "title": "keccak",
    "type": [
        "string"
    ]
}

2: hexKey string

  • Required: ✓ Yes

3: blockNrOrHash rpc.BlockNumberOrHash

  • Required: ✓ Yes

Result¶

hexutil.Bytes

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of some bytes`
- pattern: `^0x([a-fA-F\d])+$`
- title: `dataWord`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of some bytes",
    "pattern": "^0x([a-fA-F\\d])+$",
    "title": "dataWord",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getStorageAt", "params": [<address>, <hexKey>, <blockNrOrHash>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getStorageAt", "params": [<address>, <hexKey>, <blockNrOrHash>]}'
Javascript Console
1
eth.getStorageAt(address,hexKey,blockNrOrHash);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
func (s *BlockChainAPI) GetStorageAt(ctx context.Context, address common.Address, hexKey string, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error) {
    state, _, err := s.b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash)
    if state == nil || err != nil {
        return nil, err
    }
    key, _, err := decodeHash(hexKey)
    if err != nil {
        return nil, fmt.Errorf("unable to decode storage key: %s", err)
    }
    res := state.GetState(address, key)
    return res[ // GetStorageAt returns the storage from the state at the given address, key and
    // block number. The rpc.LatestBlockNumber and rpc.PendingBlockNumber meta block
    // numbers are also allowed.
    :], state.Error()
}
View on GitHub →


eth_getTransactionByBlockHashAndIndex¶

GetTransactionByBlockHashAndIndex returns the transaction for the given block hash and index.

Params (2)¶

Parameters must be given by position.

1: blockHash common.Hash

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a Keccak 256 hash",
    "pattern": "^0x[a-fA-F\\d]{64}$",
    "title": "keccak",
    "type": [
        "string"
    ]
}

2: index hexutil.Uint

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a uint`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a uint",
    "pattern": "^0x([a-fA-F\\d])+$",
    "title": "uint",
    "type": [
        "string"
    ]
}

Result¶

*RPCTransaction

  • Required: ✓ Yes
Schema
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
- additionalProperties: `false`
- properties: 
    - accessList: 
        - items: 
            - additionalProperties: `false`
            - properties: 
                - address: 
                    - pattern: `^0x[a-fA-F\d]{64}$`
                    - title: `keccak`
                    - type: `string`

                - storageKeys: 
                    - items: 
                        - description: `Hex representation of a Keccak 256 hash`
                        - pattern: `^0x[a-fA-F\d]{64}$`
                        - title: `keccak`
                        - type: `string`

                    - type: `array`


            - type: `object`

        - type: `array`

    - blockHash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - blockNumber: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - chainId: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - from: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - gas: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - gasPrice: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - hash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - input: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `dataWord`
        - type: `string`

    - maxFeePerGas: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - maxPriorityFeePerGas: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - nonce: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - r: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - s: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - to: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - transactionIndex: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - type: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - v: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - value: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - yParity: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`


- type: object
Raw
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
{
    "additionalProperties": false,
    "properties": {
        "accessList": {
            "items": {
                "additionalProperties": false,
                "properties": {
                    "address": {
                        "pattern": "^0x[a-fA-F\\d]{64}$",
                        "title": "keccak",
                        "type": "string"
                    },
                    "storageKeys": {
                        "items": {
                            "description": "Hex representation of a Keccak 256 hash",
                            "pattern": "^0x[a-fA-F\\d]{64}$",
                            "title": "keccak",
                            "type": "string"
                        },
                        "type": "array"
                    }
                },
                "type": "object"
            },
            "type": "array"
        },
        "blockHash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "blockNumber": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "chainId": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "from": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "gas": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "gasPrice": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "hash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "input": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "dataWord",
            "type": "string"
        },
        "maxFeePerGas": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "maxPriorityFeePerGas": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "nonce": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "r": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "s": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "to": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "transactionIndex": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "type": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "v": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "value": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "yParity": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        }
    },
    "type": [
        "object"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getTransactionByBlockHashAndIndex", "params": [<blockHash>, <index>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getTransactionByBlockHashAndIndex", "params": [<blockHash>, <index>]}'
Javascript Console
1
eth.getTransactionByBlockHashAndIndex(blockHash,index);
Source code

1
2
3
4
5
6
func (s *TransactionAPI) GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) *RPCTransaction {
    if block, _ := s.b.BlockByHash(ctx, blockHash); block != nil {
        return newRPCTransactionFromBlockIndex(block, uint64(index), s.b.ChainConfig())
    }
    return nil
}// GetTransactionByBlockHashAndIndex returns the transaction for the given block hash and index.
View on GitHub →


eth_getTransactionByBlockNumberAndIndex¶

GetTransactionByBlockNumberAndIndex returns the transaction for the given block number and index.

Params (2)¶

Parameters must be given by position.

1: blockNr rpc.BlockNumber

  • Required: ✓ Yes
Schema
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
- oneOf: 

        - description: `The block height description`
        - enum: earliest, latest, pending
        - title: `blockNumberTag`
        - type: string


        - description: `Hex representation of a uint64`
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: string


- title: `blockNumberIdentifier`
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
    "oneOf": [
        {
            "description": "The block height description",
            "enum": [
                "earliest",
                "latest",
                "pending"
            ],
            "title": "blockNumberTag",
            "type": [
                "string"
            ]
        },
        {
            "description": "Hex representation of a uint64",
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": [
                "string"
            ]
        }
    ],
    "title": "blockNumberIdentifier"
}

2: index hexutil.Uint

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a uint`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a uint",
    "pattern": "^0x([a-fA-F\\d])+$",
    "title": "uint",
    "type": [
        "string"
    ]
}

Result¶

*RPCTransaction

  • Required: ✓ Yes
Schema
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
- additionalProperties: `false`
- properties: 
    - accessList: 
        - items: 
            - additionalProperties: `false`
            - properties: 
                - address: 
                    - pattern: `^0x[a-fA-F\d]{64}$`
                    - title: `keccak`
                    - type: `string`

                - storageKeys: 
                    - items: 
                        - description: `Hex representation of a Keccak 256 hash`
                        - pattern: `^0x[a-fA-F\d]{64}$`
                        - title: `keccak`
                        - type: `string`

                    - type: `array`


            - type: `object`

        - type: `array`

    - blockHash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - blockNumber: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - chainId: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - from: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - gas: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - gasPrice: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - hash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - input: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `dataWord`
        - type: `string`

    - maxFeePerGas: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - maxPriorityFeePerGas: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - nonce: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - r: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - s: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - to: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - transactionIndex: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - type: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - v: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - value: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - yParity: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`


- type: object
Raw
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
{
    "additionalProperties": false,
    "properties": {
        "accessList": {
            "items": {
                "additionalProperties": false,
                "properties": {
                    "address": {
                        "pattern": "^0x[a-fA-F\\d]{64}$",
                        "title": "keccak",
                        "type": "string"
                    },
                    "storageKeys": {
                        "items": {
                            "description": "Hex representation of a Keccak 256 hash",
                            "pattern": "^0x[a-fA-F\\d]{64}$",
                            "title": "keccak",
                            "type": "string"
                        },
                        "type": "array"
                    }
                },
                "type": "object"
            },
            "type": "array"
        },
        "blockHash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "blockNumber": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "chainId": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "from": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "gas": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "gasPrice": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "hash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "input": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "dataWord",
            "type": "string"
        },
        "maxFeePerGas": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "maxPriorityFeePerGas": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "nonce": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "r": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "s": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "to": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "transactionIndex": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "type": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "v": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "value": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "yParity": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        }
    },
    "type": [
        "object"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getTransactionByBlockNumberAndIndex", "params": [<blockNr>, <index>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getTransactionByBlockNumberAndIndex", "params": [<blockNr>, <index>]}'
Javascript Console
1
eth.getTransactionByBlockNumberAndIndex(blockNr,index);
Source code

1
2
3
4
5
6
func (s *TransactionAPI) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) *RPCTransaction {
    if block, _ := s.b.BlockByNumber(ctx, blockNr); block != nil {
        return newRPCTransactionFromBlockIndex(block, uint64(index), s.b.ChainConfig())
    }
    return nil
}// GetTransactionByBlockNumberAndIndex returns the transaction for the given block number and index.
View on GitHub →


eth_getTransactionByHash¶

GetTransactionByHash returns the transaction for the given hash

Params (1)¶

Parameters must be given by position.

1: hash common.Hash

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a Keccak 256 hash",
    "pattern": "^0x[a-fA-F\\d]{64}$",
    "title": "keccak",
    "type": [
        "string"
    ]
}

Result¶

*RPCTransaction

  • Required: ✓ Yes
Schema
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
- additionalProperties: `false`
- properties: 
    - accessList: 
        - items: 
            - additionalProperties: `false`
            - properties: 
                - address: 
                    - pattern: `^0x[a-fA-F\d]{64}$`
                    - title: `keccak`
                    - type: `string`

                - storageKeys: 
                    - items: 
                        - description: `Hex representation of a Keccak 256 hash`
                        - pattern: `^0x[a-fA-F\d]{64}$`
                        - title: `keccak`
                        - type: `string`

                    - type: `array`


            - type: `object`

        - type: `array`

    - blockHash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - blockNumber: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - chainId: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - from: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - gas: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - gasPrice: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - hash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - input: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `dataWord`
        - type: `string`

    - maxFeePerGas: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - maxPriorityFeePerGas: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - nonce: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - r: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - s: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - to: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - transactionIndex: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - type: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - v: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - value: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - yParity: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`


- type: object
Raw
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
{
    "additionalProperties": false,
    "properties": {
        "accessList": {
            "items": {
                "additionalProperties": false,
                "properties": {
                    "address": {
                        "pattern": "^0x[a-fA-F\\d]{64}$",
                        "title": "keccak",
                        "type": "string"
                    },
                    "storageKeys": {
                        "items": {
                            "description": "Hex representation of a Keccak 256 hash",
                            "pattern": "^0x[a-fA-F\\d]{64}$",
                            "title": "keccak",
                            "type": "string"
                        },
                        "type": "array"
                    }
                },
                "type": "object"
            },
            "type": "array"
        },
        "blockHash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "blockNumber": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "chainId": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "from": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "gas": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "gasPrice": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "hash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "input": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "dataWord",
            "type": "string"
        },
        "maxFeePerGas": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "maxPriorityFeePerGas": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "nonce": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "r": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "s": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "to": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "transactionIndex": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "type": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "v": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "value": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "yParity": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        }
    },
    "type": [
        "object"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getTransactionByHash", "params": [<hash>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getTransactionByHash", "params": [<hash>]}'
Javascript Console
1
eth.getTransactionByHash(hash);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
func (s *TransactionAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) (*RPCTransaction, error) {
    tx, blockHash, blockNumber, index, err := s.b.GetTransaction(ctx, hash)
    if err != nil {
        return nil, err
    }
    if tx != nil {
        header, err := s.b.HeaderByHash(ctx, blockHash)
        if err != nil {
            return nil, err
        }
        return newRPCTransaction(tx, blockHash, blockNumber, header.Time, index, header.BaseFee, s.b.ChainConfig()), nil
    }
    if tx := s.b.GetPoolTransaction(hash); tx != nil {
        return NewRPCPendingTransaction(tx, s.b.CurrentHeader(), s.b.ChainConfig()), nil
    }
    return nil, nil
}// GetTransactionByHash returns the transaction for the given hash
View on GitHub →


eth_getTransactionCount¶

GetTransactionCount returns the number of transactions the given address has sent for the given block number

Params (2)¶

Parameters must be given by position.

1: address common.Address

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a Keccak 256 hash POINTER`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a Keccak 256 hash POINTER",
    "pattern": "^0x[a-fA-F\\d]{64}$",
    "title": "keccak",
    "type": [
        "string"
    ]
}

2: blockNrOrHash rpc.BlockNumberOrHash

  • Required: ✓ Yes

Result¶

*hexutil.Uint64

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a uint64`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint64`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a uint64",
    "pattern": "^0x([a-fA-F\\d])+$",
    "title": "uint64",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getTransactionCount", "params": [<address>, <blockNrOrHash>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getTransactionCount", "params": [<address>, <blockNrOrHash>]}'
Javascript Console
1
eth.getTransactionCount(address,blockNrOrHash);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
func (s *TransactionAPI) GetTransactionCount(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Uint64, error) {
    if blockNr, ok := blockNrOrHash.Number(); ok && blockNr == rpc.PendingBlockNumber {
        nonce, err := s.b.GetPoolNonce(ctx, address)
        if err != nil {
            return nil, err
        }
        return (*hexutil.Uint64)(&nonce), nil
    }
    state, _, err := s.b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash)
    if state == nil || err != nil {
        return nil, err
    }
    nonce := state.GetNonce(address)
    return (*hexutil.Uint64)(&nonce), state.Error()
}// GetTransactionCount returns the number of transactions the given address has sent for the given block number
View on GitHub →


eth_getTransactionReceipt¶

GetTransactionReceipt returns the transaction receipt for the given transaction hash.

Params (1)¶

Parameters must be given by position.

1: hash common.Hash

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a Keccak 256 hash",
    "pattern": "^0x[a-fA-F\\d]{64}$",
    "title": "keccak",
    "type": [
        "string"
    ]
}

Result¶

mapstringinterface map[string]interface{}

  • Required: ✓ Yes
Schema
1
2
3
4
5
6
- patternProperties: 
    - .*: 
        - additionalProperties: `true`


- type: object
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
{
    "patternProperties": {
        ".*": {
            "additionalProperties": true
        }
    },
    "type": [
        "object"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getTransactionReceipt", "params": [<hash>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getTransactionReceipt", "params": [<hash>]}'
Javascript Console
1
eth.getTransactionReceipt(hash);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
func (s *TransactionAPI) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map // GetTransactionReceipt returns the transaction receipt for the given transaction hash.
[string]interface{}, error) {
    tx, blockHash, blockNumber, index, err := s.b.GetTransaction(ctx, hash)
    if tx == nil || err != nil {
        return nil, nil
    }
    header, err := s.b.HeaderByHash(ctx, blockHash)
    if err != nil {
        return nil, err
    }
    receipts, err := s.b.GetReceipts(ctx, blockHash)
    if err != nil {
        return nil, err
    }
    if uint64(len(receipts)) <= index {
        return nil, nil
    }
    receipt := receipts[index]
    signer := types.MakeSigner(s.b.ChainConfig(), header.Number, header.Time)
    from, _ := types.Sender(signer, tx)
    fields := map[string]interface{}{"blockHash": blockHash, "blockNumber": hexutil.Uint64(blockNumber), "transactionHash": hash, "transactionIndex": hexutil.Uint64(index), "from": from, "to": tx.To(), "gasUsed": hexutil.Uint64(receipt.GasUsed), "cumulativeGasUsed": hexutil.Uint64(receipt.CumulativeGasUsed), "contractAddress": nil, "logs": receipt.Logs, "logsBloom": receipt.Bloom, "type": hexutil.Uint(tx.Type()), "effectiveGasPrice": (*hexutil.Big)(receipt.EffectiveGasPrice)}
    if len(receipt.PostState) > 0 {
        fields["root"] = hexutil.Bytes(receipt.PostState)
    } else {
        fields["status"] = hexutil.Uint(receipt.Status)
    }
    if receipt.Logs == nil {
        fields["logs"] = []*types.Log{}
    }
    if receipt.ContractAddress != (common.Address{}) {
        fields["contractAddress"] = receipt.ContractAddress
    }
    return fields, nil
}
View on GitHub →


eth_getUncleByBlockHashAndIndex¶

GetUncleByBlockHashAndIndex returns the uncle block for the given block hash and index. When fullTx is true all transactions in the block are returned in full detail, otherwise only the transaction hash is returned.

Params (2)¶

Parameters must be given by position.

1: blockHash common.Hash

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a Keccak 256 hash",
    "pattern": "^0x[a-fA-F\\d]{64}$",
    "title": "keccak",
    "type": [
        "string"
    ]
}

2: index hexutil.Uint

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a uint`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a uint",
    "pattern": "^0x([a-fA-F\\d])+$",
    "title": "uint",
    "type": [
        "string"
    ]
}

Result¶

*RPCMarshalBlockT

  • Required: ✓ Yes
Schema
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
- additionalProperties: `false`
- properties: 
    - baseFeePerGas: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - difficulty: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - error: 
        - type: `string`

    - extraData: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `dataWord`
        - type: `string`

    - gasLimit: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - gasUsed: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - hash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - logsBloom: 
        - items: 
            - description: `Hex representation of the integer`
            - pattern: `^0x[a-fA-F0-9]+$`
            - title: `integer`
            - type: `string`

        - maxItems: `256`
        - minItems: `256`
        - type: `array`

    - miner: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - mixHash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - nonce: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - number: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - parentHash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - receiptsRoot: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - sha3Uncles: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - size: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - stateRoot: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - timestamp: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - totalDifficulty: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - transactions: 
        - items: 
            - additionalProperties: `true`

        - type: `array`

    - transactionsRoot: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - uncles: 
        - items: 
            - description: `Hex representation of a Keccak 256 hash`
            - pattern: `^0x[a-fA-F\d]{64}$`
            - title: `keccak`
            - type: `string`

        - type: `array`

    - withdrawals: 
        - items: 
            - additionalProperties: `false`
            - properties: 
                - address: 
                    - pattern: `^0x[a-fA-F\d]{64}$`
                    - title: `keccak`
                    - type: `string`

                - amount: 
                    - pattern: `^0x[a-fA-F0-9]+$`
                    - title: `integer`
                    - type: `string`

                - index: 
                    - pattern: `^0x[a-fA-F0-9]+$`
                    - title: `integer`
                    - type: `string`

                - validatorIndex: 
                    - pattern: `^0x[a-fA-F0-9]+$`
                    - title: `integer`
                    - type: `string`


            - type: `object`

        - type: `array`

    - withdrawalsRoot: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`


- type: object
Raw
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
{
    "additionalProperties": false,
    "properties": {
        "baseFeePerGas": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "difficulty": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "error": {
            "type": "string"
        },
        "extraData": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "dataWord",
            "type": "string"
        },
        "gasLimit": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "gasUsed": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "hash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "logsBloom": {
            "items": {
                "description": "Hex representation of the integer",
                "pattern": "^0x[a-fA-F0-9]+$",
                "title": "integer",
                "type": "string"
            },
            "maxItems": 256,
            "minItems": 256,
            "type": "array"
        },
        "miner": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "mixHash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "nonce": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "number": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "parentHash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "receiptsRoot": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "sha3Uncles": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "size": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "stateRoot": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "timestamp": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "totalDifficulty": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "transactions": {
            "items": {
                "additionalProperties": true
            },
            "type": "array"
        },
        "transactionsRoot": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "uncles": {
            "items": {
                "description": "Hex representation of a Keccak 256 hash",
                "pattern": "^0x[a-fA-F\\d]{64}$",
                "title": "keccak",
                "type": "string"
            },
            "type": "array"
        },
        "withdrawals": {
            "items": {
                "additionalProperties": false,
                "properties": {
                    "address": {
                        "pattern": "^0x[a-fA-F\\d]{64}$",
                        "title": "keccak",
                        "type": "string"
                    },
                    "amount": {
                        "pattern": "^0x[a-fA-F0-9]+$",
                        "title": "integer",
                        "type": "string"
                    },
                    "index": {
                        "pattern": "^0x[a-fA-F0-9]+$",
                        "title": "integer",
                        "type": "string"
                    },
                    "validatorIndex": {
                        "pattern": "^0x[a-fA-F0-9]+$",
                        "title": "integer",
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "type": "array"
        },
        "withdrawalsRoot": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        }
    },
    "type": [
        "object"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getUncleByBlockHashAndIndex", "params": [<blockHash>, <index>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getUncleByBlockHashAndIndex", "params": [<blockHash>, <index>]}'
Javascript Console
1
eth.getUncleByBlockHashAndIndex(blockHash,index);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
func (s *BlockChainAPI) GetUncleByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) (*RPCMarshalBlockT, error) {
    block, err := s.b.BlockByHash(ctx, blockHash)
    if block != nil {
        uncles := block.Uncles()
        if index >= hexutil.Uint(len(uncles)) {
            log.Debug("Requested uncle not found", "number", block.Number(), "hash", blockHash, "index", index)
            return nil, nil
        }
        block = types.NewBlockWithHeader(uncles[index])
        return s.rpcMarshalBlock(ctx, block, false, false)
    }
    return nil, err
}// GetUncleByBlockHashAndIndex returns the uncle block for the given block hash and index. When fullTx is true
// all transactions in the block are returned in full detail, otherwise only the transaction hash is returned.
View on GitHub →


eth_getUncleByBlockNumberAndIndex¶

GetUncleByBlockNumberAndIndex returns the uncle block for the given block hash and index. When fullTx is true all transactions in the block are returned in full detail, otherwise only the transaction hash is returned.

Params (2)¶

Parameters must be given by position.

1: blockNr rpc.BlockNumber

  • Required: ✓ Yes
Schema
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
- oneOf: 

        - description: `The block height description`
        - enum: earliest, latest, pending
        - title: `blockNumberTag`
        - type: string


        - description: `Hex representation of a uint64`
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: string


- title: `blockNumberIdentifier`
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
    "oneOf": [
        {
            "description": "The block height description",
            "enum": [
                "earliest",
                "latest",
                "pending"
            ],
            "title": "blockNumberTag",
            "type": [
                "string"
            ]
        },
        {
            "description": "Hex representation of a uint64",
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": [
                "string"
            ]
        }
    ],
    "title": "blockNumberIdentifier"
}

2: index hexutil.Uint

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a uint`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a uint",
    "pattern": "^0x([a-fA-F\\d])+$",
    "title": "uint",
    "type": [
        "string"
    ]
}

Result¶

*RPCMarshalBlockT

  • Required: ✓ Yes
Schema
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
- additionalProperties: `false`
- properties: 
    - baseFeePerGas: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - difficulty: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - error: 
        - type: `string`

    - extraData: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `dataWord`
        - type: `string`

    - gasLimit: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - gasUsed: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - hash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - logsBloom: 
        - items: 
            - description: `Hex representation of the integer`
            - pattern: `^0x[a-fA-F0-9]+$`
            - title: `integer`
            - type: `string`

        - maxItems: `256`
        - minItems: `256`
        - type: `array`

    - miner: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - mixHash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - nonce: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - number: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - parentHash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - receiptsRoot: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - sha3Uncles: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - size: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - stateRoot: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - timestamp: 
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: `string`

    - totalDifficulty: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - transactions: 
        - items: 
            - additionalProperties: `true`

        - type: `array`

    - transactionsRoot: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - uncles: 
        - items: 
            - description: `Hex representation of a Keccak 256 hash`
            - pattern: `^0x[a-fA-F\d]{64}$`
            - title: `keccak`
            - type: `string`

        - type: `array`

    - withdrawals: 
        - items: 
            - additionalProperties: `false`
            - properties: 
                - address: 
                    - pattern: `^0x[a-fA-F\d]{64}$`
                    - title: `keccak`
                    - type: `string`

                - amount: 
                    - pattern: `^0x[a-fA-F0-9]+$`
                    - title: `integer`
                    - type: `string`

                - index: 
                    - pattern: `^0x[a-fA-F0-9]+$`
                    - title: `integer`
                    - type: `string`

                - validatorIndex: 
                    - pattern: `^0x[a-fA-F0-9]+$`
                    - title: `integer`
                    - type: `string`


            - type: `object`

        - type: `array`

    - withdrawalsRoot: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`


- type: object
Raw
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
{
    "additionalProperties": false,
    "properties": {
        "baseFeePerGas": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "difficulty": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "error": {
            "type": "string"
        },
        "extraData": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "dataWord",
            "type": "string"
        },
        "gasLimit": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "gasUsed": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "hash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "logsBloom": {
            "items": {
                "description": "Hex representation of the integer",
                "pattern": "^0x[a-fA-F0-9]+$",
                "title": "integer",
                "type": "string"
            },
            "maxItems": 256,
            "minItems": 256,
            "type": "array"
        },
        "miner": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "mixHash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "nonce": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "number": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "parentHash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "receiptsRoot": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "sha3Uncles": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "size": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "stateRoot": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "timestamp": {
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": "string"
        },
        "totalDifficulty": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "transactions": {
            "items": {
                "additionalProperties": true
            },
            "type": "array"
        },
        "transactionsRoot": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "uncles": {
            "items": {
                "description": "Hex representation of a Keccak 256 hash",
                "pattern": "^0x[a-fA-F\\d]{64}$",
                "title": "keccak",
                "type": "string"
            },
            "type": "array"
        },
        "withdrawals": {
            "items": {
                "additionalProperties": false,
                "properties": {
                    "address": {
                        "pattern": "^0x[a-fA-F\\d]{64}$",
                        "title": "keccak",
                        "type": "string"
                    },
                    "amount": {
                        "pattern": "^0x[a-fA-F0-9]+$",
                        "title": "integer",
                        "type": "string"
                    },
                    "index": {
                        "pattern": "^0x[a-fA-F0-9]+$",
                        "title": "integer",
                        "type": "string"
                    },
                    "validatorIndex": {
                        "pattern": "^0x[a-fA-F0-9]+$",
                        "title": "integer",
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "type": "array"
        },
        "withdrawalsRoot": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        }
    },
    "type": [
        "object"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getUncleByBlockNumberAndIndex", "params": [<blockNr>, <index>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getUncleByBlockNumberAndIndex", "params": [<blockNr>, <index>]}'
Javascript Console
1
eth.getUncleByBlockNumberAndIndex(blockNr,index);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
func (s *BlockChainAPI) GetUncleByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) (*RPCMarshalBlockT, error) {
    block, err := s.b.BlockByNumber(ctx, blockNr)
    if block != nil {
        uncles := block.Uncles()
        if index >= hexutil.Uint(len(uncles)) {
            log.Debug("Requested uncle not found", "number", blockNr, "hash", block.Hash(), "index", index)
            return nil, nil
        }
        block = types.NewBlockWithHeader(uncles[index])
        return s.rpcMarshalBlock(ctx, block, false, false)
    }
    return nil, err
}// GetUncleByBlockNumberAndIndex returns the uncle block for the given block hash and index. When fullTx is true
// all transactions in the block are returned in full detail, otherwise only the transaction hash is returned.
View on GitHub →


eth_getUncleCountByBlockHash¶

GetUncleCountByBlockHash returns number of uncles in the block for the given block hash

Params (1)¶

Parameters must be given by position.

1: blockHash common.Hash

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a Keccak 256 hash",
    "pattern": "^0x[a-fA-F\\d]{64}$",
    "title": "keccak",
    "type": [
        "string"
    ]
}

Result¶

*hexutil.Uint

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a uint`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a uint",
    "pattern": "^0x([a-fA-F\\d])+$",
    "title": "uint",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getUncleCountByBlockHash", "params": [<blockHash>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getUncleCountByBlockHash", "params": [<blockHash>]}'
Javascript Console
1
eth.getUncleCountByBlockHash(blockHash);
Source code

1
2
3
4
5
6
7
func (s *BlockChainAPI) GetUncleCountByBlockHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint {
    if block, _ := s.b.BlockByHash(ctx, blockHash); block != nil {
        n := hexutil.Uint(len(block.Uncles()))
        return &n
    }
    return nil
}// GetUncleCountByBlockHash returns number of uncles in the block for the given block hash
View on GitHub →


eth_getUncleCountByBlockNumber¶

GetUncleCountByBlockNumber returns number of uncles in the block for the given block number

Params (1)¶

Parameters must be given by position.

1: blockNr rpc.BlockNumber

  • Required: ✓ Yes
Schema
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
- oneOf: 

        - description: `The block height description`
        - enum: earliest, latest, pending
        - title: `blockNumberTag`
        - type: string


        - description: `Hex representation of a uint64`
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint64`
        - type: string


- title: `blockNumberIdentifier`
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
    "oneOf": [
        {
            "description": "The block height description",
            "enum": [
                "earliest",
                "latest",
                "pending"
            ],
            "title": "blockNumberTag",
            "type": [
                "string"
            ]
        },
        {
            "description": "Hex representation of a uint64",
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint64",
            "type": [
                "string"
            ]
        }
    ],
    "title": "blockNumberIdentifier"
}

Result¶

*hexutil.Uint

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a uint`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a uint",
    "pattern": "^0x([a-fA-F\\d])+$",
    "title": "uint",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getUncleCountByBlockNumber", "params": [<blockNr>]}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getUncleCountByBlockNumber", "params": [<blockNr>]}'
Javascript Console
1
eth.getUncleCountByBlockNumber(blockNr);
Source code

1
2
3
4
5
6
7
func (s *BlockChainAPI) GetUncleCountByBlockNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint {
    if block, _ := s.b.BlockByNumber(ctx, blockNr); block != nil {
        n := hexutil.Uint(len(block.Uncles()))
        return &n
    }
    return nil
}// GetUncleCountByBlockNumber returns number of uncles in the block for the given block number
View on GitHub →


eth_getWork¶

GetWork returns a work package for external miner.

The work package consists of 3 strings:

result[0] - 32 bytes hex encoded current block header pow-hash
result[1] - 32 bytes hex encoded seed hash used for DAG
result[2] - 32 bytes hex encoded boundary condition ("target"), 2^256/difficulty
result[3] - hex encoded block number

Params (0)¶

None

Result¶

num4string [4]string

  • Required: ✓ Yes
Schema
1
2
3
4
5
6
7
8
- items: 

        - type: string


- maxItems: `4`
- minItems: `4`
- type: array
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
{
    "items": [
        {
            "type": [
                "string"
            ]
        }
    ],
    "maxItems": 4,
    "minItems": 4,
    "type": [
        "array"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getWork", "params": []}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getWork", "params": []}'
Javascript Console
1
eth.getWork();
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
func (api *API) GetWork() ([4]string, error) {
    if api.ethash.remote == nil {
        return [4]string{}, errors.New("not supported")
    }
    var (
        workCh  = make(chan [4]string, 1)
        errc    = make(chan error, 1)
    )
    select {
    case api.ethash.remote.fetchWorkCh <- &sealWork{errc: errc, res: workCh}:
    case <-api.ethash.remote.exitCh:
        return [4]string{}, errEthashStopped
    }
    select {
    case work := <-workCh:
        return work, nil
    case err := <-errc:
        return [4]string{}, err
    }
}// GetWork returns a work package for external miner.
//
// The work package consists of 3 strings:
//
//  result[0] - 32 bytes hex encoded current block header pow-hash
//  result[1] - 32 bytes hex encoded seed hash used for DAG
//  result[2] - 32 bytes hex encoded boundary condition ("target"), 2^256/difficulty
//  result[3] - hex encoded block number
View on GitHub →


eth_hashrate¶

Hashrate returns the POW hashrate.

Params (0)¶

None

Result¶

hexutil.Uint64

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of a uint64`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint64`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a uint64",
    "pattern": "^0x([a-fA-F\\d])+$",
    "title": "uint64",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_hashrate", "params": []}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_hashrate", "params": []}'
Javascript Console
1
eth.hashrate();
Source code

1
2
3
func (api *EthereumAPI) Hashrate() hexutil.Uint64 {
    return hexutil.Uint64(api.e.Miner().Hashrate())
}// Hashrate returns the POW hashrate.
View on GitHub →


eth_logs¶

Logs creates a subscription that fires for all new log that match the given filter criteria.

Params (1)¶

Parameters must be given by position.

1: crit FilterCriteria

  • Required: ✓ Yes
Schema
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
- additionalProperties: `false`
- properties: 
    - Addresses: 
        - items: 
            - description: `Hex representation of a Keccak 256 hash POINTER`
            - pattern: `^0x[a-fA-F\d]{64}$`
            - title: `keccak`
            - type: `string`

        - type: `array`

    - BlockHash: 
        - pattern: `^0x[a-fA-F\d]{64}$`
        - title: `keccak`
        - type: `string`

    - FromBlock: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - ToBlock: 
        - pattern: `^0x[a-fA-F0-9]+$`
        - title: `integer`
        - type: `string`

    - Topics: 
        - items: 
            - items: 
                - description: `Hex representation of a Keccak 256 hash`
                - pattern: `^0x[a-fA-F\d]{64}$`
                - title: `keccak`
                - type: `string`

            - type: `array`

        - type: `array`


- type: object
Raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{
    "additionalProperties": false,
    "properties": {
        "Addresses": {
            "items": {
                "description": "Hex representation of a Keccak 256 hash POINTER",
                "pattern": "^0x[a-fA-F\\d]{64}$",
                "title": "keccak",
                "type": "string"
            },
            "type": "array"
        },
        "BlockHash": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        },
        "FromBlock": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "ToBlock": {
            "pattern": "^0x[a-fA-F0-9]+$",
            "title": "integer",
            "type": "string"
        },
        "Topics": {
            "items": {
                "items": {
                    "description": "Hex representation of a Keccak 256 hash",
                    "pattern": "^0x[a-fA-F\\d]{64}$",
                    "title": "keccak",
                    "type": "string"
                },
                "type": "array"
            },
            "type": "array"
        }
    },
    "type": [
        "object"
    ]
}

Result¶

*rpc.Subscription

  • Required: ✓ Yes
Schema
1
2
3
- description: `Subscription identifier`
- title: `subscriptionID`
- type: string
Raw
1
2
3
4
5
6
7
{
    "description": "Subscription identifier",
    "title": "subscriptionID",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples¶

Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_subscribe", "params": ["logs", <crit>]}'
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
func (api *FilterAPI) Logs(ctx context.Context, crit FilterCriteria) (*rpc.Subscription, error) {
    notifier, supported := rpc.NotifierFromContext(ctx)
    if !supported {
        return &rpc.Subscription{}, rpc.ErrNotificationsUnsupported
    }
    var (
        rpcSub      = notifier.CreateSubscription()
        matchedLogs = make(chan [ // Logs creates a subscription that fires for all new log that match the given filter criteria.
        ]*types.Log)
    )
    logsSub, err := api.events.SubscribeLogs(ethereum.FilterQuery(crit), matchedLogs)
    if err != nil {
        return nil, err
    }
    go func() {
        for {
            select {
            case logs := <-matchedLogs:
                for _, log := range logs {
                    log := log
                    notifier.Notify(rpcSub.ID, &log)
                }
            case <-rpcSub.Err():
                logsSub.Unsubscribe()
                return
            case <-notifier.Closed():
                logsSub.Unsubscribe()
                return
            }
        }
    }()
    return rpcSub, nil
}
View on GitHub →


eth_maxPriorityFeePerGas¶

MaxPriorityFeePerGas returns a suggestion for a gas tip cap for dynamic fee transactions.

Params (0)¶

None

Result¶

*hexutil.Big

  • Required: ✓ Yes
Schema
1
2
3
4
- description: `Hex representation of the integer`
- pattern: `^0x[a-fA-F0-9]+$`
- title: `integer`
- type: string
Raw
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of the integer",
    "pattern": "^0x[a-fA-F0-9]+$",
    "title": "integer",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_maxPriorityFeePerGas", "params": []}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_maxPriorityFeePerGas", "params": []}'
Javascript Console
1
eth.maxPriorityFeePerGas();
Source code

1
2
3
4
5
6
7
func (s *EthereumAPI) MaxPriorityFeePerGas(ctx context.Context) (*hexutil.Big, error) {
    tipcap, err := s.b.SuggestGasTipCap(ctx)
    if err != nil {
        return nil, err
    }
    return (*hexutil.Big)(tipcap), err
}// MaxPriorityFeePerGas returns a suggestion for a gas tip cap for dynamic fee transactions.
View on GitHub →


eth_mining¶

Mining returns an indication if this node is currently mining.

Params (0)¶

None

Result¶

bool

  • Required: ✓ Yes

Client Method Invocation Examples¶

Shell HTTP
1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_mining", "params": []}'
Shell WebSocket
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_mining", "params": []}'
Javascript Console
1
eth.mining();
Source code

1
2
3
func (api *EthereumAPI) Mining() bool {
    return api.e.IsMining()
}// Mining returns an indication if this node is currently mining.
View on GitHub →


eth_newBlockFilter¶

NewBlockFilter creates a filter that fetches blocks that are imported into the chain. It is part of the filter package since polling goes with eth_getFilterChanges.

Params (0)¶

None

Result¶

rpc.ID

  • Required: ✓ Yes
Schema
1
2
3
- description: `Subscription identifier`
- title: `subscriptionID`
- type: string
Raw
1
2
3
4
5
6
7
{
    "description": "Subscription identifier",
    "titl

[Page truncated to keep GeezerVison snappy.]

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.