搭建EOS私链

  |   1 评论   |   345 浏览

一、 使用wget下载EOS私链的rpm

wget https://github.com/eosio/eos/releases/download/v1.4.4/eosio-1.4.4-1.el7.x86_64.rpm

 

安装:sudo yum install ./eosio-1.4.4-1.el7.x86_64.rpm

 

初始化链:删除/root/eosio-wallet//eosio/data/*

(第一次无需初始化,清链时用到)

 

二、 启动服务

启动钱包服务:keosd &

启动节点:nodeos -e -p eosio --plugin eosio::producer_plugin --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin --plugin eosio::http_plugin -d /eos/contracts/eosio/data --config-dir /eos/contracts/eosio/config --access-control-allow-origin=* --contracts-console --http-validate-host=false —filter-on=‘*’ >> nodeos.log 2>&1 &

 

(之前启动过服务的话cleos wallet list可能会看不到钱包,需要cleos wallet open,然后再cleos wallet unlock,输入第一次创建钱包的密码)

 

三、 创建钱包

cleos wallet create --to-console

 

导入eosio开发密钥:5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3

cleos wallet import

 

创建密钥对:cleos create key --to-console

保存好密钥对,导入私钥,放到钱包去管理

 

 

四、 创建用户

cleos create account ${old_account} ${new_account} ${owner_publicKey} ${active_publicKey}

 

五、 初始化eosio.token

cleos set contract ${account} ${abi and wasm path} -p ${account}

eg: cleos set contract eosio.token /eos/eosio.token -p eosio.token

 

六、 创建代币

cleos push action eosio.token create '{"issuer":"eosio","maximum_supply":"1000000000.0000 EOS"}' -p eosio.token

 

七、发行100.0000 tokenwenbo,备注memo

cleos push action eosio.token issue '[ "wenbo", "100.0000 EOS", "memo" ]' -p eosio

 

八、 使用wenbo部署pickown合约

cleos set contract wenbo /eos/pickown -p wenbo

 

 

九、将wenbo账户的eosio.code权限赋给wenbo所部署的合约pickown

cleos set account permission wenbo active '{"threshold": 1,"keys": [{"key": "EOS6yZZuMmHDuiQ9qigbGCdEW5D5SU9ESW71nUwBUFrnGxtHnZEp3","weight": 1}],"accounts": [{"permission":{"actor":"wenbo","permission":"eosio.code"},"weight":1}]}' owner -p wenbo

 

十、 转账

cleos push action eosio.token transfer '[${from}, ${to}, "100000.0000 EOS", "memo"]' -p wenbo


作者:wenbo

评论

发表评论