我想了解txpool.getContent()的响应结构。
我从我的geth节点得到了下面的响应。
> 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] },
.........因此,我不知道数字的含义,例如,在挂起的对象的第一行中的'11‘,包括上面的响应。
有人你能告诉我什么意思吗。
如果有人知道,请告诉我txpool.getContent()的确切响应结构。
我已经读过本文件了。
但是,它没有提供详细资料,例如上述数字的含义。
同时也请告诉我txpool.getInspection()回应的细节。
我的开发环境如下:
发布于 2020-03-18 11:22:57
数字'11‘是帐户'0x0000000186c96Ab17A967d7A3033db82efcA587B’的nonce的十进制值。
下面的示例取自下面的链接: 0x326 = (806) 示例Tx池获取内容
{
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: {............................................} }如果您查看ethereum的源代码,您会发现排队/挂起的列表txs是下面定义的映射的列表。
// 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
}其中索引包含'11‘在您的例子,这是帐户的现在。
Ethereum中的txpool中有两种类型的事务列表。一个是待定列表,它是准备列入下一个未来块的事务列表,另一个是排队列表,该列表将在稍后执行,并将在未来块中包括在待定列表中。
txpool.getContent()返回两个列表,提供帐户到事务的映射。
另一方面,txpool.getInspection()返回txpool.getContent()相同结果的文本摘要。
希望你明白我的意思。
发布于 2020-03-18 06:44:12
因此,我不知道数字的含义,例如,在挂起的对象的第一行中的'11‘,包括上面的响应。
不要使用console.log(response),而是使用console.log(JSON.parse(response, null, 4))。
但是,它没有提供详细资料,例如上述数字的含义。
是的: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.
每个源地址(即帐户)映射到一批预定的事务,每个事务都作为一个nonce提供,它映射到事务的实际数据(您当前看到的是[Object],因为您已经打印了响应而没有JSON.parse)。因此,简而言之,这些数字中的每一个都是映射到它的事务中使用的nonce。
https://ethereum.stackexchange.com/questions/80659
复制相似问题