Skip to content

Eth

Entity Version
Source 1.11.23-unstable/generated-at:2021-04-30T19:24:24+03: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
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
 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

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

1
2
3
4
func (s *PublicAccountAPI) 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
1
2
3
4
- description: `Hex representation of a uint64`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint64`
- type: string
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

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

1
2
3
4
func (s *PublicBlockChainAPI) 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 (3)

Parameters must be given by position.

1: args CallArgs

  • Required: ✓ Yes
 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
- 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`

    - 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`

    - 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
 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
{
    "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"
        },
        "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"
        },
        "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 *map[common.Address]account

  • Required: ✓ Yes
 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
 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.Bytes

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of some bytes`
- pattern: `^0x([a-fA-F\d])+$`
- title: `dataWord`
- type: string
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

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>]}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_call", "params": [<args>, <blockNrOrHash>, <overrides>]}'
1
eth.call(args,blockNrOrHash,overrides);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
func (s *PublicBlockChainAPI) Call(ctx context.Context, args CallArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *map // 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.
[common.Address]account) (hexutil.Bytes, error) {
    var accounts map[common.Address]account
    if overrides != nil {
        accounts = *overrides
    }
    result, err := DoCall(ctx, s.b, args, blockNrOrHash, accounts, vm.Config{}, 5*time.Second, s.b.RPCGasCap())
    if err != nil {
        return nil, err
    }
    if len(result.Revert()) > 0 {
        return nil, newRevertError(result)
    }
    return result.Return(), result.Err
}
View on GitHub →


eth_chainId

ChainId returns the chainID value for transaction replay protection.

Params (0)

None

Result

*hexutil.Big

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of the integer`
- pattern: `^0x[a-fA-F0-9]+$`
- title: `integer`
- type: string
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

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

1
2
3
func (s *PublicBlockChainAPI) ChainId() *hexutil.Big {
    return (*hexutil.Big)(s.b.ChainConfig().GetChainID())
}// ChainId returns the chainID value for transaction replay protection.
View on GitHub →


eth_chainId

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

Params (0)

None

Result

hexutil.Uint64

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of a uint64`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint64`
- type: string
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

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

1
2
3
4
5
6
func (api *PublicEthereumAPI) ChainId() (hexutil.Uint64, error) {
    if config := api.e.blockchain.Config(); config.IsEnabled(config.GetEIP155Transition, api.e.blockchain.CurrentBlock().Number()) {
        return (hexutil.Uint64)(api.e.blockchain.Config().GetChainID().Uint64()), nil
    }
    return hexutil.Uint64(0), fmt.Errorf("chain not synced beyond EIP-155 replay-protection fork block")
}// ChainId is the EIP-155 replay-protection chain id for the current ethereum chain config.
View on GitHub →


eth_coinbase

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

Params (0)

None

Result

common.Address

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of a Keccak 256 hash POINTER`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
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

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

1
2
3
func (api *PublicEthereumAPI) Coinbase() (common.Address, error) {
    return api.Etherbase()
}// Coinbase is the address that mining rewards will be send to (alias for Etherbase)
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 (2)

Parameters must be given by position.

1: args CallArgs

  • Required: ✓ Yes
 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
- 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`

    - 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`

    - 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
 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
{
    "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"
        },
        "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"
        },
        "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

hexutil.Uint64

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of a uint64`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint64`
- type: string
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

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

1
2
3
4
5
6
7
8
func (s *PublicBlockChainAPI) EstimateGas(ctx context.Context, args CallArgs, blockNrOrHash *rpc.BlockNumberOrHash) (hexutil.Uint64, error) {
    bNrOrHash := rpc.BlockNumberOrHashWithNumber(rpc.PendingBlockNumber)
    if blockNrOrHash != nil {
        bNrOrHash = *blockNrOrHash
    }
    return DoEstimateGas(ctx, s.b, args, bNrOrHash, 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 send to

Params (0)

None

Result

common.Address

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of a Keccak 256 hash POINTER`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
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

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

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


eth_fillTransaction

FillTransaction fills the defaults (nonce, gas, gasPrice) 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 SendTxArgs

  • Required: ✓ Yes
 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
- 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`

    - 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
 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
{
    "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"
        },
        "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
 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
 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

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
func (s *PublicTransactionPoolAPI) FillTransaction(ctx context.Context, args SendTxArgs) (*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) 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.

Params (0)

None

Result

*hexutil.Big

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of the integer`
- pattern: `^0x[a-fA-F0-9]+$`
- title: `integer`
- type: string
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

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

1
2
3
4
func (s *PublicEthereumAPI) GasPrice(ctx context.Context) (*hexutil.Big, error) {
    price, err := s.b.SuggestPrice(ctx)
    return (*hexutil.Big)(price), err
}// GasPrice returns a suggestion for a gas price.
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
1
2
3
4
- description: `Hex representation of a Keccak 256 hash POINTER`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
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
1
2
3
4
- description: `Hex representation of the integer`
- pattern: `^0x[a-fA-F0-9]+$`
- title: `integer`
- type: string
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

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

1
2
3
4
5
6
7
8
9
func (s *PublicBlockChainAPI) 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
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
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
  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
- additionalProperties: `false`
- properties: 
    - 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`


- type: object
  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": {
        "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"
        }
    },
    "type": [
        "object"
    ]
}

Client Method Invocation Examples

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

1
2
3
4
5
6
7
8
func (s *PublicBlockChainAPI) 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 head is returned. * When blockNr is -2 the pending chain head 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
 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`
 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
  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
- additionalProperties: `false`
- properties: 
    - 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`


- type: object
  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": {
        "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"
        }
    },
    "type": [
        "object"
    ]
}

