Skip to main content

DEX Swaps in Tokenview Transaction Tracking API

tokenviewAbout 2 min

DEX Swaps in Tokenview Transaction Tracking API

Overview

DEX Swaps refer to decentralized exchanges where users can trade cryptocurrencies directly with one another without relying on a central authority or intermediary. Here are some key points about DEX Swaps:

  1. Decentralization: DEXs operate on blockchain networks and allow users to trade digital assets in a peer-to-peer manner. DEXs do not hold users' funds.
  2. User-Controlled Wallets: Users connect their digital wallets to the DEX platform. They retain full control over their private keys and funds.
  3. Liquidity Pools: DEXs rely on liquidity pools created by users who provide liquidity by depositing their assets. These pools facilitate trading by ensuring there are enough tokens available for swaps.

DEXs do not facilitate swaps between cryptocurrencies and fiat currencies, they focus solely on crypto-to-crypto trading, including WETH vs. USDT, WBNB vs. USDC, OP or WETH vs. DAI, MATIC vs. USDT etc on Ethereum, BNB Smart Chain, Polygon, Arbitrum and more. Now, let's learn how to track DEX swaps with the pool contract address and swap event.

Uniswap v3 Swaps

To track Uniswap v3 Swaps, we will need to target two parameters:

  1. The contract address which is coded to raise Uniswap v3 swap event - Let's say 0x: Exchange Proxyopen in new window.
  2. The Swap event's Keccak-256 hash - In the case of the v3, you can find it from event documentation from Uniswapopen in new window. To get the Keccak-256 hash, you can open 0x: Exchange Proxyopen in new window from blockchain explorer, and click any of the transaction from its transaction list, for instance, this oneopen in new window. And then check its "Event Logs(11)" tab, Ctrl+F to search "Swap", Topics[0] is the event requested, "0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67"

dex swap
With the above parameters, build a HTTP request:

curl --location 'https://services.tokenview.io/vipapi/txmonitor/addTrackingItem?apikey={apikey}' \
--header 'Content-Type: application/json' \
--data '{
    "currency": "ETH",
    "trackType": "event",
    "contract": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
    "topic": "0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67"
}'

PancakeSwap V3 Swaps(BSC)

To track PancakeSwap v3 Swaps, we will need to target two parameters:

  1. The contract address which is coded to raise PancakeSwap v3 swap event - Let's say AggregationRouterV5open in new window.
  2. The Swap event's Keccak-256 hash - In the case of the v3, you can find it from event documentation from PancakeSwapopen in new window. To get the Keccak-256 hash, you can open AggregationRouterV5open in new window from blockchain explorer, and click any of the transaction from its transaction list, for instance, this oneopen in new window. And then check its "Event Logs(11)" tab, Ctrl+F to search "Swap", Topics[0] is the event requested, "0x19b47279256b2a23a1665c810c8d55a1758940ee09377d4f8d26497a3577dc83"

dex swap
With the above parameters, build a HTTP request:

curl --location 'https://services.tokenview.io/vipapi/txmonitor/addTrackingItem?apikey={apikey}' \
--header 'Content-Type: application/json' \
--data '{
    "currency": "BSC",
    "trackType": "event",
    "contract": "0x1111111254eeb25477b68fb85ed929f73a960582",
    "topic": "0x19b47279256b2a23a1665c810c8d55a1758940ee09377d4f8d26497a3577dc83"
}'

By leveraging Tokenview Transaction Trackingopen in new window, it is very easy to track the DEX Swaps which will happend on blockchains, it's helpful for traders, programers, investors to get the real-time market activities and bring profitable trading experiences.

About Tokenview Blockchain APIs & Data Service Platform:

Tokenview blockchain APIs & data service platform contained 120+ blockchains has powerful endpoints that simplify complex blockchain data into single API calls. Code for all supported blockchains using unified API calls. From here to easily get transaction, address, gas, contract, token, NFT, logs and any information from chain. And Yes you can also send tx to chain. One-click configuration with APIKey helps developers to Use, to Create, to Build.
Last update: