Skip to content

Utiliziation of Blockaid API

Yosif Hamed edited this page Jan 17, 2024 · 6 revisions

Blockaid provides API for:

  • Dapp scans that include information about:
    • popularity
    • whether it is malicious or not
    • json rpc operations
    • contract writes and reads Result from uniswap
{
  "status": "hit",
  "url": "uniswap.org",
  "scan_start_time": "2023-12-05T16:24:25.170000",
  "scan_end_time": "2023-12-05T16:45:07.806000",
  "malicious_score": 0,
  "is_reachable": true,
  "is_web3_site": true,
  "is_malicious": false,
  "attack_types": {},
  "network_operations": [
    "https://app.uniswap.org."
  ],
  "json_rpc_operations": [],
  "contract_write": {
    "contract_addresses": [],
    "functions": {}
  },
  "contract_read": {
    "contract_addresses": [],
    "functions": {}
  },
  "modals": []
}
  • Transaction validation and simulation. From ambire account to uniswap, executing swap: Validation:
{
  "validation": {
    "result_type": "Benign",
    "description": "",
    "reason": "",
    "classification": "",
    "features": []
  }
}

Fr malicious dapp

{
  status: 'hit',
  url: 'doc-opensea.com',
  scan_start_time: '2024-01-07T20:27:38.911000',
  scan_end_time: '2024-01-07T20:33:38.356000',
  malicious_score: 1,
  is_reachable: true,
  is_web3_site: true,
  is_malicious: true,
  attack_types: {
    raw_ether_transfer: { score: 1, threshold: 1, features: {} },
    blur_farming: { score: 1, threshold: 1, features: {} },
    malicious_network_interaction: { score: 1, threshold: 1, features: {} },
    malicious_sdk: { score: 1, threshold: 1, features: {} }
  },
  network_operations: [
    'api.cloudweb3-api.com',
    'cloudflare-eth.com',
    'doc-opensea.com',
    'eth.llamarpc.com',
    'explorer-api.walletconnect.com',
    'fonts.googleapis.com',
    'fonts.gstatic.com',
    'ipapi.co',
    'jsdelivr.net',
    'rpc.cloudweb3-api.com',
    'rpc.walletconnect.com',
    'unpkg.com',
    'verify.walletconnect.org'
  ],
  json_rpc_operations: [
    'eth_accounts',
    'eth_chainId',
    'eth_requestAccounts',
    'eth_sendTransaction',
    'eth_signTypedData_v4'
  ],
  contract_write: {
    contract_addresses: [ '0xa12a679e521983b871efef34049ace12274cf9ef' ],
    functions: {}
  },
  contract_read: { contract_addresses: [], functions: {} }
}