Client Method Invocation Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
func (s *PublicBlockChainAPI) 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 head is returned.
// * When blockNr is -2 the pending chain head 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
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
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
1
2
3
4
- description: `Hex representation of a uint`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint`
- type: string
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

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

1
2
3
4
5
6
7
func (s *PublicTransactionPoolAPI) 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
 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`
 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
1
2
3
4
- description: `Hex representation of a uint`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint`
- type: string
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

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

1
2
3
4
5
6
7
func (s *PublicTransactionPoolAPI) 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
1
2
3
4
- description: `Hex representation of a Keccak 256 hash POINTER`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
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
1
2
3
4
- description: `Hex representation of some bytes`
- pattern: `^0x([a-fA-F\d])+$`
- title: `dataWord`
- type: string
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

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

1
2
3
4
5
6
7
8
func (s *PublicBlockChainAPI) 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.

https://eth.wiki/json-rpc/API#eth_getfilterchanges

Params (1)

Parameters must be given by position.

1: id rpc.ID

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

Result

interface interface{}

  • Required: ✓ Yes

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getFilterChanges", "params": [<id>]}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getFilterChanges", "params": [<id>]}'
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
func (api *PublicFilterAPI) GetFilterChanges(id rpc.ID) (interface{}, error) {
    api.filtersMu.Lock()
    defer api.filtersMu.Unlock()
    if f, found := api.filters[id]; found {
        if !f.deadline.Stop() {
            <-f.deadline.C
        }
        f.deadline.Reset(api.timeout)
        switch f.typ {
        case PendingTransactionsSubscription, BlocksSubscription, SideBlocksSubscription:
            hashes := f.hashes
            f.hashes = nil
            return returnHashes(hashes), nil
        case LogsSubscription, MinedAndPendingLogsSubscription:
            logs := f.logs
            f.logs = nil
            return returnLogs(logs), nil
        }
    }
    return [ // 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.
    //
    // https://eth.wiki/json-rpc/API#eth_getfilterchanges
    ]interface{}{}, fmt.Errorf("filter not found")
}
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.

https://eth.wiki/json-rpc/API#eth_getfilterlogs

Params (1)

Parameters must be given by position.

1: id rpc.ID

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

Result

typesLog []*types.Log

  • Required: ✓ Yes
 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
 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

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getFilterLogs", "params": [<id>]}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getFilterLogs", "params": [<id>]}'
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
30
31
func (api *PublicFilterAPI) 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.
//
// https://eth.wiki/json-rpc/API#eth_getfilterlogs
]*types.Log, error) {
    api.filtersMu.Lock()
    f, found := api.filters[id]
    api.filtersMu.Unlock()
    if !found || f.typ != LogsSubscription {
        return nil, fmt.Errorf("filter not found")
    }
    var filter *Filter
    if f.crit.BlockHash != nil {
        filter = NewBlockFilter(api.backend, *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 = NewRangeFilter(api.backend, 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
1
2
3
4
- description: `Hex representation of the integer`
- pattern: `^0x[a-fA-F0-9]+$`
- title: `integer`
- type: string
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

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getHashrate", "params": []}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getHashrate", "params": []}'
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
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
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
  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
- additionalProperties: `false`
- properties: 
    - 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`

    - 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`

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


- type: object
  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
{
    "additionalProperties": false,
    "properties": {
        "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"
        },
        "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"
        },
        "transactionsRoot": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        }
    },
    "type": [
        "object"
    ]
}

Client Method Invocation Examples

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

1
2
3
4
5
6
7
func (s *PublicBlockChainAPI) 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 head is returned. * When blockNr is -2 the pending chain head is returned.

Params (1)

Parameters must be given by position.

1: number rpc.BlockNumber

  • Required: ✓ Yes
 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`
 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
  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
- additionalProperties: `false`
- properties: 
    - 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`

    - 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`

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


- type: object
  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
{
    "additionalProperties": false,
    "properties": {
        "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"
        },
        "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"
        },
        "transactionsRoot": {
            "pattern": "^0x[a-fA-F\\d]{64}$",
            "title": "keccak",
            "type": "string"
        }
    },
    "type": [
        "object"
    ]
}

Client Method Invocation Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
func (s *PublicBlockChainAPI) 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 head is returned.
// * When blockNr is -2 the pending chain head is returned.
View on GitHub →


eth_getLogs

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

https://eth.wiki/json-rpc/API#eth_getlogs

Params (1)

Parameters must be given by position.

