Welcome Zstake Service
0G Labs
0gchain Contract Deployment
Copy

0G Chain is an EVM-compatible blockchain, with the current version supporting compatibility with Geth 1.10 and the Istanbul upgrade. This means you can generate and deploy contracts just as you would on any EVM chain, taking advantage of the tools and processes you’re already familiar with..
- install & Contract Generator
1sudo snap install solc --edge
solc (edge) develop from Ethereum Build Automation (builds-c) installed
1export PATH=$PATH:/snap/bin
ex) edit contract.sol
1nano contract.sol
1// SPDX-License-Identifier: MIT
2pragma solidity ^0.8.0;
3contract Your_Contract Name {
4 string public name = "Your_Contract Name";
5 string public symbol = "Your_Contract Symbol";
6 uint8 public decimals = 18;
7 uint256 public totalSupply;
8 mapping(address => uint256) public balanceOf;
9 mapping(address => mapping(address => uint256)) public allowance;
10 event Transfer(address indexed from, address indexed to, uint256 value);
11 event Approval(address indexed owner, address indexed spender, uint256 value);
12 constructor() {
13 totalSupply = 1_000_000_000 * 10 ** uint256(decimals);
14 balanceOf[msg.sender] = totalSupply;
15 emit Transfer(address(0), msg.sender, totalSupply);
16 }
17 function transfer(address _to, uint256 _value) public returns (bool success) {
18 require(_to != address(0), "Invalid address");
19 require(balanceOf[msg.sender] >= _value, "Insufficient balance");
20 balanceOf[msg.sender] -= _value;
21 balanceOf[_to] += _value;
22 emit Transfer(msg.sender, _to, _value);
23 return true;
24 }
25 function approve(address _spender, uint256 _value) public returns (bool success) {
26 allowance[msg.sender][_spender] = _value;
27 emit Approval(msg.sender, _spender, _value);
28 return true;
29 }
30 function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
31 require(_to != address(0), "Invalid address");
32 require(balanceOf[_from] >= _value, "Insufficient balance");
33 require(allowance[_from][msg.sender] >= _value, "Allowance exceeded");
34 balanceOf[_from] -= _value;
35 balanceOf[_to] += _value;
36 allowance[_from][msg.sender] -= _value;
37 emit Transfer(_from, _to, _value);
38 return true;
39 }
1solc --evm-version istanbul --bin --abi contract.sol

1000007744.png

1000007746.png
1copy Binary & Json ABI
- Contract Deployment by 0G Scan

1000007748.png
• Contract Deplroyment Submit

1000007750.png

1000007755.png
• Check Contract

1000007739.png