Development Environment and Tools
Necessary tools to start writing EVM contracts
Last updated
Was this helpful?
Necessary tools to start writing EVM contracts
Last updated
Was this helpful?
The value of gas price for a transaction must be in multiples of 10^9. The minimum value is 2500*10^9.
EVM smart contracts are written using . You can reuse existing Ethereum contract frameworks to develop and deploy EVM contracts.
is an open source development environment for EVM contracts. Remix IDE documentation is .
We will now go through an example of a Hello World contract development using Remix.
First, locate and activate "Solidity Compiler" and "Deploy and Run Transactions" in PLUGIN MANAGER.
Then, select Solidity environment. Create a new file and name it HelloWorld.sol. Then copy the code of and paste it in the file just created.
Click on the Solidity Compiler button, select compiler version to 0.5.10 and start compiling HelloWorld.sol
The contract is ready to deploy on Ontology after compiling. Here we deploy it on Ontology TestNet.
Select "Custom RPC" in MetaMask networks settings. Fill in and save the info below.
Network name: Ontology TestNet
Node URL: https://polaris1.ont.io:10339
or https://polaris2.ont.io:10339
or https://polaris3.ont.io:10339
or https://polaris4.ont.io:10339
Chain ID: 5851
Finally, select "Injected Web3" in Remix. Click "Deploy" to finish.
Now you can call the method in this contract. The string hello
is saved in the contract when you deploy it, you can call the method message
to query this string:
First, initialize and install dependencies.
Then run this command to install Truffle.
Create a new .secret
to store the mnemonic phrase or private key (which can be found in MetaMask).
Edit the code of truffle-config as below.
Run this command to deploy the contract on the Ontology network.
If successful, you will see the result below.
Note: Avoid using ETH units (e.g. wei, gwei, ether, etc.) when writing test scripts.
Create a new .secret
file to save your private key.
Update the code of hardhat.config.js as shown below:
Deploy Contract
Run this command in root of the project directory to deploy the contract on Ontology Chain:
The result looks like this:
MainNet
Item
Description
NetworkName
Ontology MainNet
chainId
58
Gas Token
ONG Token
RPC
https://dappnode1.ont.io:10339
,
https://dappnode2.ont.io:10339
,
https://dappnode3.ont.io:10339
,
https://dappnode4.ont.io:10339
,
http://dappnode1.ont.io:20339
, http://dappnode2.ont.io:20339
, http://dappnode3.ont.io:20339
, http://dappnode4.ont.io:20339
Block Explorer
TestNet
Item
Description
NetworkName
Ontology TestNet
chainId
5851
Gas Token
ONG Token
RPC
https://polaris1.ont.io:10339
, https://polaris2.ont.io:10339
,
https://polaris3.ont.io:10339
,
https://polaris4.ont.io:10339
Block Explorer
Name
Address
ONG
0x00000000000000000000000000000000000000000
Blockchain Explorer URL: ""
Truffle offers tools and frameworks for EVM contract development, testing and management. You can find more details .
Now we will demonstrate how to use Truffle with this .
(comes with Node)
Hardhat is an Ethereum development environment. We will use this as an example and demonstrate how to use Hardhat.
Please refer to for details on this step.
Ontology EVM contracts consume ONG as gas fee for execution. You can apply for TestNet ONG .
Please refer to this .