1: crit FilterCriteria

  • Required: ✓ Yes
 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
 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
 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
 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

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getLogs", "params": [<crit>]}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getLogs", "params": [<crit>]}'
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
23
24
func (api *PublicFilterAPI) GetLogs(ctx context.Context, crit FilterCriteria) ([ // GetLogs returns logs matching the given argument that are stored within the state.
//
// https://eth.wiki/json-rpc/API#eth_getlogs
]*types.Log, error) {
    var filter *Filter
    if crit.BlockHash != nil {
        filter = NewBlockFilter(api.backend, *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 = NewRangeFilter(api.backend, 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
1
2
3
4
- description: `Hex representation of a Keccak 256 hash POINTER`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
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
1
2
3
4
5
6
- items: 

        - type: string


- type: array
 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
 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
 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

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>]}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getProof", "params": [<address>, <storageKeys>, <blockNrOrHash>]}'
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
func (s *PublicBlockChainAPI) 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) {
    state, _, err := s.b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash)
    if state == nil || err != nil {
        return nil, err
    }
    storageTrie := state.StorageTrie(address)
    storageHash := types.EmptyRootHash
    codeHash := state.GetCodeHash(address)
    storageProof := make([]StorageResult, len(storageKeys))
    if storageTrie != nil {
        storageHash = storageTrie.Hash()
    } else {
        codeHash = crypto.Keccak256Hash(nil)
    }
    for i, key := range storageKeys {
        if storageTrie != nil {
            proof, storageError := state.GetStorageProof(address, common.HexToHash(key))
            if storageError != nil {
                return nil, storageError
            }
            storageProof[i] = StorageResult{key, (*hexutil.Big)(state.GetState(address, common.HexToHash(key)).Big()), toHexSlice(proof)}
        } else {
            storageProof[i] = StorageResult{key, &hexutil.Big{}, []string{}}
        }
    }
    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
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
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
1
2
3
4
- description: `Hex representation of a uint`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint`
- type: string
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
1
2
3
4
- description: `Hex representation of some bytes`
- pattern: `^0x([a-fA-F\d])+$`
- title: `dataWord`
- type: string
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

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

1
2
3
4
5
6
func (s *PublicTransactionPoolAPI) 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
 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`
 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
1
2
3
4
- description: `Hex representation of a uint`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint`
- type: string
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
1
2
3
4
- description: `Hex representation of some bytes`
- pattern: `^0x([a-fA-F\d])+$`
- title: `dataWord`
- type: string
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

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

1
2
3
4
5
6
func (s *PublicTransactionPoolAPI) 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
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
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
1
2
3
4
- description: `Hex representation of some bytes`
- pattern: `^0x([a-fA-F\d])+$`
- title: `dataWord`
- type: string
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

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
func (s *PublicTransactionPoolAPI) 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
1
2
3
4
- description: `Hex representation of a Keccak 256 hash POINTER`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
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: key string

  • Required: ✓ Yes

3: blockNrOrHash rpc.BlockNumberOrHash

  • Required: ✓ Yes

Result

hexutil.Bytes

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of some bytes`
- pattern: `^0x([a-fA-F\d])+$`
- title: `dataWord`
- type: string
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

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
func (s *PublicBlockChainAPI) GetStorageAt(ctx context.Context, address common.Address, key string, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error) {
    state, _, err := s.b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash)
    if state == nil || err != nil {
        return nil, err
    }
    res := state.GetState(address, common.HexToHash(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
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
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
1
2
3
4
- description: `Hex representation of a uint`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint`
- type: string
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
  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
- 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`

    - 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`


- type: object
  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
{
    "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"
        },
        "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"
        }
    },
    "type": [
        "object"
    ]
}

Client Method Invocation Examples

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

1
2
3
4
5
6
func (s *PublicTransactionPoolAPI) 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))
    }
    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
 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`
 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
1
2
3
4
- description: `Hex representation of a uint`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint`
- type: string
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
  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
- 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`

    - 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`


- type: object
  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
{
    "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"
        },
        "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"
        }
    },
    "type": [
        "object"
    ]
}

Client Method Invocation Examples

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

1
2
3
4
5
6
func (s *PublicTransactionPoolAPI) 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))
    }
    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
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
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
  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
- 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`

    - 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`


- type: object
  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
{
    "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"
        },
        "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"
        }
    },
    "type": [
        "object"
    ]
}

Client Method Invocation Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
func (s *PublicTransactionPoolAPI) 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 {
        return newRPCTransaction(tx, blockHash, blockNumber, index), nil
    }
    if tx := s.b.GetPoolTransaction(hash); tx != nil {
        return newRPCPendingTransaction(tx), 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
1
2
3
4
- description: `Hex representation of a Keccak 256 hash POINTER`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
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
1
2
3
4
- description: `Hex representation of a uint64`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint64`
- type: string
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

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
func (s *PublicTransactionPoolAPI) 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
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
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
1
2
3
4
5
6
- patternProperties: 
    - .*: 
        - additionalProperties: `true`


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

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getTransactionReceipt", "params": [<hash>]}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getTransactionReceipt", "params": [<hash>]}'
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
func (s *PublicTransactionPoolAPI) 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 err != nil {
        return nil, nil
    }
    receipts, err := s.b.GetReceipts(ctx, blockHash)
    if err != nil {
        return nil, err
    }
    if len(receipts) <= int(index) {
        return nil, nil
    }
    receipt := receipts[index]
    bigblock := new(big.Int).SetUint64(blockNumber)
    signer := types.MakeSigner(s.b.ChainConfig(), bigblock)
    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())}
    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
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
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
1
2
3
4
- description: `Hex representation of a uint`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint`
- type: string
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
  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
- additionalProperties: `false`
- properties: 
    - 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`


- type: object
  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": {
        "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"
        }
    },
    "type": [
        "object"
    ]
}

Client Method Invocation Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
func (s *PublicBlockChainAPI) 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
 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`
 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
1
2
3
4
- description: `Hex representation of a uint`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint`
- type: string
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
  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
- additionalProperties: `false`
- properties: 
    - 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`


- type: object
  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": {
        "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"
        }
    },
    "type": [
        "object"
    ]
}

Client Method Invocation Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
func (s *PublicBlockChainAPI) 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
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
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
1
2
3
4
- description: `Hex representation of a uint`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint`
- type: string
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

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

1
2
3
4
5
6
7
func (s *PublicBlockChainAPI) 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
 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`
 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
1
2
3
4
- description: `Hex representation of a uint`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint`
- type: string
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

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

1
2
3
4
5
6
7
func (s *PublicBlockChainAPI) 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
1
2
3
4
5
6
7
8
- items: 

        - type: string


