Skip to content

Smart Contracts transactions events listener for Ethereum or any EVM compatible Blockchain.

License

Notifications You must be signed in to change notification settings

magiodev/webhook-ethereum-event-listener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webhook Ethereum Smart Contracts Events Listener

Smart Contracts transactions events listener for Ethereum or any EVM compatible Blockchain. It's meant to serve Web2 REST APIs as Webhook in order to execute specific actions when Web3 things happen.

Features

  • Subscribing to Smart Contract(s) events and setting Websocket Event Listeners
  • Taking past Events from decremental range of blocks, to init your project or recover missed ones
  • Keeping alive the connection creating fresh subscriptions very X minutes
  • Cleanness of past subscriptions once new once are created
  • Detecting if already fetched a transaction id previously to do not spam your API

Tech Stack

  • Node.js with Express to run
  • Axios for XHR/HTTP Requests
  • Web3.js as WebSocket / RPC

Usage

Installation

npm install

Configuration

Edit the .env accordingly to your needing starting by the .env-template file.

cp .env-template .env
nano .env

Also you need to put the artifact of your Smart Contract(s) inside the /contracts folder in order to let Web3.js decode methods and Event data structures. Use the same structure adopted by dummy files.

Running the script

node app.js

Setting persistence with PM2 (remote)

npm install -g pm2
pm2 startup
pm2 start app.js
pm2 save
pm2 status

About

Smart Contracts transactions events listener for Ethereum or any EVM compatible Blockchain.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published