Setup Solidity ABI
To make your ink! contract compatible with Ethereum tooling, you need to configure it to generate a Solidity-compatible ABI. This allows you to use tools like MetaMask, Hardhat, and Wagmi with your ink! contracts.
Prerequisites
Before starting, ensure you have the latest tools installed by following the setup instructions.
Create and Configure Your Contract
- Create a new ink! contract
cargo contract new flipper_evm
cd flipper_evm
- Configure Solidity ABI generation in your
Cargo.toml
. Change:
[package.metadata.ink-lang]
abi = "ink"
to:
[package.metadata.ink-lang]
abi = "sol"
Build with Solidity Metadata
Build your contract with Solidity metadata support:
cargo contract build --release --metadata solidity
This command will generate:
- The standard ink! contract artifacts
- A Solidity-compatible ABI file
- Metadata that can be used with Ethereum tools
Understanding the Output
After building, you'll find additional files in your target/ink/
directory:
*.abi
- Solidity ABI file compatible with Ethereum tooling for contract interaction.*.json
- Contract metadata compatible with Ethereum tooling for reproducible builds and contract verification.
Next Steps
With Solidity ABI configured, you can now:
- Set up MetaMask to connect to Polkadot networks
- Use Hardhat for deployment and interaction
- Build frontends with Wagmi