• About
  • Landing Page
  • Buy JNews
SB Crypto Guru News- latest crypto news, NFTs, DEFI, Web3, Metaverse
  • HOME
  • BITCOIN
  • CRYPTO UPDATES
    • GENERAL
    • ALTCOINS
    • ETHEREUM
    • CRYPTO EXCHANGES
    • CRYPTO MINING
  • BLOCKCHAIN
  • NFT
  • DEFI
  • WEB3
  • METAVERSE
  • REGULATIONS
  • SCAM ALERT
  • ANALYSIS
No Result
View All Result
  • HOME
  • BITCOIN
  • CRYPTO UPDATES
    • GENERAL
    • ALTCOINS
    • ETHEREUM
    • CRYPTO EXCHANGES
    • CRYPTO MINING
  • BLOCKCHAIN
  • NFT
  • DEFI
  • WEB3
  • METAVERSE
  • REGULATIONS
  • SCAM ALERT
  • ANALYSIS
No Result
View All Result
SB Crypto Guru News- latest crypto news, NFTs, DEFI, Web3, Metaverse
No Result
View All Result

Notify API Alternate options – Best Option to Set Up Web3 Notifications

SB Crypto Guru News by SB Crypto Guru News
January 31, 2023
in Web3
0 0
0
Notify API Alternate options – Best Option to Set Up Web3 Notifications


Take heed to a sensible contract deal with and create desktop Web3 notifications for on-chain occasions:

Monitor a Web3 pockets’s exercise:

To combine Web3 notifications, you need to make the most of instruments such because the Notify API or its alternate options. Whereas the Notify API is a good instrument, it will probably’t match the pace and energy of Moralis Streams. Moralis Streams is an enterprise-grade API that, for instance, helps the implementation of blockchain notifications and permits devs to hearken to any pockets or sensible contract deal with. In reality, right here’s how easy it’s to create a brand new stream through the Moralis JS SDK to trace a selected pockets:

const newStream = await Moralis.Streams.add(choices) 

const {id}=newStream.toJSON();

const deal with=”wallet_address_you_want_to_track”

await Moralis.Streams.addAddress({deal with,id})

It doesn’t get extra easy than this when utilizing the very best Notify API various, and whether or not you’re listening to pockets addresses or sensible contracts, the strategies are fairly comparable. In both case, we will use logged occasions and implement Web3 notifications in several varieties. Our blockchain notifications may be constructed into dapps or social media (through bots) platforms as cellular or desktop notifications, and many others. For instance, the next traces of code use a USDT stream to create a desktop notification for each switch of USDT above any particular threshold:

app.put up('/webhook', (req, res) => {

  const webhook = req.physique;
  for (const erc20Transfer of webhook.erc20Transfers){

      const addrs = `${erc20Transfer.from.slice(0, 4)}...${erc20Transfer.from.slice(38)}`;
      const quantity = Quantity(erc20Transfer.valueWithDecimals).toFixed(0);

      notifier.notify({
          title: 'NEW USDT Switch',
          message: `${addrs} simply despatched n$${quantity}`,
        });

  }

  return res.standing(200).json();

})

When you want to learn to implement the above-presented code snippets accurately, create your free Moralis account and comply with our lead!

Scalable Notify API Alternatives - Sign Up with Moralis Streams Today

Overview

In at this time’s article, we’ll first present you find out how to implement the code snippets above and use them with the very best Notify API various. The primary instance will show find out how to create blockchain notifications by listening to a sensible contract deal with. For that, we’ll use the Moralis Streams API through the Moralis admin UI. The second instance will lean on utilizing Moralis Streams through the JS SDK to implement crypto pockets monitoring. 

Under the 2 tutorials, we will even discover numerous Notify API alternate options, the place you’ll have an opportunity to be taught extra in regards to the Moralis Streams API and different instruments that this final Web3 API supplier has to supply.

