0%
Overview page background
HomeOverviewsDeFi
Track Onchain Events for PYUSD, PayPal's New Stablecoin

Track Onchain Events for PYUSD, PayPal's New Stablecoin

Logan Ross headshot

Written by Logan Ross

Brady Werkheiser headshot

Reviewed by Brady Werkheiser

Published on August 7, 20232 min read

On August 7th, 2023 PayPal announced their new stablecoin, PYUSD. Here’s how to use Custom Webhooks to stream onchain events in real time for the PYUSD smart contract.

Tracking the onchain activity for PayPal’s PYUSD smart contract, 0xe17b8aDF8E46b15f3F9aB4Bb9E3b6e31Db09126E, using custom Webhooks is a matter of creating a new GraphQL webhook, copying a simple code snippet, and entering in your webhook URL!

Sign up or log into your Alchemy account and create a new custom webhook

Create a GraphQL Webhook from Alchemy's Dashboard
Create a GraphQL Webhook from Alchemy's Dashboard

For more details, follow this step-by-step guide to set up a custom webhook.

Create a new webhook using a blank template. Paste in your webhook URL (where you want the events to be streamed).

Creating a Custom Webhook to Stream Onchain Events for PYUSD
Creating a Custom Webhook to Stream Onchain Events for PYUSD

Next, copy and paste this code snippet into your new GraphQL webhook:

Copied
# Get all Approval() events emitted by the PYUSD contract { block(hash: "0xaaf4228db65eab92357c124ff8f8f1c5da72a04da660e147157cd4dfd8eb44d6") { logs(filter: {addresses: ["0xe17b8aDF8E46b15f3F9aB4Bb9E3b6e31Db09126E"], topics: ["0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925"]}) { account { address } topics transaction{ hash index to{ address } from { address } status } } } }

Here's what the important parts of

  • Block hash - the reference number of a block in a blockchain

  • Addresses - the smart contract address for PYUSD's ERC-20 token

  • Topics - the topic describes the event that the webhook will track

Once published, your webhook URL should start receiving all events emitted by the PYUSD contract.

Event Stream from the PYUSD Smart Contract
Event Stream from the PYUSD Smart Contract

Each transaction that happens using PayPal’s stablecoin will now be accessible to you via JSON. While some may use this data to create a Twitter bot for large transactions, others may find other unique insights!

Want to ingest, store and retrieve real-time PYUSD blockchain data with a serverless API? Read our step-by-step guide to stream blockchain data to AWS in real-time.

PayPal has announced its intentions to become a major bridge between the Ethereum, onchain ecosystem and the traditional fiat system via its new “PayPal USD” stablecoin.  PayPal USD is an ERC-20 token claimed to be redeemable 1-1 for US Dollars. The stablecoin is issued by Paxos Trust Company who hold assets in their reserves to back the PYUSD token. 

PYUSD is the only stablecoin that PayPal will support for the time being, making it desirable for PayPal’s customers who want to quickly move on and offchain. PayPal’s new “Checkout with Crypto” feature will also allow customers to spend PYUSD at checkout. 

While all of Ethereum’s onchain activity is trackable with Custom Webhooks, the introduction of a digital payments giant into the ecosystem marks era. PayPal will support transferring PYUSD from the PayPal app to Ethereum wallets. This, and other transactions occurring with the stablecoin, may provide insightful onchain analysis.

Overview cards background graphic
Desktop section background image

Build blockchain magic

Alchemy combines the most powerful web3 developer products and tools with resources, community and legendary support.

Get your API key