Skip to content

Instantly share code, notes, and snippets.

const Web3 = require('web3');
const web3 = new Web3('// your rpc url here');
// connection to smart contract
const address = // your contract string
const abi = // your contract abi here
const contract = new web3.eth.contract(abi, address); // your contract instance
contract.getPastEvents(
'AllEvents', // you can send any event name like 'transfer' or something