Web3 and JavaScript Tutorials - Moralis Streams vs Notify API

Best Option to Set Up Web3 Notifications with NodeJS

The best option to arrange blockchain notifications with JavaScript (JS) is utilizing the Moralis Streams API. So, earlier than you dive into the next two examples, ensure you have your free Moralis account prepared. To do that, use the “create your free Moralis account” hyperlink above or go to “moralis.io” and hit one of many “Begin for Free” buttons:

Moralis landing page and the Sign Up for Free button

Upon getting your free account prepared, you possibly can entry your admin space. That is the place you possibly can get hold of your Web3 API key and entry the UI for Moralis Streams:

  • Acquiring your Web3 API key:
Web3 Streams API key and Streams UI tab
Streams UI landing page

Tutorial 1: Blockchain Notifications for Desktop

Create a brand new venture folder (“DesktopNotifications”) and open it in Visible Studio Code (VSC). Then, you might proceed by creating an Specific dapp utilizing NodeJS. This backend dapp will function a webhook, to which you’ll ship on-chain occasions detected along with your USDT stream.

To initialize a NodeJS venture, use the next command:

npm init

Then merely hit enter a few occasions to decide on the default choices. After confirming “Is that this OK?” in your terminal, you’ll see a “package deal.json” file in your venture folder: 

package.json file inside Visual Studio Code

Subsequent, set up the required dependencies by operating this command:

npm i categorical nodemon node-notifier

Now, you might have all the pieces able to create a brand new “index.js” file:

contact index.js

Open your “index.js” script and import Specific and “node-notifier“. You have to additionally outline a neighborhood port you need to use and make sure that your dapp makes use of JSON. These are the traces that can cowl these points:

const categorical = require('categorical')
const notifier = require('node-notifier');
const app = categorical()
const port = 3000

app.use(categorical.json())

Create Nodemon Script, Ngrok Tunnel, and Use the Put up Endpoint

Open the “package deal.json” file and add a “begin” script with “nodemon index.js”:

Use “ngrok” to create a tunnel to your native machine and get a URL you should use as a webhook. For that objective, open a brand new terminal and enter the command under to put in “ngrok“:

sudo npm i ngrok

Subsequent, run the next command:

ngrok http 3000

As a response, you’ll get a URL that you should use as a webhook URL:

Transferring ahead, you need to create a “put up” endpoint that might be your webhook URL. The latter will learn what your stream is sending after which hearth up the suitable logic. For starters, use the next traces of code: 

app.put up('/webhook', (req, res) => {

  const webhook = req.physique;

  console.log(webhook)

  return res.standing(200).json();

})

Lastly, you need to initialize your Specific dapp to hearken to the native port: 

app.hear(port, () => {

  console.log(`Listening to streams`)

})

With the above script in place, you possibly can run your dapp:

npm run begin

Together with your webhook URL prepared and your backend NodeJS dapp operating, you’re prepared to make use of the last word Notify API various to begin listening to on-chain occasions. 

Utilizing the Moralis Admin UI to Create Triggers for Blockchain Notifications 

Because of the screenshot introduced earlier, you already know find out how to entry the Streams tab. As soon as there, hit the “New Streams” button: 

On the subsequent web page, you’ll get to arrange a brand new stream. Since we need to hearken to USDT transfers, you need to paste the USDT contract’s deal with. You’ll be able to copy it from Etherscan:

Then, it is advisable add an outline, webhook URL, and a tag:

So far as the webhook URL goes, be certain that to make use of your “ngrok” URL obtained above and add “/webhook” on the finish. Subsequent, choose the “Ethereum Mainnet” community – that is the place the USDT sensible contract lives:

Transfers are particular occasions of contract interactions, so it is advisable select the correct kind of exercise:

You additionally want the USDT contract’s ABI, which you can even copy from Etherscan (“Contract” tab):

As soon as on the “Contract” tab, scroll down till you see “Contract ABI” and replica it:

