Track Onchain Events for PYUSD, PayPal's New Stablecoin
Written by Logan Ross
Reviewed by Brady Werkheiser
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.
How to Track Onchain PYUSD Activity
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!
1. Log into Alchemy’s Custom Webhooks
Sign up or log into your Alchemy account and create a new custom webhook.
For more details, follow this step-by-step guide to set up a custom webhook.
2. Paste in the PYUSD code snippet
Create a new webhook using a blank template. Paste in your webhook URL (where you want the events to be streamed).
Next, copy and paste this code snippet into your new GraphQL webhook:
# 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
3. Start Receiving Events at your Webhook URL
Once published, your webhook URL should start receiving all events emitted by the PYUSD 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!
4. Stream to AWS
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.
What is PayPal’s Stablecoin PYUSD?
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.
What makes PayPal’s PYUSD interesting to track?
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.
Related overviews
Learn About Ethereum's Liquid Staking Token Ecosystem And The Top Players
Learn About The New Category of DeFi Protocols Building Yield-Bearing Strategies On Top of Liquid Staking
Learn How to Lend and Borrow Solana Tokens on Port Finance, Solana DeFi Application