[EOS学习笔记]Hello World

in #eos5 years ago (edited)

创建一个新合约文件hello
touch hello.cpp

01 hellocpp.png

编译合约文件
eosio-cpp hello.cpp -o hello.wasm

02 cpp.png

cleos wallet keys
04 cleoswalletkeys.png

注意,执行这里需要确保钱包(wallet)的状态为unlock状态

创建hello账户
cleos create account eosio hello YOUR_PUBLIC_KEY -p eosio@active

05 cleos create account hello.png

cleos set contract hello contracts/hello -p hello@active
06 setcontract.png

cleos push action hello hi '["rivalhw"]' -p bob@active
07 hellorivalhw.png

cleos push action hello hi '["rivalhw"]' -p alice@active
07-2 hellorivalhw.png

稍微修改下hello合约内容
08 newhello.png

重新编译合约文件
09 recompile.png

cleos set contract hello contracts/hello -p hello@active
10 setcontract2.png

cleos push action hello hi '["bob"]' -p alice@active
11.png

用正确的方式重新打开
cleos push action hello hi '["alice"]' -p alice@active
12.png
果然,如你所愿 :)

我在测试的时候,总出现一些莫名其妙的问题,后来才发现是因为没有正常退出nodeos引起的,有时候replay后就可以,有时候甚至连 hard replay 也不可以,无奈之下只好delete all blocks

pkill nodeos
03 nodeosuccessexit.png

Sort:  

Thank you so much for participating in the Partiko Delegation Plan Round 1! We really appreciate your support! As part of the delegation benefits, we just gave you a 3.01% upvote! Together, let’s change the world!

早上好大伟🌻🌻🌻

来自于 [WhereIn Android] (http://www.wherein.io)

Coin Marketplace

STEEM 0.25
TRX 0.11
JST 0.032
BTC 63576.35
ETH 3066.39
USDT 1.00
SBD 3.80