Build on Onchain AI

For the Builders

Given the EVM compatibility of Onchain AI, deploying smart contracts to the platform is straightforward for developers familiar with Ethereum's ecosystem. One of the most widely used tools for this purpose is Remix. Below, you'll find a guide on deploying smart contracts on Onchain AI using Remix.


Prerequisites:

  1. A smart contract written in Solidity.

  2. The Onchain AI Wallet or a compatible web3 wallet with OCAI tokens on the testnet or mainnet.

  3. Familiarity with Remix and its interface.

Deployment Process:

1. Access Remix:

Open your web browser and navigate to remix.ethereum.org.

2. Load Your Smart Contract:

Click on the + button (located top-left) to create a new file, then paste your Solidity code. Ensure that the compiler version in Remix matches the one specified in your smart contract.

3. Compilation:

  • Navigate to the Solidity Compiler tab.

  • Click on the Compile button.

  • After successful compilation, any warnings or errors will be displayed. Address them before deploying.

4. Connect to Onchain AI:

  • Move to the Deploy & Run Transactions tab.

  • From the Environment dropdown, select Injected Web3. This option leverages the web3 provider injected by your Onchain AI Wallet (or a compatible wallet).

  • Confirm that Remix now displays the correct network (OCAI Testnet) and your account address.

5. Deploy:

  • Select the contract you wish to deploy from the Contract dropdown.

  • If your contract has a constructor that requires arguments, provide them.

  • Click on the Deploy button.

  • A confirmation window from your wallet will appear. Confirm the transaction details and gas fee, then approve the transaction.

6. Contract Interaction:

Once deployed, your contract will be listed under the Deployed Contracts section in Remix. Here, you can interact with your contract's functions directly.

7. Verification:

To verify your smart contract and see its details, head over to the Onchain AI Testnet Explorer at explorertest.onchain-ai.com. Input your contract's address to view transactions, function calls, and other associated details.


Deploying smart contracts to Onchain AI using Remix provides a familiar and efficient process for developers. Thanks to the EVM compatibility of Onchain AI, the transition for developers from Ethereum or other EVM-compatible chains is seamless.

Last updated