Subscribe
The Transactions Endpoint allows for quick and accurate lookup of transactions associated with an address.
The websocket complement that by allowing you to subscribe to transactions in real-time, whenever a transaction matches the to or from address
, without the need to poll the API.
Whenever we ingest a new block, we send the transactions in an object with type Added
. If a reorg happens, we go through all the blocks and retransmit the transactions in an object with the type Removed
.
{
"type": "Added",
"transactions": [...]
}
{
"type": "Removed",
"transactions": [...]
}
Install the dependencies
Wscat is a popular WebSocket utility for creating WebSocket connections. It allows you to send and receive messages interactively via the command line.
npm install -g wscat
Call the webhook
Just replace Wallet Address
and Dune API Key
with your own values.
wscat -c wss://api.dune.com/api/beta/transactions/{Wallet Address}/subscribe \
-H "X-Dune-Api-Key: {Dune API Key}"
Get transactions in your terminal
Whenever there is a transaction, you will receive the updates in your terminal. Here an example:
{
"type": "Added",
"transactions": [
{
"address": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad",
"chain": "Base",
"block_time": "2024-08-08T12:32:47+00:00",
"block_number": 18165510,
"block_version": 0,
"index": 28,
"hash": "0x97f8ed1735b705197b42ca2e550237c9154531e27844ba7f96beee7bb27bfd2d",
"block_hash": "0xb91930d5daa3e5354d225d325c1495e469b48e538ab522a77e0e731055ee607b",
"value": "0xaddeabb34ec000",
"transaction_type": "Receiver",
"from": "0xa81a0c4c36e437769b6262187287258556e4e43f",
"to": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad",
"nonce": "0x679",
"gas_price": "0x9d6905",
"max_fee_per_gas": "0xdcb3f1",
"max_priority_fee_per_gas": "0x227c1d",
"data": "0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000066b4bd4400000000000000000000000000000000000000000000000000000000000000020b080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000addeabb34ec0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000addeabb34ec000000000000000000000000000000000000000000000001d61e0fd933b27daf17d00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000004200000000000000000000000000000000000006000000000000000000000000db7aabe1ccf7627bf3a141fd4d8c9a852845d278"
},
]
}
Headers
API key to access the service
Path Parameters
Wallet to get transactions for
Was this page helpful?