i test web3js by geth,i build private net in local.i try to call getPastlog ,but return empty array.
const Web3 = require("web3");
// const web3 = new Web3(new Web3.providers.HttpProvider("https://rinkeby.infura.io/v3/770daaf97ee14e0aa77ac105bbcdd79f"));
const web3 = new Web3(new Web3.providers.HttpProvider("http://127.0.0.1:8545"));
web3.eth.getPastLogs({
address:"0xF81639558D54a03D6620c5bdb2f1C2e5c87736d0",
topics: ['0xdd970dd9b5bfe707922155b058a407655cb18288b807e2216442bca8ad83d6b5'] //topics:[web3.utils.sha3("adduintevent(uint256,uint256)")]
})
.then(console.log);
address and topics is right ,because i get them by getPastEvents
contract.getPastEvents('Log', {
// filter: {myIndexedParam: [20,23], myOtherIndexedParam: '0x123456789...'}, // Using an array means OR: e.g. 20 or 23
fromBlock: 0,
toBlock: 'latest'
}, function (error, events) {
console.log(events[0].raw);
});
===========result ==========
{
data: '0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000a54686520576f726c642100000000000000000000000000000000000000000000',
topics: [
'0xdd970dd9b5bfe707922155b058a407655cb18288b807e2216442bca8ad83d6b5'
]
}
so, i want to konw why i can't get anything by pastlog.Who can help me...