Skip to main content
In a nutshell
Blockradar’s Smart Contract API enables you to interact with any smart contract directly from your wallet without managing RPC endpoints, signing flows, or contract deployments yourself.
Smart Contracts

Prerequisites

Before using the Smart Contract API, ensure you have:
1

API Key

Get your API key from the Blockradar Dashboard. Navigate to Developers to generate one.
2

Wallet Created

Create a wallet via the Create Wallet API or dashboard. You’ll need the walletId for all smart contract operations.
3

Native Currency Balance

Fund your wallet with native currency (ETH, BNB, MATIC, etc.) to cover gas fees. Use the Network Fee endpoint to estimate costs before executing.

Supported Blockchains

The Smart Contract API supports all EVM-compatible blockchains and Tron available on Blockradar. See Integrations for the complete list of supported networks and faucet links.
Solana is not supported for smart contract interactions. The Smart Contract API only works with EVM-compatible chains and Tron.
Start with testnets during development to avoid spending real funds.

Introduction

The Smart Contract API transforms Blockradar from a wallet infrastructure into a programmable execution layer. You can read contract state, execute contract functions, estimate gas fees, and sign transactions—all through a unified API surface.

Read Operations

Retrieve data from any smart contract on supported blockchains.

Write Operations

Execute smart contract functions with full transaction management.

Fee Estimation

Calculate gas costs before execution to ensure sufficient funds.

Batch Operations

Execute multiple contract calls in a single API request.

Use Cases

The Smart Contract API unlocks powerful capabilities for fintech developers:
  • DeFi Integration: Connect to protocols like Uniswap, Aave, or Compound for yield and liquidity management
  • Treasury Operations: Automate treasury management within your fintech platform
  • Tokenized Assets: Integrate real-world assets into your product flows
  • Programmable Settlements: Execute compliance checks and automated settlements
  • Custom Assets: Manage custom assets, reward systems, and loyalty programs

Master Wallet vs Child Address

The Smart Contract API is available at two levels:

Master Wallet

Execute contract operations directly from your master wallet. Ideal for treasury operations and centralized fund management.

Child Address

Execute contract operations from individual child addresses. Perfect for user-specific operations and segregated fund management.

Master Wallet Endpoints

Child Address Endpoints

Request Structure

All smart contract requests require these parameters:
The reference and metadata fields are only applicable for write operations. Read operations do not support these fields.

Understanding ABIs

The ABI (Application Binary Interface) defines how to interact with a smart contract. You can obtain ABIs from:
  • Block explorers: Etherscan, BscScan, PolygonScan (verified contracts)
  • Protocol documentation: Official docs from DeFi protocols
  • Contract source code: Compile from Solidity source

Reading Contract Data

Use the read endpoint to query contract state without modifying the blockchain.

Master Wallet Read Example

Child Address Read Example

Read Response

Read Error Responses

Writing to Contracts

Execute state-changing functions on smart contracts.

Master Wallet Write Example

Child Address Write Example

Write Response

Write operations are asynchronous. The initial response shows PENDING status. Listen for the custom-smart-contract.success webhook to confirm transaction completion.

Write Error Responses

Estimating Network Fees

Always estimate fees before executing write operations to ensure your wallet has sufficient native currency.

Master Wallet Fee Estimation

Child Address Fee Estimation

Fee Response


Practical Example: Asset Swap on Uniswap

This section demonstrates two approaches to executing an asset swap: without batch operations (sequential calls) and with batch operations (single API call).

Example 1: Asset Swap WITHOUT Batch Operations

This approach makes individual API calls for each step. Use this when you need fine-grained control over each transaction or when operations depend on the results of previous calls.

Step 1: Check Asset Balance

Step 2: Approve Asset Spending

Always wait for the custom-smart-contract.success webhook confirming the approval transaction was mined before executing the swap.

Step 3: Estimate Swap Fees

Step 4: Execute Swap


Example 2: Asset Swap WITH Batch Operations

This approach combines approve + swap into a single API call using the calls array. Use this for efficiency when you want to queue multiple operations together.
Batch operations execute sequentially. Each operation is submitted as a separate transaction, but you only need one API call.

Batch Request: Approve + Swap in One Call

Batch Response

Handling Partial Failures in Batch

Batch Operation Rules

When to Use Each Approach


Webhook Events

Smart contract operations trigger webhook notifications:

Webhook Payload

Best Practices

Security

  • Verify contract addresses: Always double-check contract addresses before interacting
  • Use trusted ABIs: Obtain ABIs from verified sources like block explorers
  • Set reasonable limits: Use slippage protection and amount caps for DeFi operations

Gas Management

  • Estimate before executing: Always call the network-fee endpoint first
  • Monitor native balance: Ensure sufficient ETH/BNB/MATIC for gas fees
  • Use batch operations: Reduce overhead by batching related operations

Error Handling

  • Implement webhook listeners: Don’t rely solely on API responses
  • Handle partial failures: Check both success and errors arrays in batch responses
  • Retry with backoff: Implement exponential backoff for transient failures

API Reference

Master Wallet Endpoints

Child Address Endpoints

Support

The Smart Contract API enables you to build sophisticated blockchain integrations without managing infrastructure complexity. Start with simple read operations and gradually incorporate write operations as you become familiar with the system.