Defy Version 2.0
  • 🏁Getting Started
    • Overview
  • 🔑AUTHENTICATION
    • API Key
  • 🔄Streaming
    • What is streaming?
    • Streaming API
  • 🛡️Live AML
    • What is Live AML?
    • Live AML API
  • 🔐Security
    • Anti Money Laundering (AML)
    • Transaction Detail
  • 🏎️Travel Rule
    • What is Travel Rule?
    • Withdrawal Interactions
    • Deposit Interactions
    • E-Mail Notification
    • Status and Webhook Data
    • API Reference
  • 👩‍💻Developer Resources
    • Supported Chains
Powered by GitBook
On this page
  • What is this request?
  • What can I do with this service?
  • Tutorial
  • Example Webhook Data (Ethereum, BSC, Avalanche, Polygon)
  • Example Webhook Data (Bitcoin)

Was this helpful?

  1. Streaming

What is streaming?

You can listen all EVM accounts with Defy Streaming.

What is this request?

With this service, the wallets you want to track will send a request to the webhook you want when they take any action.

What can I do with this service?

There is no limit to what you can do as you can follow every action of any wallet you want. If you want, you can set up your own notification system. If you want, you can send an e-mail to your customers as they process. It's entirely up to your creativity.

Tutorial

var axios = require('axios');

// Create Wallet Streaming
axios.post(
    'https://api.getdefy.co/v2/stream/create',
    {
      address: '0x787970ad122d5947579e613c2464d9540081b46f',
      webhook: 'WEBHOOK_URL',
      aml_webhook: 'LIVE_AML_WEBHOOK_URL',
    },
    {
      headers: {
        apikey: 'API_KEY',
      },
    },
  )
  .then(function (response) {
    console.log(JSON.stringify(response.data));
  })
  .catch(function (error) {
    console.log(error);
  });

Options

  • address (required): A user address (i.e. 0x1a2b3x...). If specified, the user attached to the query is ignored and the address will be used instead.

  • webhook (required): You will be notified with this webhook if this wallet does something.

  • aml_webhook (optinoal): You will be notified with this webhook if this wallet does something bad. With this URL you do not need any action for Live AML.

Example Webhook Data (Ethereum, BSC, Avalanche, Polygon)

With this data you can everything you want in your system.