- maxItems: `4`
- minItems: `4`
- type: array
 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

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_getWork", "params": []}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_getWork", "params": []}'
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
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
1
2
3
4
- description: `Hex representation of a uint64`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint64`
- type: string
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

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

1
2
3
func (api *PublicEthereumAPI) 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 logs that match the given filter criteria.

Params (1)

Parameters must be given by position.

1: crit FilterCriteria

  • Required: ✓ Yes
 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
 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
1
2
3
- description: `Subscription identifier`
- title: `subscriptionID`
- type: string
1
2
3
4
5
6
7
{
    "description": "Subscription identifier",
    "title": "subscriptionID",
    "type": [
        "string"
    ]
}

Client Method Invocation Examples

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
func (api *PublicFilterAPI) 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 logs 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 {
                    notifier.Notify(rpcSub.ID, &log)
                }
            case <-rpcSub.Err():
                logsSub.Unsubscribe()
                return
            case <-notifier.Closed():
                logsSub.Unsubscribe()
                return
            }
        }
    }()
    return rpcSub, nil
}
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

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

1
2
3
func (api *PublicMinerAPI) 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.

https://eth.wiki/json-rpc/API#eth_newblockfilter

Params (0)

None

Result

rpc.ID

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

Client Method Invocation Examples

1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_newBlockFilter", "params": []}'
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
func (api *PublicFilterAPI) NewBlockFilter() rpc.ID {
    var (
        headers     = make(chan *types.Header)
        headerSub   = api.events.SubscribeNewHeads(headers)
    )
    api.filtersMu.Lock()
    api.filters[headerSub.ID] = &filter{typ: BlocksSubscription, deadline: time.NewTimer(api.timeout), hashes: make([ // 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.
    //
    // https://eth.wiki/json-rpc/API#eth_newblockfilter
    ]common.Hash, 0), s: headerSub}
    api.filtersMu.Unlock()
    go func() {
        for {
            select {
            case h := <-headers:
                api.filtersMu.Lock()
                if f, found := api.filters[headerSub.ID]; found {
                    f.hashes = append(f.hashes, h.Hash())
                }
                api.filtersMu.Unlock()
            case <-headerSub.Err():
                api.filtersMu.Lock()
                delete(api.filters, headerSub.ID)
                api.filtersMu.Unlock()
                return
            }
        }
    }()
    return headerSub.ID
}
View on GitHub →


eth_newFilter

NewFilter creates a new filter and returns the filter id. It can be used to retrieve logs when the state changes. This method cannot be used to fetch logs that are already stored in the state.

Default criteria for the from and to block are “latest”. Using “latest” as block number will return logs for mined blocks. Using “pending” as block number returns logs for not yet mined (pending) blocks. In case logs are removed (chain reorg) previously returned logs are returned again but with the removed property set to true.

In case “fromBlock” > “toBlock” an error is returned.

https://eth.wiki/json-rpc/API#eth_newfilter

Params (1)

Parameters must be given by position.

1: crit FilterCriteria

  • Required: ✓ Yes
 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
 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.ID

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

Client Method Invocation Examples

1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_newFilter", "params": [<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
34
35
36
37
38
39
40
41
func (api *PublicFilterAPI) NewFilter(crit FilterCriteria) (rpc.ID, error) {
    logs := make(chan [ // NewFilter creates a new filter and returns the filter id. It can be
    // used to retrieve logs when the state changes. This method cannot be
    // used to fetch logs that are already stored in the state.
    //
    // Default criteria for the from and to block are "latest".
    // Using "latest" as block number will return logs for mined blocks.
    // Using "pending" as block number returns logs for not yet mined (pending) blocks.
    // In case logs are removed (chain reorg) previously returned logs are returned
    // again but with the removed property set to true.
    //
    // In case "fromBlock" > "toBlock" an error is returned.
    //
    // https://eth.wiki/json-rpc/API#eth_newfilter
    ]*types.Log)
    logsSub, err := api.events.SubscribeLogs(ethereum.FilterQuery(crit), logs)
    if err != nil {
        return "", err
    }
    api.filtersMu.Lock()
    api.filters[logsSub.ID] = &filter{typ: LogsSubscription, crit: crit, deadline: time.NewTimer(api.timeout), logs: make([]*types.Log, 0), s: logsSub}
    api.filtersMu.Unlock()
    go func() {
        for {
            select {
            case l := <-logs:
                api.filtersMu.Lock()
                if f, found := api.filters[logsSub.ID]; found {
                    f.logs = append(f.logs, l...)
                }
                api.filtersMu.Unlock()
            case <-logsSub.Err():
                api.filtersMu.Lock()
                delete(api.filters, logsSub.ID)
                api.filtersMu.Unlock()
                return
            }
        }
    }()
    return logsSub.ID, nil
}
View on GitHub →


eth_newHeads

NewHeads send a notification each time a new (header) block is appended to the chain.

Params (0)

None

Result

*rpc.Subscription

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

Client Method Invocation Examples

1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_subscribe", "params": ["newHeads"]}'
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 (api *PublicFilterAPI) NewHeads(ctx context.Context) (*rpc.Subscription, error) {
    notifier, supported := rpc.NotifierFromContext(ctx)
    if !supported {
        return &rpc.Subscription{}, rpc.ErrNotificationsUnsupported
    }
    rpcSub := notifier.CreateSubscription()
    go func() {
        headers := make(chan *types.Header)
        headersSub := api.events.SubscribeNewHeads(headers)
        for {
            select {
            case h := <-headers:
                notifier.Notify(rpcSub.ID, h)
            case <-rpcSub.Err():
                headersSub.Unsubscribe()
                return
            case <-notifier.Closed():
                headersSub.Unsubscribe()
                return
            }
        }
    }()
    return rpcSub, nil
}// NewHeads send a notification each time a new (header) block is appended to the chain.
View on GitHub →


eth_newPendingTransactionFilter

NewPendingTransactionFilter creates a filter that fetches pending transaction hashes as transactions enter the pending state.

It is part of the filter package because this filter can be used through the eth_getFilterChanges polling method that is also used for log filters.

https://eth.wiki/json-rpc/API#eth_newpendingtransactionfilter

Params (0)

None

Result

rpc.ID

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

Client Method Invocation Examples

1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_newPendingTransactionFilter", "params": []}'
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 (api *PublicFilterAPI) NewPendingTransactionFilter() rpc.ID {
    var (
        pendingTxs  = make(chan [ // NewPendingTransactionFilter creates a filter that fetches pending transaction hashes
        // as transactions enter the pending state.
        //
        // It is part of the filter package because this filter can be used through the
        // `eth_getFilterChanges` polling method that is also used for log filters.
        //
        // https://eth.wiki/json-rpc/API#eth_newpendingtransactionfilter
        ]common.Hash)
        pendingTxSub    = api.events.SubscribePendingTxs(pendingTxs)
    )
    api.filtersMu.Lock()
    api.filters[pendingTxSub.ID] = &filter{typ: PendingTransactionsSubscription, deadline: time.NewTimer(api.timeout), hashes: make([]common.Hash, 0), s: pendingTxSub}
    api.filtersMu.Unlock()
    go func() {
        for {
            select {
            case ph := <-pendingTxs:
                api.filtersMu.Lock()
                if f, found := api.filters[pendingTxSub.ID]; found {
                    f.hashes = append(f.hashes, ph...)
                }
                api.filtersMu.Unlock()
            case <-pendingTxSub.Err():
                api.filtersMu.Lock()
                delete(api.filters, pendingTxSub.ID)
                api.filtersMu.Unlock()
                return
            }
        }
    }()
    return pendingTxSub.ID
}
View on GitHub →


eth_newPendingTransactions

NewPendingTransactions creates a subscription that is triggered each time a transaction enters the transaction pool and was signed from one of the transactions this nodes manages.

Params (0)

None

Result

*rpc.Subscription

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

Client Method Invocation Examples

1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_subscribe", "params": ["newPendingTransactions"]}'
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
func (api *PublicFilterAPI) NewPendingTransactions(ctx context.Context) (*rpc.Subscription, error) {
    notifier, supported := rpc.NotifierFromContext(ctx)
    if !supported {
        return &rpc.Subscription{}, rpc.ErrNotificationsUnsupported
    }
    rpcSub := notifier.CreateSubscription()
    go func() {
        txHashes := make(chan [ // NewPendingTransactions creates a subscription that is triggered each time a transaction
        // enters the transaction pool and was signed from one of the transactions this nodes manages.
        ]common.Hash, 128)
        pendingTxSub := api.events.SubscribePendingTxs(txHashes)
        for {
            select {
            case hashes := <-txHashes:
                for _, h := range hashes {
                    notifier.Notify(rpcSub.ID, h)
                }
            case <-rpcSub.Err():
                pendingTxSub.Unsubscribe()
                return
            case <-notifier.Closed():
                pendingTxSub.Unsubscribe()
                return
            }
        }
    }()
    return rpcSub, nil
}
View on GitHub →


eth_newSideBlockFilter

NewSideBlockFilter creates a filter that fetches blocks that are imported into the chain with a non-canonical status. It is part of the filter package since polling goes with eth_getFilterChanges.

Params (0)

None

Result

rpc.ID

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

Client Method Invocation Examples

1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_newSideBlockFilter", "params": []}'
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 *PublicFilterAPI) NewSideBlockFilter() rpc.ID {
    var (
        headers     = make(chan *types.Header)
        headerSub   = api.events.SubscribeNewSideHeads(headers)
    )
    api.filtersMu.Lock()
    api.filters[headerSub.ID] = &filter{typ: SideBlocksSubscription, deadline: time.NewTimer(api.timeout), hashes: make([ // NewSideBlockFilter creates a filter that fetches blocks that are imported into the chain with a non-canonical status.
    // It is part of the filter package since polling goes with eth_getFilterChanges.
    ]common.Hash, 0), s: headerSub}
    api.filtersMu.Unlock()
    go func() {
        for {
            select {
            case h := <-headers:
                api.filtersMu.Lock()
                if f, found := api.filters[headerSub.ID]; found {
                    f.hashes = append(f.hashes, h.Hash())
                }
                api.filtersMu.Unlock()
            case <-headerSub.Err():
                api.filtersMu.Lock()
                delete(api.filters, headerSub.ID)
                api.filtersMu.Unlock()
                return
            }
        }
    }()
    return headerSub.ID
}
View on GitHub →


eth_newSideHeads

NewSideHeads send a notification each time a new non-canonical (header) block is written to the database.

Params (0)

None

Result

*rpc.Subscription

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

Client Method Invocation Examples

1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_subscribe", "params": ["newSideHeads"]}'
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 (api *PublicFilterAPI) NewSideHeads(ctx context.Context) (*rpc.Subscription, error) {
    notifier, supported := rpc.NotifierFromContext(ctx)
    if !supported {
        return &rpc.Subscription{}, rpc.ErrNotificationsUnsupported
    }
    rpcSub := notifier.CreateSubscription()
    go func() {
        headers := make(chan *types.Header)
        headersSub := api.events.SubscribeNewSideHeads(headers)
        for {
            select {
            case h := <-headers:
                notifier.Notify(rpcSub.ID, h)
            case <-rpcSub.Err():
                headersSub.Unsubscribe()
                return
            case <-notifier.Closed():
                headersSub.Unsubscribe()
                return
            }
        }
    }()
    return rpcSub, nil
}// NewSideHeads send a notification each time a new non-canonical (header) block is written to the database.
View on GitHub →


eth_pendingTransactions

PendingTransactions returns the transactions that are in the transaction pool and have a from address that is one of the accounts this node manages.

Params (0)

None

Result

RPCTransaction []*RPCTransaction

  • Required: ✓ Yes
  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
- items: 

        - 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`

            - 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`


        - type: object


- type: array
  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
{
    "items": [
        {
            "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"
                },
                "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"
                }
            },
            "type": [
                "object"
            ]
        }
    ],
    "type": [
        "array"
    ]
}

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_pendingTransactions", "params": []}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_pendingTransactions", "params": []}'
1
eth.pendingTransactions();
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 (s *PublicTransactionPoolAPI) PendingTransactions() ([ // PendingTransactions returns the transactions that are in the transaction pool
// and have a from address that is one of the accounts this node manages.
]*RPCTransaction, error) {
    pending, err := s.b.GetPoolTransactions()
    if err != nil {
        return nil, err
    }
    accounts := make(map[common.Address]struct{})
    for _, wallet := range s.b.AccountManager().Wallets() {
        for _, account := range wallet.Accounts() {
            accounts[account.Address] = struct{}{}
        }
    }
    transactions := make([]*RPCTransaction, 0, len(pending))
    for _, tx := range pending {
        from, _ := types.Sender(s.signer, tx)
        if _, exists := accounts[from]; exists {
            transactions = append(transactions, newRPCPendingTransaction(tx))
        }
    }
    return transactions, nil
}
View on GitHub →


eth_resend

Resend accepts an existing transaction and a new gas price and limit. It will remove the given transaction from the pool and reinsert it with the new gas price and limit.

Params (3)

Parameters must be given by position.

1: sendArgs SendTxArgs

  • Required: ✓ Yes
 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
- 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`

    - 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
 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
{
    "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"
        },
        "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: gasPrice *hexutil.Big

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

