i am using web3 suscribe event for listening to incoming and outgoing transaction from rinkeby testnet. but i am not getting anything in console.even my transaction is succesful.
i use infura websocket provider
here is my code
const Web3 = require('web3');
const webs3 = new Web3(new Web3.providers.WebsocketProvider('wss://rinkeby.infura.io/ws/v3/projectid'));
var subscription = webs3.eth.subscribe('logs', {
address: '0x20617a33cf37387F35e0DA32aBdaDAF09D46B351',
topics: [null]
}, function(error, result){
if (!error)
console.log(result);
})
.on("data", function(log){
console.log(log);
})
.on("changed", function(log){
});
// unsubscribes the subscription
subscription.unsubscribe(function(error, success){
if(success)
console.log('Successfully unsubscribed!');
});
您正在从您共享的代码上的主题参数订阅一个“空”事件,该代码不存在。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.