{
  "blockNumber": 30125357, // Type: Number
  "chainId": 56, // Type: Number
  "tx": {
    "from": "0xf89d7b9c864f589bbf53a82105107622b35eaa40", // Type: String
    "to": "0x55d398326f99059ff775485246999027b3197955", // Type: String
    "hash": "0xdb16608a4983aba6cb4f0624559939f628ac410abb1b3ac2ab4d7b80e26cf41a", // Type: String
    "value": 100000000000000000000, // Type: Number
    "formattedValue": 1.0, // Type: Float
    "input": "0xa9059cbb0000000000000000000000001093a4feb3a20af33a4e51365c9de129f7ffdd0c0000000000000000000000000000000000000000000000056bc75e2d63100000", // Type: String
    "status": 1, // Type: Number
    "address": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", // Type: String
    "logs": [
      {
        "transactionIndex": 20,
        "blockNumber": 30125357,
        "transactionHash": "0xdb16608a4983aba6cb4f0624559939f628ac410abb1b3ac2ab4d7b80e26cf41a", // Type: String
        "address": "0x55d398326f99059fF775485246999027B3197955", // Type: String
        "topics": [
          "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
          "0x000000000000000000000000f89d7b9c864f589bbf53a82105107622b35eaa40",
          "0x0000000000000000000000001093a4feb3a20af33a4e51365c9de129f7ffdd0c"
        ],
        "data": "0x0000000000000000000000000000000000000000000000056bc75e2d63100000", // Type: String
        "logIndex": 31,
        "blockHash": "0x629dc404ea1783a056c4be41a160faf122b99868c70b1e1de07709d624f1307d" // Type: String
      }
    ], // Type: Array
    "gas": 90000, // Type: Number
    "gasPrice": 5000000000, // Type: Number
    "network": "bsc", // Type: String
    "blockNumber": 30125357 // Type: Number
  }, // Type: Object
  "confirmed": true, // Type: Boolean
  "approvals": [
    {
      "address": "0x55d398326f99059ff775485246999027b3197955", // Type: String
      "index": 31, // Type: Number
      "topic": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", // Type: String
      "from": "0xf89d7b9c864f589bbf53a82105107622b35eaa40", // Type: String
      "to": "0x1093a4feb3a20af33a4e51365c9de129f7ffdd0c", // Type: String
      "method": "approval" // Type: String
    }
  ], // Type: Array
  "erc20Transfers": [
    {
      "address": "0x55d398326f99059ff775485246999027b3197955", // Type: String
      "index": 31,
      "topic": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", // Type: String
      "from": "0xf89d7b9c864f589bbf53a82105107622b35eaa40", // Type: String
      "to": "0x1093a4feb3a20af33a4e51365c9de129f7ffdd0c", // Type: String
      "method": "transfer", // Type: String
      "type": "ERC20", // Type: String
      "name": "Tether USD", // Type: String
      "symbol": "USDT", // Type: String
      "decimals": 18, // Type: Number
      "created_at": "2022-10-13T13:09:25.574Z", // Type: String
      "value": 100000000000000000000, // Type: Number
      "formattedValue": 1.0 // Type: Float
    }
  ], // Type: Array
  "erc721Transfers": [
    {
      "address": "0x55d398326f99059ff775485246999027b3197955", // Type: String
      "index": 31, // Type: Number
      "topic": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", // Type: String
      "from": "0xf89d7b9c864f589bbf53a82105107622b35eaa40", // Type: String
      "to": "0x1093a4feb3a20af33a4e51365c9de129f7ffdd0c", // Type: String
      "method": "transfer", // Type: String
      "type": "ERC721", // Type: String
      "name": "CryptoBlades", // Type: String
      "symbol": "SKILL", // Type: String
      "decimals": 0, // Type: Number
      "tokenID": 3, // Type: Number
      "created_at": "2022-10-13T13:09:25.574Z", // Type: String
      "value": 1, // Type: Number
      "formattedValue": 1.0 // Type: Float
    }
  ], // Type: Array
  "erc1155Transfers": [
    {
      "address": "0x55d398326f99059ff775485246999027b3197955", // Type: String
      "index": 31, // Type: Number
      "topic": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", // Type: String
      "from": "0xf89d7b9c864f589bbf53a82105107622b35eaa40", // Type: String
      "to": "0x1093a4feb3a20af33a4e51365c9de129f7ffdd0c", // Type: String
      "method": "transfer", // Type: String
      "type": "ERC1155", // Type: String
      "name": "CryptoBlades", // Type: String
      "symbol": "SKILL", // Type: String
      "decimals": 0, // Type: Number
      "tokenID": 3, // Type: Number
      "tokenValue": 32, // Type: Number
      "created_at": "2022-10-13T13:09:25.574Z", // Type: String
      "value": 1, // Type: Number
      "formattedValue": 1.0 // Type: Float
    }
  ], // Type: Array
  "contract_type": "ERC20", // Type: String
  "network": "bsc" // Type: String
}

In this example, our stream sends this data for the specific hash. In this data, the wallet only made an ERC20 transaction and sent Tether. In addition, there is native data in the data. If you want to examine it in more detail yourself, the original transaction data is also available.

Example Webhook Data (Bitcoin)

With this data you can everything you want in your system.

