簡體   English   中英

如何通過指定地址以太坊獲取待處理交易?

[英]how to get Pending Transactions by specified address ethereum?

請問你能幫幫我嗎? 我幾乎嘗試了所有方法。

我試過這個:

var options = {
  fromBlock: "pending",
  toBlock: "latest",
  address: "0xabc123...",
}

web3.eth.filter(options, (error, result) => {
  if (!error)
    console.log(result);
});

但它也沒有返回任何我嘗試使用eth.subscribe但它返回了每個待處理的交易

您可以使用 getBlock 搜索待處理塊中的交易,並從結果中遍歷交易 ID。 請檢查文檔以獲取示例輸出。

web3.eth.getBlock("pending")

如果您知道您的交易 ID,您可以立即使用 getTransactionReceipt

web3.eth.getTransaction( {transaction id} )

但是如果您是按發送者或接收者地址搜索,那么您可能需要從待處理塊的交易 ID 中獲取交易接收。

https://web3js.readthedocs.io/en/v1.2.0/web3-eth.html#getblock

https://web3js.readthedocs.io/en/v1.2.0/web3-eth.html#gettransaction

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM