6.0 KiB
Remix IDE Deployment Guide - ChainID 138
Date: 2025-01-12
Purpose: Guide for deploying contracts via Remix IDE when direct deployment fails
Overview
Remix IDE provides an alternative deployment method that may work when direct forge deployment fails. This guide walks through deploying contracts to ChainID 138 using Remix IDE.
Prerequisites
-
Remix IDE Access
- Visit: https://remix.ethereum.org
- No account required (works in browser)
-
Network Configuration
- RPC Endpoint:
http://192.168.11.250:8545 - ChainID: 138
- Network Name: DBIS Chain
- RPC Endpoint:
-
Deployer Account
- Private Key: (from
.envfile) - Address:
0x4A666F96fC8764181194447A7dFdb7d471b301C8 - Balance: 999M+ ETH
- Private Key: (from
Step-by-Step Deployment
Step 1: Connect to Remix IDE
- Open browser and navigate to: https://remix.ethereum.org
- Wait for Remix IDE to load completely
Step 2: Create Contract File
- In Remix IDE, click "File Explorer" in the left sidebar
- Click "Create New File"
- Name the file:
MockLinkToken.sol - Copy the contract code:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
contract MockLinkToken {
string public name = "Chainlink Token";
string public symbol = "LINK";
uint8 public decimals = 18;
uint256 public totalSupply;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
constructor() {
totalSupply = 1000000000 * 10**18; // 1 billion tokens
balanceOf[msg.sender] = totalSupply;
emit Transfer(address(0), msg.sender, totalSupply);
}
function transfer(address to, uint256 value) external returns (bool) {
require(balanceOf[msg.sender] >= value, "Insufficient balance");
balanceOf[msg.sender] -= value;
balanceOf[to] += value;
emit Transfer(msg.sender, to, value);
return true;
}
function approve(address spender, uint256 value) external returns (bool) {
allowance[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function transferFrom(address from, address to, uint256 value) external returns (bool) {
require(balanceOf[from] >= value, "Insufficient balance");
require(allowance[from][msg.sender] >= value, "Insufficient allowance");
balanceOf[from] -= value;
balanceOf[to] += value;
allowance[from][msg.sender] -= value;
emit Transfer(from, to, value);
return true;
}
}
Step 3: Compile Contract
- Click "Solidity Compiler" in the left sidebar
- Select compiler version: 0.8.19 (or compatible)
- Click "Compile MockLinkToken.sol"
- Wait for compilation to complete (check for green checkmark)
Step 4: Configure Network Connection
- Click "Deploy & Run Transactions" in the left sidebar
- Under "Environment", select "Injected Provider - MetaMask" or "Custom"
- If using Custom:
- Click "Add Network"
- Network Name:
DBIS Chain - RPC URL:
http://192.168.11.250:8545 - Chain ID:
138 - Currency Symbol:
ETH - Block Explorer:
https://explorer.d-bis.org
Step 5: Connect Wallet
-
If using MetaMask:
- Click "Connect to MetaMask"
- Approve connection in MetaMask
- Ensure correct account is selected
-
If using Custom Provider:
- Enter your private key (from
.envfile) - ⚠️ WARNING: Only use in secure environment
- Click "Connect"
- Enter your private key (from
Step 6: Deploy Contract
-
In "Deploy & Run Transactions":
- Select contract: "MockLinkToken"
- Constructor parameters: (none required)
- Click "Deploy"
-
Wait for deployment:
- Transaction will appear in transaction list
- Wait for confirmation
- Check transaction status
Step 7: Verify Deployment
- After deployment, contract address will appear
- Click on contract address to view details
- Test contract functions:
name()- Should return "Chainlink Token"symbol()- Should return "LINK"totalSupply()- Should return 1000000000000000000000000000
Troubleshooting
Issue: Cannot Connect to Network
Solution:
- Verify RPC endpoint is accessible:
http://192.168.11.250:8545 - Check if network allows external connections
- Try using MetaMask with custom network
Issue: Transaction Fails
Solution:
- Check deployer account balance
- Verify gas settings (increase gas limit if needed)
- Check transaction status on block explorer
Issue: Contract Not Deployed
Solution:
- Verify transaction was actually sent
- Check block explorer for transaction
- Review Remix console for errors
Alternative: Minimal Contract Test
If full contract fails, try deploying a minimal contract first:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
contract TestMinimal {
uint256 public x = 1;
function setX(uint256 _x) external {
x = _x;
}
}
This minimal contract (204 bytes) can help verify if the issue is contract-specific or network-wide.
Security Notes
-
Private Key Security
- Never share your private key
- Only use Remix IDE in secure environment
- Consider using MetaMask instead of direct private key
-
Network Security
- Verify RPC endpoint is legitimate
- Check network configuration before connecting
- Be cautious with test networks
Next Steps
After successful deployment:
-
Save Contract Address
- Copy deployed contract address
- Update
.envfile with new address - Update configuration files
-
Verify Contract
- Use block explorer to verify contract
- Check contract bytecode matches source
- Verify constructor parameters
-
Test Contract Functions
- Test all contract functions
- Verify contract behavior
- Check event emissions
Last Updated: 2025-01-12