After pasting the above-copied ABI into the designated space in your setup, Moralis will robotically detect the accessible on-chain occasions. As such, you merely choose the “Switch” choice:

Lastly, it is advisable add a filter that can concentrate on transfers of greater than 50 thousand USDT:

These are the traces of code introduced within the above screenshot:

[

{

“topic0”: “Transfer(address,address,unit256)”,

“filter”: {“gt: [“value”, “50000000000]}

}

]

Be aware: That you must use “50000000000” as a result of USDT makes use of six decimal locations. You’ll be able to discover totally different filters on our GitHub web page within the “Filter Streams” part. 

When you return to your terminal the place you’re operating your “index.js” script, you need to see detected USDT transfers within the following format:

Showing a Notify API alternative example response code

All that’s left to do is to current these outcomes through neat desktop notifications, which we’ll have a look at subsequent!

Displaying Web3 Notifications

To make sure that each new USDT switch triggers a corresponding desktop blockchain notification, it is advisable tweak your “index.js” script. That is the place the snippet of code from the intro comes into play. So, your up to date “put up” endpoint ought to comprise the next:

app.put up('/webhook', (req, res) => {

  const webhook = req.physique;

  for (const erc20Transfer of webhook.erc20Transfers){

      const addrs = `${erc20Transfer.from.slice(0, 4)}...${erc20Transfer.from.slice(38)}`;
      const quantity = Quantity(erc20Transfer.valueWithDecimals).toFixed(0);

      notifier.notify({
          title: 'NEW USDT Switch',
          message: `${addrs} simply despatched n$${quantity}`,
        });

  }

  return res.standing(200).json();

})

Be aware: You’ll be able to entry the ultimate “index.js” script used above on GitHub.

That is what these USDT switch notifications appear like on a desktop:

Web3 notification popup from using the Moralis Streams Notify API alternative

Tutorial 2: Utilizing the Notify API Various to Monitor Web3 Wallets

Be aware: To arrange your Specific dapp utilizing NodeJS and create a “ngrok” tunnel, use the steps lined within the above tutorial. 

On this instance, we’ll present you find out how to use the Moralis JS SDK to create a brand new stream that tracks a Web3 pockets deal with. That you must initialize one other NodeJS app and create a brand new “index.js” file. Inside that script, require Moralis and “dotenv“:

const Moralis = require("moralis").default;
const { EvmChain } = require("@moralisweb3/common-evm-utils");
require("dotenv").config();

Additionally, create a “.env” file the place you need to paste your Moralis Web3 API key within the “MORALIS_KEY” variable. Subsequent, initialize Moralis:

Moralis.begin({
    apiKey: course of.env.MORALIS_KEY,
  });

Then, it is advisable outline the stream’s choices (embody the identical particulars as contained in the Streams UI):

async perform streams(){

  const choices = {
    chains: [EvmChain.MUMBAI],
    description: "Take heed to Transfers",
    tag: "transfers",
    includeContractLogs: false,
    includeNativeTxs: true,
    webhookUrl: "your webhook url"
  }

Trying on the traces of code above, you possibly can see that the choices cowl a sequence to concentrate on, an outline, a tag, and a webhook URL. You can even see that the script focuses on totally different on-chain occasions by setting “includeContractLogs” to “false” and “includeNativeTxs” to “true“. This manner, you possibly can concentrate on native forex transfers. For the Mumbai testnet, that’s testnet MATIC. To make use of the above traces of code, be certain that to exchange “your webhook url” along with your “ngrok” URL. Don’t overlook so as to add “/webhook” on the finish of that URL. 

Create a New Pockets-Monitoring Stream

With the traces of code above set in place, it’s time to make use of the snippet from at this time’s introduction. So, add these traces of code contained in the “async” perform of your “index.js” file:

const newStream = await Moralis.Streams.add(choices)

  const {id} = newStream.toJSON();

  const deal with = "wallet_address_you_want_to_track";

  await Moralis.Streams.addAddress({deal with, id})

  console.log("Fin")

}

