Ethereum in real-time: Dagger — Simple engine to get Ethereum transactions, receipts and events in real-time

Somedays ago, someone sent random transaction to Parity Wallet and accidentally locked funds. No one knew about it until that person informed the team on Github. Currently there is no way to receive transaction (filtered) events from Ethereum and process them.

Etherscan sends you an email whenever anyone deposits to your accounts. But we need more ways to get informed whenever something happens on contracts. Simple example: getting a slack message or mobile notification when someone withdraws more than 10ETH or 1000 Tokens from your Multi-sig wallet?

To make that possible, we have created Dagger. We at Matic Network aim to make current decentralized eco-system more usable and easy for users and we believe Dagger helps developers to achieve that.

Dagger

Dagger is a simple development tool to get blocks, transactions or events triggered by Ethereum blockchain.

It uses pub/sub mechanism (MQTT protocol). Once you subscribe particular topic, you will start receiving messages that matches subscribed topic.

You can subscribe as many as topics you want.

We have already created javascript library which you use on Node and browser as well. You can use one of any available MQTT libraries to interact with Dagger.

var Dagger = require('eth-dagger'); // connect to Dagger ETH main network (network id: 1) over web socket var dagger = new Dagger('ws://mainnet.dagger.matic.network:1884'); // dagger server // Use mqtt protocol for node (socket) // var dagger = new Dagger('mqtt://mainnet.dagger.matic.network:1883'); // dagger server // get new block as soon as it gets created dagger.on('latest:block', function(result) { console.log("New block created: ", result.data); }); // get only block number (as it gets created) dagger.on('latest:block.number', function(result) { console.log("Current block number: ", result.data); });
Get latest Ethereum block using Dagger ?

Use cases

Here are some use-cases (not limited)

  • Send emails to your DApp users when their contracts get created and they are ready to use
  • Watch ERC20 token transfer from particular address
// web3 contract var web3Contract = new web3.eth.Contract(abi, address); // dagger contract var contract = dagger.contract(web3Contract); var filter = contract.events.Transfer({filter: {from: ‘0x123456...’}, room: ‘latest’}); // watch filter.watch(function(data, removed){ // data.returnValues.to : address to which it has been transferred to // data.returnValues.value : value which has been transferred }); // watch only once filter.watchOnce(function(data, removed){ // data.returnValues.to : address to which it has been transferred to // data.returnValues.value : value which has been transferred }); // stop watching filter.stopWatching();
Watch ERC20 token transfer from mentioned address ?
  • Receive slack messages when someone withdraws 1000 tokens
  • Automatically send broadcast new transaction when future block ‘X’ gets created
  • … and many more …

You can connect Dagger with any third party services using IFTTT or Zapier.

Here is an example to store every outgoing Aragon Multisig Wallet transaction into Airtable.

Here are useful links:

Dagger: https://matic.network/dagger
Dagger examples: https://github.com/jdkanani/eth-dagger-examples
Javascript library: https://github.com/maticnetwork/eth-dagger.js

Let us know how we can make Dagger better for developers to help them make better DApps.

Stay in touch with us by following us on Twitter.

More from the Polygon Blog
Green Blockchain Summit 2.0: Agenda at a Glance 

Ethereum’s shift to Proof of Stake consensus, known as the Merge, has dramatically cut Polygon’s carbon dioxide emissions, opening the path to going beyond being carbon negative and toward empowering others to do the same. The conversation has shifted from blockchain sustainability to blockchain as a sustainability solution.  Join us for the second chapter of […]

Read More
Robinhood Selects Polygon to Launch Web3 Wallet Beta

Today, we are thrilled to announce that Robinhood has chosen Polygon as the first blockchain network to support its newly launched Web3 wallet. The Robinhood Wallet beta is now live for 10,000 iOS customers out of 1+ million who signed up for the waitlist in May. Together, Polygon and Robinhood are opening access to decentralized […]

Read More
What Is a zkEVM?

Zero-knowledge (ZK) tech is one of the most prominent and promising paths to scaling Ethereum. One popular use of ZK proofs to scale Ethereum is what’s known as a zkEVM (zero-knowledge Ethereum Virtual Machine). So what is a zkEVM, and how does it help us make Ethereum cheaper and more efficient to use? Understanding the […]

Read More
Polygon-Powered Icetea Labs Accelerator Launches With 6 Startups

Polygon has teamed up with Alpha Venture DAO and Icetea Labs to launch the inaugural Icetea Labs Accelerator Program for blockchain startups.  Working in a tight three-way partnership, Polygon is co-creating an accelerator to funnel resources, mentorship, education, and business acumen to promising Web3 companies from around the world. The startups selected for the accelerator […]

Read More
Apply to Polygon Bootcamp Africa and Kickstart Your Web3 Developer Journey

Applications are open for Polygon Bootcamp Africa, launched in partnership with Xend Finance! The eight-week intensive educational course and hackathon combo will put developers in Africa on the Web3 map.  This is Polygon’s biggest step in providing resources to developers, builders, and creators in Africa, and it comes during an important time.  An internet and […]

Read More
Starbucks Taps Polygon for Its 'Starbucks® Odyssey' Web3 Experience 

Today, we are thrilled to announce that Starbucks Coffee Company is working with Polygon to provide the blockchain technology to build its recently announced Web3 experience, Starbucks Odyssey. As a result of the partnership, this new Web3-powered experience will allow Starbucks Rewards loyalty program members and Starbucks partners (employees) in the United States to earn […]

Read More
PolygonInsights - WEEK39

Hola readers! We announced Polygon Bootcamp Africa, an eight-week intensive educational course and hackathon combo, in partnership with Xend Finance, Polygon-based carbon compensation project Coorest has become the first Web3 initiative to have an officially verified carbon standard, and Quadrata, a passport network bringing the identity and compliance layer to public blockchains, is integrating its […]

Read More
From UDC 2022 to Token 2049: A Week for the Devs in APAC

For Web3 developers in Asia, this week was absolutely packed with must-see events. Polygon was there, showing love for the devs in South Korea and Singapore. Here is a rundown of our devrel outreach. Upbit Developers Conference 2022 Some of the best known blockchain developers in Korea and beyond gathered at this year's Upbit Developer […]

Read More
Polygon-Powered Coorest Earns Web3’s First Certified Carbon Standard 

Polygon-based carbon compensation project Coorest has become the first Web3 initiative to have an officially verified carbon standard. The Coorest Carbon Standard (CCS) is certified by an official UN auditor and is a new benchmark for CO2 compensation that leverages distributed ledger technology to eliminate unfair and opaque carbon offset practices. In partnership with Polygon, […]

Read More
crossmenuchevron-down-circle