3: gasLimit *hexutil.Uint64

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

Result

common.Hash

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
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"
    ]
}

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_resend", "params": [<sendArgs>, <gasPrice>, <gasLimit>]}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_resend", "params": [<sendArgs>, <gasPrice>, <gasLimit>]}'
1
eth.resend(sendArgs,gasPrice,gasLimit);
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
func (s *PublicTransactionPoolAPI) Resend(ctx context.Context, sendArgs SendTxArgs, gasPrice *hexutil.Big, gasLimit *hexutil.Uint64) (common.Hash, error) {
    if sendArgs.Nonce == nil {
        return common.Hash{}, fmt.Errorf("missing transaction nonce in transaction spec")
    }
    if err := sendArgs.setDefaults(ctx, s.b); err != nil {
        return common.Hash{}, err
    }
    matchTx := sendArgs.toTransaction()
    var price = matchTx.GasPrice()
    if gasPrice != nil {
        price = gasPrice.ToInt()
    }
    var gas = matchTx.Gas()
    if gasLimit != nil {
        gas = uint64(*gasLimit)
    }
    if err := checkTxFee(price, gas, s.b.RPCTxFeeCap()); err != nil {
        return common.Hash{}, err
    }
    pending, err := s.b.GetPoolTransactions()
    if err != nil {
        return common.Hash{}, err
    }
    for _, p := // Resend accepts an existing transaction and a new gas price and limit. It will remove
    // the given transaction from the pool and reinsert it with the new gas price and limit.
    // Before replacing the old transaction, ensure the _new_ transaction fee is reasonable.
    range pending {
        wantSigHash := s.signer.Hash(matchTx)
        pFrom, err := types.Sender(s.signer, p)
        if err == nil && pFrom == sendArgs.From && s.signer.Hash(p) == wantSigHash {
            if gasPrice != nil && (*big.Int)(gasPrice).Sign() != 0 {
                sendArgs.GasPrice = gasPrice
            }
            if gasLimit != nil && *gasLimit != 0 {
                sendArgs.Gas = gasLimit
            }
            signedTx, err := s.sign(sendArgs.From, sendArgs.toTransaction())
            if err != nil {
                return common.Hash{}, err
            }
            if err = s.b.SendTx(ctx, signedTx); err != nil {
                return common.Hash{}, err
            }
            return signedTx.Hash(), nil
        }
    }
    return common.Hash{}, fmt.Errorf("transaction %#x not found", matchTx.Hash())
}
View on GitHub →