streams()

To make use of this script, be certain that to exchange “wallet_address_you_want_to_track” with an precise pockets deal with. If you wish to take a look at this stream firsthand, we advocate you employ one in every of your pockets addresses. In that case, you’ll be capable of execute instance testnet MATIC transfers to see the ends in your terminal:

Be aware: To acquire testnet MATIC, you need to use a dependable Polygon Mumbai faucet. If you wish to goal totally different testnets, you’ll want different crypto taps. Luckily, yow will discover an Ethereum faucet (Goerli faucet), Chainlink testnet faucet, Solana testnet faucet, and others on the Pure Taps web page.

Exploring Notify API Alternate options

When you accomplished the above two tutorials, you have already got an honest sense of what the very best Notify API various is all about. Nevertheless, you possibly can discover the Moralis Streams API in additional element within the upcoming sections. Nevertheless, let’s first ensure you know what the Notify API is. 

Title - Notify API

What’s the Notify API?

Within the realm of Web3, the Notify API refers to Alchemy’s product that permits builders to ship real-time push notifications to customers for crucial on-chain occasions. Given the identify “Notify”, it has raised consciousness relating to Web3 and blockchain notifications. Nevertheless, different merchandise serve the identical objective extra effectively, and the Moralis Streams API is the last word Notify API various. It’s sooner, covers all main blockchains, and provides much more than simply notifications.

Title - Notify API for Web3 Notifications versus Moralis Streams API

The Greatest Notify API Various

The Streams API is the very best various to Alchemy’s Notify API. One in every of its benefits is cross-chain interoperability. When you accomplished the primary tutorial herein, you have been in a position to see a number of chains within the “Choose Networks” step of the Streams UI. However it’s value mentioning that Moralis Streams help all main EVM-compatible chains. As such, you possibly can monitor any main chain or a number of networks concurrently. Apart from concentrating on a number of chains, this additionally future-proofs your work because it ensures you’re by no means caught on any explicit chain.

Cross-chain networks compatible with Moralis Streams outlined - Ethereum, BNB Chain, Polygon, Avalanche, Solana, etc.

One other excellent profit the Streams API provides is user-friendliness. By providing an admin UI and an SDK to work with Moralis Streams, anybody can discover a option to rapidly set the backend in place required to hearken to on-chain occasions. Plus, the Moralis SDK helps all main legacy programming languages and frameworks. Therefore, you should use your Web3 programming abilities to hearken to any sensible contract and pockets deal with. What’s extra, you are able to do so with a free Moralis account! All these benefits even make Web3 libraries out of date in a number of methods.

TRUSTED BY INDUSTRY LEADERS

Polygon Network founder testimonal - Moralis Streams offers seamless integration - Best Notify API alternative
  • ✅ Cross-chain interoperability
  • ✅ Consumer-friendliness (cross-platform interoperability)
  • ✅ Listening to crypto wallets and sensible contracts
  • ✅ Velocity and effectivity
  • ✅ Superior filtering choices
  • ✅ Accessible with a free account
  • ❌ Connecting and sustaining buggy RPC nodes
  • ❌ Constructing pointless abstractions
  • ❌ Losing time constructing complicated information pipelines

Moralis – Past Web3 Notifications

Registering blockchain occasions and fetching parsed on-chain information is what all decentralized functions (dapps) want. Whereas a number of devs nonetheless make the error of constructing an infrastructure to assist them try this from scratch, you don’t need to waste time reinventing the wheel. That is the place the Web3 APIs from Moralis change the sport. With this toolbox in your nook, you don’t need to waste assets on constructing a singular backend. As a substitute, you should use brief snippets of code to cowl all of your blockchain-related backend wants after which dedicate most consideration to creating the very best frontend.  

