Parity

在 Parity 中,對 geth 的 txpool_content 的等效 RPC 呼叫是什麼?

  • September 1, 2020

geth中有幾個有用的txpool 查詢txpool_content和. 由於這些不是通用標準的一部分,因此 Parity 可能對同一機制有其他名稱。txpool_inspect``txpool_status

理想情況下,我會得到一個交易詳細資訊列表或為提供的帳戶待處理的雜湊值。雖然,據我所知,geth 沒有按帳戶過濾結果的選項。

我能找到的最接近的是parity_pendingTransactionsand parity_pendingTransactionsStats

parity_pendingTransactions與 geth’s 非常相似txpool_content,並且可以完成工作。


更新:由於我專門尋找從特定帳戶發送的交易,因此這種新方法效果更好:parity_localTransactions

它只返回本地生成的交易。請注意,它還列出了本地發送的已探勘交易,因此如果您只想要待處理的交易,則必須在之後使用狀態欄位將它們過濾掉。範例查詢/響應:

curl --data '{"method":"parity_localTransactions","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545
{
 "id": 1,
 "jsonrpc": "2.0",
 "result": {
   "0x09e64eb1ae32bb9ac415ce4ddb3dbad860af72d9377bb5f073c9628ab413c532": {
     "status": "mined",
     "transaction": {
       "from": "0x00a329c0648769a73afac7f9381e08fb43dbea72",
       "to": "0x00a289b43e1e4825dbedf2a78ba60a640634dc40",
       "value": "0xfffff",
       "blockHash": null,
       "blockNumber": null,
       "creates": null,
       "gas": "0xe57e0",
       "gasPrice": "0x2d20cff33",
       "hash": "0x09e64eb1ae32bb9ac415ce4ddb3dbad860af72d9377bb5f073c9628ab413c532",
       "input": "0x",
       "condition": {
         "block": 1
       },
       "networkId": null,
       "nonce": "0x0",
       "publicKey": "0x3fa8c08c65a83f6b4ea3e04e1cc70cbe3cd391499e3e05ab7dedf28aff9afc538200ff93e3f2b2cb5029f03c7ebee820d63a4c5a9541c83acebe293f54cacf0e",
       "raw": "0xf868808502d20cff33830e57e09400a289b43e1e4825dbedf2a78ba60a640634dc40830fffff801ca034c333b0b91cd832a3414d628e3fea29a00055cebf5ba59f7038c188404c0cf3a0524fd9b35be170439b5ffe89694ae0cfc553cb49d1d8b643239e353351531532",
       "standardV": "0x1",
       "v": "0x1c",
       "r": "0x34c333b0b91cd832a3414d628e3fea29a00055cebf5ba59f7038c188404c0cf3",
       "s": "0x524fd9b35be170439b5ffe89694ae0cfc553cb49d1d8b643239e353351531532",
       "transactionIndex": null
     }
   },
   "0x...": { ... }
 }
}
curl --data '{"method":"parity_pendingTransactions","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST https://sokol.poa.network

這就是我在特定節點中查看所有待處理交易的方式 https://github.com/paritytech/parity/wiki/JSONRPC-parity-module#parity_pendingtransactions

引用自:https://ethereum.stackexchange.com/questions/25454