eth_sendRawTransaction

SendRawTransaction will add the signed transaction to the transaction pool. The sender is responsible for signing the transaction and using the correct nonce.

Params (1)

Parameters must be given by position.

1: input hexutil.Bytes

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

Result

common.Hash

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
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"
    ]
}

Client Method Invocation Examples

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

1
2
3
4
5
6
7
8
func (s *PublicTransactionPoolAPI) SendRawTransaction(ctx context.Context, input hexutil.Bytes) (common.Hash, error) {
    tx := new(types.Transaction)
    if err := tx.UnmarshalBinary(input); err != nil {
        return common.Hash{}, err
    }
    return SubmitTransaction(ctx, s.b, tx)
}// SendRawTransaction will add the signed transaction to the transaction pool.
// The sender is responsible for signing the transaction and using the correct nonce.
View on GitHub →


eth_sendTransaction

SendTransaction creates a transaction for the given argument, sign it and submit it to the transaction pool.

Params (1)

Parameters must be given by position.

1: args SendTxArgs

  • Required: ✓ Yes
 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
- 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`

    - 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
 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
{
    "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"
        },
        "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

common.Hash

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
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"
    ]
}

Client Method Invocation Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
func (s *PublicTransactionPoolAPI) SendTransaction(ctx context.Context, args SendTxArgs) (common.Hash, error) {
    account := accounts.Account{Address: args.From}
    wallet, err := s.b.AccountManager().Find(account)
    if err != nil {
        return common.Hash{}, err
    }
    if args.Nonce == nil {
        s.nonceLock.LockAddr(args.From)
        defer s.nonceLock.UnlockAddr(args.From)
    }
    if err := args.setDefaults(ctx, s.b); err != nil {
        return common.Hash{}, err
    }
    tx := args.toTransaction()
    signed, err := wallet.SignTx(account, tx, s.b.ChainConfig().GetChainID())
    if err != nil {
        return common.Hash{}, err
    }
    return SubmitTransaction(ctx, s.b, signed)
}// SendTransaction creates a transaction for the given argument, sign it and submit it to the
// transaction pool.
View on GitHub →


eth_sign

Sign calculates an ECDSA signature for: keccack256(“\x19Ethereum Signed Message:\n” + len(message) + message).

Note, the produced signature conforms to the secp256k1 curve R, S and V values, where the V value will be 27 or 28 for legacy reasons.

The account associated with addr must be unlocked.

https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign

Params (2)

Parameters must be given by position.

1: addr common.Address

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of a Keccak 256 hash POINTER`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
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: data hexutil.Bytes

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