With that in thoughts, be certain that to discover the total energy of Moralis. Apart from the Streams API, Moralis provides you the last word Web3 Information API and Web3 Auth API. The previous helps your have to fetch any kind of on-chain information with a single line of code. It means that you can use the Web3 get block timestamp perform, token value API, the last word NFT API, and rather more:

Various Notify API alternatives outlined at Moralis landing page

So far as Moralis authentication goes, it helps you to add all of the main Web3 login strategies to your dapps. Consequently, your dapp’s customers can expertise a frictionless Web3 onboarding expertise when you unify Web3 wallets and Web2 accounts. To expertise this instrument firsthand, tackle our Supabase authentication tutorial. 

Nonetheless, except for options for constructing dapps on Ethereum and main EVM-compatible chains, Moralis additionally allows you to goal Solana. The 2 hottest choices for that community are the Solana Python API and the Solana JS API. 

Notify API Alternate options – Best Option to Set Up Web3 Notifications – Abstract

In at this time’s article, you had an opportunity to roll up your sleeves and tackle two tutorials that taught you find out how to use the last word Notify API various to hearken to on-chain occasions with out breaking a sweat. The primary tutorial supplied you a chance to concentrate on listening to a sensible contract deal with and utilizing the Streams API through the Moralis admin UI. Within the second tutorial, we confirmed you find out how to concentrate on Web3 pockets addresses whereas utilizing the facility of Moralis Streams through the JS SDK. After finishing the tutorials, you have been in a position to be taught what Alchemy’s Notify API is and get a greater sense of the Moralis Streams API and the remainder of Moralis’ suite of instruments.    

Now that you know the way to cowl the backend facet of utilizing the very best Notify API various, it’s time you begin constructing some distinctive frontends incorporating blockchain notifications. Moreover, you may additionally use on-chain occasions to automate social media posts. For example, you possibly can create a Twitter bot, NodeJS Telegram bot, or a blockchain Discord bot. 

However, you may be concerned about exploring different blockchain growth matters or getting the crypto fundamentals beneath your belt, akin to answering questions like “what’s Web3 know-how?“. In that case, you need to discover our crypto weblog additional. That stated, if you’re prepared to begin BUIDLing and would really like some steerage, be certain that to take a look at the Moralis YouTube channel and documentation. When you plan on coping with token costs in ETH, you’ll need to use a dependable gwei to ETH calculator. 



Source link

Tags: AlternativesAPIBitcoin NewsCrypto NewsCrypto UpdatesEasiestLatest News on CryptoNotificationsNotifySB Crypto Guru NewsSetWeb3
Previous Post

B2B Funds Innovator TreviPay Groups Up with Cashflow Specialist Cloudfloat

Next Post

Social Token Mission Rally Shuts Ethereum Sidechain, Stranding Customers’ Crypto Property

Next Post
Social Token Mission Rally Shuts Ethereum Sidechain, Stranding Customers’ Crypto Property

Social Token Mission Rally Shuts Ethereum Sidechain, Stranding Customers’ Crypto Property

  • Trending
  • Comments
  • Latest
Meta Pumps a Further  Million into Horizon Metaverse

Meta Pumps a Further $50 Million into Horizon Metaverse

February 24, 2025
How to Get Token Prices with an RPC Node – Moralis Web3

How to Get Token Prices with an RPC Node – Moralis Web3

September 3, 2024
Big XR News from Google, Samsung, Qualcomm, Sony, XREAL, Magic Leap, Lynx, Meta, Microsoft, TeamViewer, Haply

Big XR News from Google, Samsung, Qualcomm, Sony, XREAL, Magic Leap, Lynx, Meta, Microsoft, TeamViewer, Haply

December 13, 2024
Meta Quest Pro Discontinued! Enterprise-Grade MR Headset is No Longer Available

Meta Quest Pro Discontinued! Enterprise-Grade MR Headset is No Longer Available

