August 2018
Intermediate to advanced
404 pages
11h 19m
English
For writing data to smart contracts, we have to follow this procedure:
pragma solidity ^0.4.21;contract HelloWorld { // State variable string textToPrint = "hello world"; // State changing function function changeText(string _text) public { textToPrint = _text; } // Read-only function function printSomething() public view returns (string) { return textToPrint; }}
// For v0.2x.xvar helloWorld = web3.eth.contract(<ABI>); var helloWorldInstance = helloWorld.at("<Address>");// For v1.x.xvar helloWorldInstance = new web3.eth.