{
  "hash": "693275a1a93a5f5e116f1f64f94a9f362184442fdd0ee7bac51c1e682b37f48b",
  "hex": "0100000000010119884ff853c286333cc418b3c2d3e851f93bd8dd0b32ac06bf74ab26cd3a0ea20100000000ffffffff10441fec00000000002251206e2703df3d00fb011bdfcea9c32992212cf030686495d8b4bbdb0714f976c58e825bac0900000000160014dc6bf86354105de2fcd9868a2b0376d6731cb92fafb33400000000001976a91459e76034fe8e5f1bcce04892313d867a9409937388ac1027000000000000160014963c8de83a73199324e920e0b35833827574ce21803e00000000000017a914e4653a60e35955c24a430f137f9eecb332a79884878b88000000000000160014efb7c91cf4cd80d464f326219fa99d258d548074962b0100000000001600143b3f1ab00c353355a17856c273b33727beace2a520a700000000000017a9147d8ee62b3c18e3b5fa1e5fc2912abd2811822819878d570900000000001976a9145e7c19da9162e09f91b3a570f1dc7592af334df788ac500f1e0000000000160014403eceab580299a001a10fffc5b67f9f2bd78fceef210100000000001976a91470dc07ad27f251e39aeac29341714ee9c25932c888acf0fcf300000000001976a91411b66af16d2c497e1068a2ea989e7fc932527a7c88ac02f53d00000000001600144b28d8248a247b51a0d295ce33fe77e5522fe5969bd9110000000000160014fc65c658c5368bae2334b05d1f73446df0d53df51c250300000000001976a91490a4c85f836ade43f16bcc4518a7178ea47be6d088ac13720000000000001976a914b018fd99222b5fe571fdbf61b62f0e5a8314cc0688ac0247304402200604b53fb2d64af7fa80f86124cd1e9a1cda5e08abcb87f7cf64bb5345b40e35022069574638d2933f8359275171ace9e1f253952abb904c2c1f8cdaf94923e58712012102174ee672429ff94304321cdae1fc1e487edf658b34bd1d36da03761658a2bb0900000000",
  "version": 1,
  "size": 688,
  "vsize": 607,
  "weight": 2425,
  "locktime": 0,
  "inputs": [
    {
      "prevout": {
        "hash": "a20e3acd26ab74bf06ac320bddd83bf951e8d3c2b318c43c3386c253f84f8819",
        "index": 1
      },
      "sequence": 4294967295,
      "script": "",
      "coin": {
        "version": 1,
        "height": 858256,
        "value": 205520479,
        "script": "0014dc6bf86354105de2fcd9868a2b0376d6731cb92f",
        "address": "bc1qm34lsc65zpw79lxes69zkqmk6ee3ewf0j77s3h",
        "type": null,
        "reqSigs": null,
        "coinbase": false
      }
    }
  ],
  "timestamp": 1724509856,
  "outputs": [
    {
      "value": 15474500,
      "script": "51206e2703df3d00fb011bdfcea9c32992212cf030686495d8b4bbdb0714f976c58e",
      "address": "bc1pdcns8heaqraszx7le65ux2vjyyk0qvrgvj2a3d9mmvr3f7tkck8qu5uz84",
      "scriptPubKey": {
        "type": "witness_v1_taproot",
        "reqSigs": null
      }
    },
    {
      "value": 162290562,
      "script": "0014dc6bf86354105de2fcd9868a2b0376d6731cb92f",
      "address": "bc1qm34lsc65zpw79lxes69zkqmk6ee3ewf0j77s3h",
      "scriptPubKey": {
        "type": "witness_v0_keyhash",
        "reqSigs": null
      }
    }
  ],
  "addresses": [
    "bc1pdcns8heaqraszx7le65ux2vjyyk0qvrgvj2a3d9mmvr3f7tkck8qu5uz84",
    "bc1qm34lsc65zpw79lxes69zkqmk6ee3ewf0j77s3h"
  ],
  "fee": 9105,
  "mapped": {
    "inputs": [
      {
        "address": "bc1qm34lsc65zpw79lxes69zkqmk6ee3ewf0j77s3h",
        "value": 205520479
      }
    ],
    "outputs": [
      {
        "address": "bc1pdcns8heaqraszx7le65ux2vjyyk0qvrgvj2a3d9mmvr3f7tkck8qu5uz84",
        "value": 15474500
      },
      {
        "address": "bc1qm34lsc65zpw79lxes69zkqmk6ee3ewf0j77s3h",
        "value": 162290562
      }
    ]
  }
}
PreviousAPI KeyNextStreaming API

Last updated 5 months ago

Was this helpful?

🔄