Result

hexutil.Bytes

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of some bytes`
- pattern: `^0x([a-fA-F\d])+$`
- title: `dataWord`
- type: string
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

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
func (s *PublicTransactionPoolAPI) Sign(addr common.Address, data hexutil.Bytes) (hexutil.Bytes, error) {
    account := accounts.Account{Address: addr}
    wallet, err := s.b.AccountManager().Find(account)
    if err != nil {
        return nil, err
    }
    signature, err := wallet.SignText(account, data)
    if err == nil {
        signature[64] += 27
    }
    return signature, err
}// Sign calculates an ECDSA signature for:
// keccack256("\x19Ethereum Signed Message:\n" + len(message) + message).
//
// Note, the produced signature conforms to the secp256k1 curve R, S and V values,
// where the V value will be 27 or 28 for legacy reasons.
//
// The account associated with addr must be unlocked.
//
// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign
View on GitHub →


eth_signTransaction

SignTransaction will sign the given transaction with the from account. The node needs to have the private key of the account corresponding with the given from address and it needs to be unlocked.

Params (1)

Parameters must be given by position.

1: args SendTxArgs

  • Required: ✓ Yes
 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
- 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`

    - 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
 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
{
    "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"
        },
        "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
 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
 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

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "eth_signTransaction", "params": [<args>]}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_signTransaction", "params": [<args>]}'
1
eth.signTransaction(args);
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
func (s *PublicTransactionPoolAPI) SignTransaction(ctx context.Context, args SendTxArgs) (*SignTransactionResult, error) {
    if args.Gas == nil {
        return nil, fmt.Errorf("gas not specified")
    }
    if args.GasPrice == nil {
        return nil, fmt.Errorf("gasPrice not specified")
    }
    if args.Nonce == nil {
        return nil, fmt.Errorf("nonce not specified")
    }
    if err := args.setDefaults(ctx, s.b); err != nil {
        return nil, err
    }
    if err := checkTxFee(args.GasPrice.ToInt(), uint64(*args.Gas), s.b.RPCTxFeeCap()); err != nil {
        return nil, err
    }
    tx, err := s.sign(args.From, args.toTransaction())
    if err != nil {
        return nil, err
    }
    data, err := tx.MarshalBinary()
    if err != nil {
        return nil, err
    }
    return &SignTransactionResult{data, tx}, nil
}// SignTransaction will sign the given transaction with the from account.
// The node needs to have the private key of the account corresponding with
// the given from address and it needs to be unlocked.
View on GitHub →


eth_submitHashRate

SubmitHashrate can be used for remote miners to submit their hash rate. This enables the node to report the combined hash rate of all miners which submit work through this node.

It accepts the miner hash rate and an identifier which must be unique between nodes.

Params (2)

Parameters must be given by position.

1: rate hexutil.Uint64

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

2: id common.Hash

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
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

bool

  • Required: ✓ Yes

Client Method Invocation Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
func (api *API) SubmitHashRate(rate hexutil.Uint64, id common.Hash) bool {
    if api.ethash.remote == nil {
        return false
    }
    var done = make(chan struct{}, 1)
    select {
    case api.ethash.remote.submitRateCh <- &hashrate{done: done, rate: uint64(rate), id: id}:
    case <-api.ethash.remote.exitCh:
        return false
    }
    <-done
    return true
}// SubmitHashrate can be used for remote miners to submit their hash rate.
// This enables the node to report the combined hash rate of all miners
// which submit work through this node.
//
// It accepts the miner hash rate and an identifier which must be unique
// between nodes.
View on GitHub →


eth_submitWork

SubmitWork can be used by external miner to submit their POW solution. It returns an indication if the work was accepted. Note either an invalid solution, a stale work a non-existent work will return false.

Params (3)

Parameters must be given by position.

1: nonce types.BlockNonce

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of the integer`
- pattern: `^0x[a-fA-F0-9]+$`
- title: `integer`
- type: string
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: hash common.Hash

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
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"
    ]
}

3: digest common.Hash

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of a Keccak 256 hash`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
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

bool

  • Required: ✓ Yes

Client Method Invocation Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
func (api *API) SubmitWork(nonce types.BlockNonce, hash, digest common.Hash) bool {
    if api.ethash.remote == nil {
        return false
    }
    var errc = make(chan error, 1)
    select {
    case api.ethash.remote.submitWorkCh <- &mineResult{nonce: nonce, mixDigest: digest, hash: hash, errc: errc}:
    case <-api.ethash.remote.exitCh:
        return false
    }
    err := <-errc
    return err == nil
}// SubmitWork can be used by external miner to submit their POW solution.
// It returns an indication if the work was accepted.
// Note either an invalid solution, a stale work a non-existent work will return false.
View on GitHub →


eth_subscribe

Subscribe creates a subscription to an event channel. Subscriptions are not available over HTTP; they are only available over WS, IPC, and Process connections.

Params (2)

Parameters must be given by position.

1: subscriptionName RPCEthSubscriptionParamsName

  • Required: ✓ Yes
 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
- oneOf: 

        - description: `Fires a notification each time a new header is appended to the chain, including chain reorganizations.`
        - enum: newHeads
        - type: string


        - description: `Fires a notification each time a new header is appended to the non-canonical (side) chain, including chain reorganizations.`
        - enum: newSideHeads
        - type: string


        - description: `Returns logs that are included in new imported blocks and match the given filter criteria.`
        - enum: logs
        - type: string


        - description: `Returns the hash for all transactions that are added to the pending state and are signed with a key that is available in the node.`
        - enum: newPendingTransactions
        - type: string


        - description: `Indicates when the node starts or stops synchronizing. The result can either be a boolean indicating that the synchronization has started (true), finished (false) or an object with various progress indicators.`
        - enum: syncing
        - type: string


