Back to Basic_smart contract 'Hello World'


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;

图片发自简书App

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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,991评论 19 139
  • 我的个人博客 http://yedingding.com 会更新 Teahour.fm 的最新音频文本,欢迎关注。...
    叶玎玎阅读 1,046评论 0 2
  • 周末的早上,北苑的小伙伴们享受了在奥森公园的瑜伽晨练,个个练的小脸红扑扑的,整个人都神清气爽 。之后就直接留在奥森...
    泥沙_燕子阅读 158评论 0 2
  • 我见过许多人, 可是你是我记忆的印记。
    风静了阅读 268评论 0 0