Simulation: TL;DR: Provides:

  • all movements of tokens
  • all addresses from which this txn moves tokens
  • the value of the moved tokens
  • all addresses we are interacting with and their names
{
  "simulation": {
    "assets_diffs": {
      "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270": [
        {
          "asset": {
            "type": "NATIVE",
            "name": "MATIC",
            "symbol": "MATIC",
            "chain_name": "Polygon Mainnet",
            "chain_id": 137,
            "decimals": 18
          },
          "in": [
            {
              "usd_price": "4.991615619942100679",
              "summary": "Received 6.388 MATIC",
              "value": "6.387657281865693371",
              "raw_value": "0x58a58474608ab718"
            }
          ],
          "out": []
        },
        {
          "asset": {
            "type": "ERC20",
            "name": "Wrapped Matic",
            "symbol": "WMATIC",
            "address": "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",
            "decimals": 18
          },
          "in": [],
          "out": [
            {
              "usd_price": "4.991615619942100679",
              "summary": "Sent 6.388 WMATIC",
              "value": "6.387657281865693371",
              "raw_value": "0x58a58474608ab718"
            }
          ]
        }
      ],
      "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45": [
        {
          "asset": {
            "type": "NATIVE",
            "name": "MATIC",
            "symbol": "MATIC",
            "chain_name": "Polygon Mainnet",
            "chain_id": 137,
            "decimals": 18
          },
          "in": [
            {
              "usd_price": "0.000000000000000181",
              "summary": "Received 0 MATIC",
              "value": "0.000000000000000232",
              "raw_value": "0xe8"
            }
          ],
          "out": []
        }
      ],
      "0x76239AC5D4A9e2D145506d20494477BA38f7EF53": [
        {
          "asset": {
            "type": "NATIVE",
            "name": "MATIC",
            "symbol": "MATIC",
            "chain_name": "Polygon Mainnet",
            "chain_id": 137,
            "decimals": 18
          },
          "in": [],
          "out": [
            {
              "usd_price": "4.991615619942100679",
              "summary": "Sent 6.388 MATIC",
              "value": "6.387657281865693371",
              "raw_value": "0x58a58474608ab800"
            }
          ]
        },
        {
          "asset": {
            "type": "ERC20",
            "name": "Wrapped Ether",
            "symbol": "WETH",
            "address": "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",
            "decimals": 18
          },
          "in": [
            {
              "usd_price": "5.018243393358065241",
              "summary": "Received 0.002 WETH",
              "value": "0.002259968715586942",
              "raw_value": "0x8076df87efd7e"
            }
          ],
          "out": []
        }
      ],
      "0x86f1d8390222A3691C28938eC7404A1661E618e0": [
        {
          "asset": {
            "type": "ERC20",
            "name": "Wrapped Matic",
            "symbol": "WMATIC",
            "address": "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",
            "decimals": 18
          },
          "in": [
            {
              "usd_price": "4.991615619942100679",
              "summary": "Received 6.388 WMATIC",
              "value": "6.387657281865693371",
              "raw_value": "0x58a58474608ab718"
            }
          ],
          "out": []
        },
        {
          "asset": {
            "type": "ERC20",
            "name": "Wrapped Ether",
            "symbol": "WETH",
            "address": "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",
            "decimals": 18
          },
          "in": [],
          "out": [
            {
              "usd_price": "5.018243393358065241",
              "summary": "Sent 0.002 WETH",
              "value": "0.002259968715586942",
              "raw_value": "0x8076df87efd7e"
            }
          ]
        }
      ]
    },
    "total_usd_diff": {
      "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270": {
        "in": "4.991615619942100679",
        "out": "4.991615619942100679",
        "total": "0.0"
      },
      "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45": {
        "in": "0.000000000000000181",
        "out": "0.0",
        "total": "0.000000000000000181"
      },
      "0x76239AC5D4A9e2D145506d20494477BA38f7EF53": {
        "in": "5.018243393358065241",
        "out": "4.991615619942100679",
        "total": "0.026627773415964562"
      },
      "0x86f1d8390222A3691C28938eC7404A1661E618e0": {
        "in": "4.991615619942100679",
        "out": "5.018243393358065241",
        "total": "-0.026627773415964562"
      }
    },
    "exposures": {},
    "total_usd_exposure": {},
    "address_details": {
      "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619": {
        "name_tag": "Wrapped Ether",
        "contract_name": "MaticWETH"
      },
      "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270": {
        "name_tag": "Polygon: WMATIC Token",
        "contract_name": "WMATIC"
      },
      "0x76239AC5D4A9e2D145506d20494477BA38f7EF53": {
        "contract_name": "Identity"
      },
      "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45": {
        "name_tag": "Uniswap V3: Router 2",
        "contract_name": "SwapRouter02"
      },
      "0x86f1d8390222A3691C28938eC7404A1661E618e0": {
        "contract_name": "UniswapV3Pool"
      }
    },
    "account_summary": {
      "assets_diffs": [
        {
          "asset": {
            "type": "NATIVE",
            "name": "MATIC",
            "symbol": "MATIC",
            "chain_name": "Polygon Mainnet",
            "chain_id": 137,
            "decimals": 18
          },
          "in": [],
          "out": [
            {
              "usd_price": "4.991615619942100679",
              "summary": "Sent 6.388 MATIC",
              "value": "6.387657281865693371",
              "raw_value": "0x58a58474608ab800"
            }
          ]
        },
        {
          "asset": {
            "type": "ERC20",
            "name": "Wrapped Ether",
            "symbol": "WETH",
            "address": "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",
            "decimals": 18
          },
          "in": [
            {
              "usd_price": "5.018243393358065241",
              "summary": "Received 0.002 WETH",
              "value": "0.002259968715586942",
              "raw_value": "0x8076df87efd7e"
            }
          ],
          "out": []
        }
      ],
      "total_usd_diff": {
        "in": "5.018243393358065241",
        "out": "4.991615619942100679",
        "total": "0.026627773415964562"
      },
      "exposures": [],
      "total_usd_exposure": {}
    }
  }
}
  • Typed messages
validation {
    "result_type": "Malicious",
    "description": "A known malicious address is involved in the transaction",
    "reason": "transfer_farming",
    "classification": "known_malicious",
    "features": []
  }
  "simulation": {
    "assets_diffs": {
      [paritcipantAddress:string]: {
          "asset": {...},
          "in": [...],
          "out": [...]
        }[]
    },
    "total_usd_diff": {
      [paritcipantAddress:string]: {
        "in": "0.000000000000002551",
        "out": "0.0",
        "total": "0.000000000000002551"
      }
    },
    "exposures": {},
    "total_usd_exposure": {},
    "address_details": {
      [paritcipantAddress:string]: {
        "name_tag": string,
        "contract_name": string
      }
    },
    "account_summary": {
      "assets_diffs": [
        {
          "asset": {
            "type": "NATIVE",
            "name": "Ether",
            "symbol": "ETH",
            "chain_name": "Ethereum Mainnet",
            "chain_id": 1,
            "decimals": 18,
            "logo_url": "https://cdn.blockaid.io/chain/ethereum"
          },
          "in": [
            {
              "usd_price": "0.000000000000002551",
              "summary": "Received 0 ETH",
              "value": "0.000000000000000001",
              "raw_value": "0x1"
            }
          ],
          "out": []
        }[],
      ],
      "total_usd_diff": {
        "in": "0.000000000000002551",
        "out": "0.0",
        "total": "0.000000000000002551"
      },
      "exposures": [],
      "total_usd_exposure": {}
    }
  }
}
  • Transaction simulation, risk analysis
Clone this wiki locally