- title: `subscriptionName`
 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
{
    "oneOf": [
        {
            "description": "Fires a notification each time a new header is appended to the chain, including chain reorganizations.",
            "enum": [
                "newHeads"
            ],
            "type": [
                "string"
            ]
        },
        {
            "description": "Fires a notification each time a new header is appended to the non-canonical (side) chain, including chain reorganizations.",
            "enum": [
                "newSideHeads"
            ],
            "type": [
                "string"
            ]
        },
        {
            "description": "Returns logs that are included in new imported blocks and match the given filter criteria.",
            "enum": [
                "logs"
            ],
            "type": [
                "string"
            ]
        },
        {
            "description": "Returns the hash for all transactions that are added to the pending state and are signed with a key that is available in the node.",
            "enum": [
                "newPendingTransactions"
            ],
            "type": [
                "string"
            ]
        },
        {
            "description": "Indicates when the node starts or stops synchronizing. The result can either be a boolean indicating that the synchronization has started (true), finished (false) or an object with various progress indicators.",
            "enum": [
                "syncing"
            ],
            "type": [
                "string"
            ]
        }
    ],
    "title": "subscriptionName"
}

2: subscriptionOptions interface{}

  • Required: No

Result

subscriptionID rpc.ID

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

Client Method Invocation Examples

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

1
2
3
4
func (sub *RPCEthSubscription) Subscribe(subscriptionName RPCEthSubscriptionParamsName, subscriptionOptions interface{}) (subscriptionID rpc.ID, err error) {
    return
}// Subscribe creates a subscription to an event channel.
// Subscriptions are not available over HTTP; they are only available over WS, IPC, and Process connections.
View on GitHub →


eth_syncing

Syncing provides information when this nodes starts synchronising with the Ethereum network and when it’s finished.

Params (0)

None

Result

*rpc.Subscription

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

Client Method Invocation Examples

1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "eth_subscribe", "params": ["syncing"]}'
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 (api *PublicDownloaderAPI) Syncing(ctx context.Context) (*rpc.Subscription, error) {
    notifier, supported := rpc.NotifierFromContext(ctx)
    if !supported {
        return &rpc.Subscription{}, rpc.ErrNotificationsUnsupported
    }
    rpcSub := notifier.CreateSubscription()
    go func() {
        statuses := make(chan interface{})
        sub := api.SubscribeSyncStatus(statuses)
        for {
            select {
            case status := <-statuses:
                notifier.Notify(rpcSub.ID, status)
            case <-rpcSub.Err():
                sub.Unsubscribe()
                return
            case <-notifier.Closed():
                sub.Unsubscribe()
                return
            }
        }
    }()
    return rpcSub, nil
}// Syncing provides information when this nodes starts synchronising with the Ethereum network and when it's finished.
View on GitHub →


eth_syncing

Syncing returns false in case the node is currently not syncing with the network. It can be up to date or has not yet received the latest block headers from its pears. In case it is synchronizing: - startingBlock: block number this node started to synchronise from - currentBlock: block number this node is currently importing - highestBlock: block number of the highest block header this node has received from peers - pulledStates: number of state entries processed until now - knownStates: number of known state entries that still need to be pulled

Params (0)

None

Result

interface interface{}

  • Required: ✓ Yes

Client Method Invocation Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
func (s *PublicEthereumAPI) Syncing() (interface{}, error) {
    progress := s.b.Downloader().Progress()
    if progress.CurrentBlock >= progress.HighestBlock {
        return false, nil
    }
    return map // Syncing returns false in case the node is currently not syncing with the network. It can be up to date or has not
    // yet received the latest block headers from its pears. In case it is synchronizing:
    // - startingBlock: block number this node started to synchronise from
    // - currentBlock:  block number this node is currently importing
    // - highestBlock:  block number of the highest block header this node has received from peers
    // - pulledStates:  number of state entries processed until now
    // - knownStates:   number of known state entries that still need to be pulled
    [string]interface{}{"startingBlock": hexutil.Uint64(progress.StartingBlock), "currentBlock": hexutil.Uint64(progress.CurrentBlock), "highestBlock": hexutil.Uint64(progress.HighestBlock), "pulledStates": hexutil.Uint64(progress.PulledStates), "knownStates": hexutil.Uint64(progress.KnownStates)}, nil
}
View on GitHub →


eth_uninstallFilter

UninstallFilter removes the filter with the given filter id.

https://eth.wiki/json-rpc/API#eth_uninstallfilter

Params (1)

Parameters must be given by position.

1: id rpc.ID

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

Result

bool

  • Required: ✓ Yes

Client Method Invocation Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
func (api *PublicFilterAPI) UninstallFilter(id rpc.ID) bool {
    api.filtersMu.Lock()
    f, found := api.filters[id]
    if found {
        delete(api.filters, id)
    }
    api.filtersMu.Unlock()
    if found {
        f.s.Unsubscribe()
    }
    return found
}// UninstallFilter removes the filter with the given filter id.
//
// https://eth.wiki/json-rpc/API#eth_uninstallfilter
View on GitHub →


eth_unsubscribe

Unsubscribe terminates an existing subscription by ID.

Params (1)

Parameters must be given by position.

1: id rpc.ID

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

Result

None

Client Method Invocation Examples

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

1
2
3
func (sub *RPCEthSubscription) Unsubscribe(id rpc.ID) error {
    return nil
}// Unsubscribe terminates an existing subscription by ID.
View on GitHub →



Last update: 2022-06-28