Deploy Contracts
This guide explains how to deploy a smart contract to the Artela EVM++ chain using Remix. Follow these steps to ensure a smooth deployment.
Prerequisites
Before starting, make sure you have:
MetaMask Wallet
- Installed and configured.
- Connected to the Artela EVM++ chain with the correct RPC endpoint.
Example configuration:
- Network Name:
Artela EVM++
- RPC URL:
https://rpc.artela.network
- Chain ID:
11820
(Note that the chain ID of the artela EVM++ chain is the middle part of the chain ID in the configured cosmos format, such as artroll_11820-1) - Currency Symbol:
ART
Remix IDE
- Accessible at https://remix.ethereum.org.
- Installed browser extensions if needed for better performance.
Test Funds
- Acquire ART tokens for gas fees via the Artela faucet or other sources.
Step 1: Write or Import Your Contract
- Open Remix IDE.
- In the "File Explorer" panel, create a new file or import an existing contract. For example, a simple
HelloWorld.sol
contract:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract HelloWorld {
string public message;
constructor(string memory _message) {
message = _message;
}
function updateMessage(string memory _newMessage) public {
message = _newMessage;
}
}
- Save the file.
Step 2: Compile the Contract
- Go to the "Solidity Compiler" plugin in Remix.
- Select the appropriate compiler version (e.g.,
0.8.0
) to match your contract's pragma. - Click "Compile HelloWorld.sol."
- Ensure there are no errors before proceeding.
Step 3: Connect MetaMask to Remix
- Open the "Deploy & Run Transactions" plugin in Remix.
- Under the "Environment" dropdown, select "Injected Provider - MetaMask."
- MetaMask will prompt you to connect to Remix. Approve the connection.
Step 4: Deploy the Contract
- Verify the "Account" dropdown in Remix shows your MetaMask account.
- Select the compiled contract from the "Contract" dropdown (e.g.,
HelloWorld
). - Provide any constructor arguments in the input field, if required.
- For the
HelloWorld
contract, you can enter"Hello, Artela!"
.
- For the
- Click "Deploy."
MetaMask will display a transaction confirmation dialog. Review the details and confirm the transaction.
Step 5: Verify Deployment
- After deployment, the contract address will appear in the Remix "Deployed Contracts" section.
- Copy the contract address and verify it using Artela's blockchain explorer (e.g., Blockscout).
- Visit Artela Explorer and search for the contract address.
Step 6: Interact with the Contract
- In Remix, expand the deployed contract.
- Use the available functions to interact with the contract. For example:
- Call
message()
to view the current message. - Call
updateMessage("New message")
to update the message.
- Call
Troubleshooting
- Gas Errors: Ensure your wallet has enough ART tokens.
- Compilation Errors: Check for syntax or version mismatches in the Solidity code.
- RPC Errors: Verify your MetaMask network configuration matches the Artela EVM++ settings.