Skip to main content

Overview

Read from and write to smart contracts on EVM chains using the WriteContractInput API.

Prerequisites

Write to a Contract

Common Contract Patterns

Minting NFTs

Staking Tokens

Swapping Tokens (DEX)

Read from a Contract

ABI Parsing Helper

Best Practices

  • Validate contract addresses before calling
  • Handle ABI parsing errors gracefully
  • Cache ABIs to avoid repeated parsing
  • Verify argument types match ABI
  • Test contracts on testnet first

Error Handling

Troubleshooting

Invalid ABI: Ensure JSON is properly formatted with quotes and commas Type mismatch: Pass address/uint256 as String, bool as Boolean, bytes as hex String Contract reverts: Check requirements, permissions, input ranges, and contract state

What’s Next

Last modified on February 3, 2026