Skip to content

Txpool

Entity Version
Source 1.11.23-unstable/generated-at:2021-04-30T19:24:24+03:00
OpenRPC 1.2.6

txpool_content

Content returns the transactions contained within the transaction pool.

Params (0)

None

Result

mapstringmapstringmapstringRPCTransaction map[string]map[string]map[string]*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
113
114
115
116
117
118
119
120
121
122
- patternProperties: 
    - .*: 
        - patternProperties: 
            - .*: 
                - patternProperties: 
                    - .*: 
                        - 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: `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
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
{
    "patternProperties": {
        ".*": {
            "patternProperties": {
                ".*": {
                    "patternProperties": {
                        ".*": {
                            "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": "object"
                }
            },
            "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": "txpool_content", "params": []}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "txpool_content", "params": []}'
1
txpool.content();
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
func (s *PublicTxPoolAPI) Content() map // Content returns the transactions contained within the transaction pool.
[string]map[string]map[string]*RPCTransaction {
    content := map[string]map[string]map[string]*RPCTransaction{"pending": make(map[string]map[string]*RPCTransaction), "queued": make(map[string]map[string]*RPCTransaction)}
    pending, queue := s.b.TxPoolContent()
    for account, txs := range pending {
        dump := make(map[string]*RPCTransaction)
        for _, tx := range txs {
            dump[fmt.Sprintf("%d", tx.Nonce())] = newRPCPendingTransaction(tx)
        }
        content["pending"][account.Hex()] = dump
    }
    for account, txs := range queue {
        dump := make(map[string]*RPCTransaction)
        for _, tx := range txs {
            dump[fmt.Sprintf("%d", tx.Nonce())] = newRPCPendingTransaction(tx)
        }
        content["queued"][account.Hex()] = dump
    }
    return content
}
View on GitHub →


txpool_inspect

Inspect retrieves the content of the transaction pool and flattens it into an easily inspectable list.

Params (0)

None

Result

mapstringmapstringmapstringstring map[string]map[string]map[string]string

  • Required: ✓ Yes
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
- patternProperties: 
    - .*: 
        - patternProperties: 
            - .*: 
                - patternProperties: 
                    - .*: 
                        - 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
{
    "patternProperties": {
        ".*": {
            "patternProperties": {
                ".*": {
                    "patternProperties": {
                        ".*": {
                            "type": "string"
                        }
                    },
                    "type": "object"
                }
            },
            "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": "txpool_inspect", "params": []}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "txpool_inspect", "params": []}'
1
txpool.inspect();
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 *PublicTxPoolAPI) Inspect() map // Inspect retrieves the content of the transaction pool and flattens it into an
// easily inspectable list.
[string]map[string]map[string]string {
    content := map[string]map[string]map[string]string{"pending": make(map[string]map[string]string), "queued": make(map[string]map[string]string)}
    pending, queue := s.b.TxPoolContent()
    var format = func(tx *types.Transaction) string {
        if to := tx.To(); to != nil {
            return fmt.Sprintf("%s: %v wei + %v gas × %v wei", tx.To().Hex(), tx.Value(), tx.Gas(), tx.GasPrice())
        }
        return fmt.Sprintf("contract creation: %v wei + %v gas × %v wei", tx.Value(), tx.Gas(), tx.GasPrice())
    }
    for account, txs := // Define a formatter to flatten a transaction into a string
    range pending {
        dump := make(map[string]string)
        for _, tx := range txs {
            dump[fmt.Sprintf("%d", tx.Nonce())] = format(tx)
        }
        content["pending"][account.Hex()] = dump
    }
    for account, txs := range queue {
        dump := make(map[string]string)
        for _, tx := range txs {
            dump[fmt.Sprintf("%d", tx.Nonce())] = format(tx)
        }
        content["queued"][account.Hex()] = dump
    }
    return content
}
View on GitHub →


txpool_status

Status returns the number of pending and queued transaction in the pool.

Params (0)

None

Result

mapstringhexutilUint map[string]hexutil.Uint

  • Required: ✓ Yes
1
2
3
4
5
6
7
8
9
- patternProperties: 
    - .*: 
        - description: `Hex representation of a uint`
        - pattern: `^0x([a-fA-F\d])+$`
        - title: `uint`
        - type: `string`


- type: object
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
{
    "patternProperties": {
        ".*": {
            "description": "Hex representation of a uint",
            "pattern": "^0x([a-fA-F\\d])+$",
            "title": "uint",
            "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": "txpool_status", "params": []}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "txpool_status", "params": []}'
1
txpool.status();
Source code

1
2
3
4
5
func (s *PublicTxPoolAPI) Status() map // Status returns the number of pending and queued transaction in the pool.
[string]hexutil.Uint {
    pending, queue := s.b.Stats()
    return map[string]hexutil.Uint{"pending": hexutil.Uint(pending), "queued": hexutil.Uint(queue)}
}
View on GitHub →



Last update: 2022-06-28