EVM Smart Contracts Guide

Cypherium
Cypherium
Published in
3 min readAug 17, 2021

--

Dear CypherTroophers,

We hope you enjoyed our latest post on a how-to guide for mining Cypherium! Today, we bring to the community an instruction guide for EVM smart contracts deployment. Without further ado, let’s get straight into it!

Write a contract in solidity:

Now let’s write our first smart contract. The solidity code is shown below:

contract hello{
string greeting;
//Constructor function
function hello(string_greeting) public{
greeting = _greeting;
}
//Get greeting, gas not required
function getGreeting() constant public returns (string){
return greeting;
}
//Set greeting, gas required
function setGreeting(string_greeting) public payable{
greeting = _greeting;
}
}

Compiling the contract code:

Open this following link in your website browser: click here. Afterwards, copy the code for our first smart contract into the editor:

Cope the code into the editor. If there is no error, click the blue compile button (Compile xxx.sol) to compile the contract code.

If compiling succeeded, then click Compilation Details. The following window should pop up:

Scroll down to WEB3DEPLOY. It will look like this:

Copy this to the local editor.

Deploying Contracts:

Extract the abi section, and replace eth with cph:

Copy to console:

Show the deployment status of hello:

The contractAddress is the deployed address of the contact. The cph.txBlocknNumber indicates that a new transaction record has been generated.

Call hello.getGreeting() command and we can get our result:

Change the variables on the contract:

You can see that a new transaction record has been generated and the output of the contract has been changed.

About Cypherium

Cypherium is a decentralized smart contract platform for creating and connecting dApps, CBDCs (Central Bank Digital Currencies), Enterprise Applications, and Digital Assets. We are one of the first blockchain companies with real, tangible blockchain applications in partnership with industry-leading enterprises and government institutions.

Website | Telegram | Twitter | Github | Whitepaper | Reddit | LinkedIn | Facebook

--

--