January 6, 2025
Samsung Unveils ‘Moohan’ to Compete with Quest, Vision Pro

Samsung Unveils ‘Moohan’ to Compete with Quest, Vision Pro

January 29, 2025
How to Get NFT Balances with One RPC Call – Moralis Web3

How to Get NFT Balances with One RPC Call – Moralis Web3

August 30, 2024
Nasdaq Wants To Add XRP, ADA, SOL, XLM To Crypto Index

Nasdaq Wants To Add XRP, ADA, SOL, XLM To Crypto Index

0
She Quit Her Job. Now She Makes  Million Selling Smoothies.

She Quit Her Job. Now She Makes $1 Million Selling Smoothies.

0
Only Days Left! Solaxy (SOLX) Presale Ends June 16 — Last Chance to Buy the Crypto Worth Watching Before Major Exchange Listings

Only Days Left! Solaxy (SOLX) Presale Ends June 16 — Last Chance to Buy the Crypto Worth Watching Before Major Exchange Listings

0
Is UMA Crypto Ready for a 200% Rally After Polymarket and X Deal?

Is UMA Crypto Ready for a 200% Rally After Polymarket and X Deal?

0
Best Presales to Buy for Early Profits

Best Presales to Buy for Early Profits

0
Bitcoin Reserve Blueprint Coming ‘In Short Order’: Bo Hines

Bitcoin Reserve Blueprint Coming ‘In Short Order’: Bo Hines

0
Only Days Left! Solaxy (SOLX) Presale Ends June 16 — Last Chance to Buy the Crypto Worth Watching Before Major Exchange Listings

Only Days Left! Solaxy (SOLX) Presale Ends June 16 — Last Chance to Buy the Crypto Worth Watching Before Major Exchange Listings

June 9, 2025
She Quit Her Job. Now She Makes  Million Selling Smoothies.

She Quit Her Job. Now She Makes $1 Million Selling Smoothies.

June 9, 2025
Bitcoin Reserve Blueprint Coming ‘In Short Order’: Bo Hines

Bitcoin Reserve Blueprint Coming ‘In Short Order’: Bo Hines

June 9, 2025
Best Presales to Buy for Early Profits

Best Presales to Buy for Early Profits

June 9, 2025
Is UMA Crypto Ready for a 200% Rally After Polymarket and X Deal?

Is UMA Crypto Ready for a 200% Rally After Polymarket and X Deal?

June 9, 2025
Coinbase Slashes Account Freezes by 82%

Coinbase Slashes Account Freezes by 82%

June 9, 2025
SB Crypto Guru News- latest crypto news, NFTs, DEFI, Web3, Metaverse

Find the latest Bitcoin, Ethereum, blockchain, crypto, Business, Fintech News, interviews, and price analysis at SB Crypto Guru News.

CATEGORIES

  • Altcoin
  • Analysis
  • Bitcoin
  • Blockchain
  • Crypto Exchanges
  • Crypto Updates
  • DeFi
  • Ethereum
  • Metaverse
  • Mining
  • NFT
  • Regulations
  • Scam Alert
  • Uncategorized
  • Web3

SITE MAP

  • Disclaimer
  • Privacy Policy
  • DMCA
  • Cookie Privacy Policy
  • Terms and Conditions
  • Contact us
  • Disclaimer
  • Privacy Policy
  • DMCA
  • Cookie Privacy Policy
  • Terms and Conditions
  • Contact us

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
No Result
View All Result
  • HOME
  • BITCOIN
  • CRYPTO UPDATES
    • GENERAL
    • ALTCOINS
    • ETHEREUM
    • CRYPTO EXCHANGES
    • CRYPTO MINING
  • BLOCKCHAIN
  • NFT
  • DEFI
  • WEB3
  • METAVERSE
  • REGULATIONS
  • SCAM ALERT
  • ANALYSIS

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.