- <div>var Web3 = require("web3");var web3 = new Web3();
- web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'));
- getTransactionsByAddr(web3,"0x6e4Cc3e76765bdc711cc7b5CbfC5bBFe473B192E",133064,134230);//myaccount :需要查询的地址信息,startBlockNumber:查询的其实blockNumber,endBlockNumber:查询的结束blockNumberasync function getTransactionsByAddr(web3,myaccount,startBlockNumber,endBlockNumber) { if (endBlockNumber == null) {
- endBlockNumber = await web3.eth.blockNumber; console.log("Using endBlockNumber: " + endBlockNumber);
- } if (startBlockNumber == null) {: y$ K9 } ~( D* u8 D! x
- startBlockNumber = endBlockNumber - 1000; console.log("Using startBlockNumber: " + startBlockNumber);
- } console.log("Searching for transactions to/from account "" + myaccount + "" within blocks " + startBlockNumber + " and " + endBlockNumber); </div>
七行代码:以太坊中查询某个地址的交易记录
华胥
发表于 2022-12-11 15:52:49
120
0
0
成为第一个吐槽的人