美文网首页
Back to Basic_smart contract 'H

Back to Basic_smart contract 'H

作者: Olly_Zhang | 来源:发表于2018-09-30 00:10 被阅读0次


    Env preparation:

    Node : v8.9.0

    Npm: 5.5.1

    mkdir smartcontract including two files package. jsonHello.sol

    smartcontract

    ├── Hello.sol

    └── package.json

    Edit package.json

    fs module :  provides an API for interacting with the file system

    solc module: solidity smart contract compiler

    web3: package tool provided from Ethereum, used to communicate with smart contract.

    Step 1 : smart contract writing

    open Hello.sol

    Step 2: smart contract compile

    open deploy.js

    ABI: Application Binary Interface. An interface between two binary program modules; often, one of these modules is a library or operating system facility, and the other is a program that is being run by a user.

    Step 3: Smart Contract Deploy

    $node deploy.js

    compileCode

    Open a new terminal and run ganache-cil, you should see all the transactions logs here;

    Back to Basic_smart contract 'Hello World'

    Arrow points to contract address: 0xbf474d24ba8b19811db5deb51137ddccbe3ff288;

    Step 4:Smart Contract invoke

    Writing code to call function say() for testing. Build new file called run.js

    $node run.js

    You should be able to see 'Hello world' in the terminal

    In summary

    One contract experiences four stages :  contract writing -> compile-> deploy-> call

    相关文章

      网友评论

          本文标题:Back to Basic_smart contract 'H

          本文链接:https://www.haomeiwen.com/subject/xofioftx.html