2

I'd like to understand the structure of response for txpool.getContent().

I got a following response from my geth node.

> pending: {
    '0x0000000186c96Ab17A967d7A3033db82efcA587B': { '11': [Object] },
    '0x00000004888f25bb2a792e78D5a6dF392d59e140': { '39': [Object] },
    '0x000000057c695b6Af389Ff5b7542c7e01333981A': { '13': [Object] },
    '0x000000084115EdEB2c9484b490F7AC89F8980E5F': { '12': [Object] },
    '0x000000086aD594b50486A68246D506E5DE24EBD8': {
      '12087': [Object],
      '12088': [Object],
      '12089': [Object],
      '12090': [Object],
      '12091': [Object],
      '12092': [Object],
      '12093': [Object],
      '12094': [Object],
      '12095': [Object],
      '12096': [Object],
      '12097': [Object],
      '12098': [Object],
      '12099': [Object],
      '12100': [Object],
      '12101': [Object],
      '12102': [Object]
    },
    '0x0000000A453D2De5Dd31Be7Bce57D5550a9CF964': { '16': [Object] },
    '0x0000000Ae22EDb6fa815aBF4F32E4d4c3CD4944A': { '11': [Object] },
    '0x0000000Ba1365f06809Ebc4A9086913696810268': { '19': [Object] },
    '0x0000000FA550De25e3AEBE8CB0f06a803CEE8f81': { '16': [Object] },
    .........

So I don't know the meaning of the number, for example '11' in first line of pending object which is included above response.

Someone, could you tell me the meaning.

And If anyone knows, please tell me exact structure of response for txpool.getContent().

I already have read this document.

However, it does not provide details such as the meaning of the number mentioned above.

And please also tell me the details of txpool.getInspection() response.

My development environment is as follows:

  • IDE: IntelliJ(2019.3.3)
  • node.js: ver 13.6
  • web3.js: ver 2.0.0-alpha.1
  • web3-eth-txpool: 1.0.0-beta.55
  • geth: ver 1.9.11-stable
0

The number '11' is the decimal value of nonce of the account '0x0000000186c96Ab17A967d7A3033db82efcA587B'.

The below example has been taken from the link below: 0x326 = (806) decimal Example Tx Pool Get Content

{
pending: {
    0x0216d5032f356960cd3749c31ab34eeff21b3395: {
    806: [{
        blockHash: "",
        blockNumber: null,
        from: "0x0216d5032f356960cd3749c31ab34eeff21b3395",
        gas: "0x5208",
        gasPrice: "0xba43b7400",
        hash: "0xaf953a2d01f55cfe080c0c94150a60105e8ac3d51153058a1f03dd239dd08586",
        input: "0x",
        nonce: "0x326",
        to: "0x7f69a91a3cf4be60020fb58b893b7cbb65376db8",
        transactionIndex: null,
        value: "0x19a99f0cf456000"
    }]
    }
},
queued: {............................................} }

If you go through the source code of ethereum, you will find that the queued/pending list txs are list of a map which definition has been given below.

// txList is a "list" of transactions belonging to an account, sorted by account
// nonce. The same type can be used both for storing contiguous transactions for
// the executable/pending queue; and for storing gapped transactions for the non-
// executable/future queue, with minor behavioral changes.
type txList struct {
     strict bool         // Whether nonces are strictly continuous or not
     txs    *txSortedMap // Heap indexed sorted hash map of the transactions

     costcap *big.Int // Price of the highest costing transaction (reset only if exceeds balance)
     gascap  uint64   // Gas limit of the highest spending transaction (reset only if exceeds block limit)
}
// txSortedMap is a nonce->transaction hash map with a heap based index to allow
// iterating over the contents in a nonce-incrementing way.
type txSortedMap struct {
      items map[uint64]*types.Transaction // Hash map storing the transaction data
      index *nonceHeap                    // Heap of nonces of all the stored 
      //transactions (non-strict mode)
      cache types.Transactions            // Cache of the transactions already sorted
}

Code Snippet for Understanding

Where index contains '11' in your example which is the nonce of the account.

There are two types of transaction list in txpool in Ethereum. One is Pending List which is the list of transactions ready to be included in the next future blocks and another one is Queued List which will be executed later and will be included in the Pending List in future to be included in future blocks.

txpool.getContent() returns the two lists providing the mapping of account to transaction.

On the other hand, txpool.getInspection() returns the textual summary of the same result of txpool.getContent().

Tx Pool Get Inspection

Hope you have got the point.

| improve this answer | |
  • The number is nonce. OK. Thank you. – Pierogi Mar 18 at 23:53
0

So I don't know the meaning of the number, for example '11' in first line of pending object which is included above response.

Instead of console.log(response), use console.log(JSON.parse(response, null, 4)).


However, it does not provide details such as the meaning of the number mentioned above.

Yes it does: Each of these fields are associative arrays, in which each entry maps an origin-address to a batch of scheduled transactions. These batches themselves are maps associating nonces with actual transactions.

Each origin-address (i.e., account) is mapped to a batch of scheduled transactions, and each transaction is provided as a nonce which is mapped to the actual data of the transaction (what you are currently seeing as [Object], because you have printed the response without JSON.parseing it). So in short, each one of these numbers is the nonce which was used in the transaction mapped to it.

| improve this answer | |
  • I see. Thank you. – Pierogi Mar 18 at 23:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.