安装boost
网页下载boost最新包
替换script/eosio_build_ubuntu.sh 中boost下载逻辑
将下载好的boost压缩包放在 /tmp/ 目录中 ,这样可以跳过下载,直接解压
注:boost学习网站
下载MongoDB
下载MongoDB 3.6.3
同样的办法修改下载逻辑
下载MongoDB Driver
下载MongoDB driver 1.9.3
同样的方法修改下载配置
安装编译EOS
git clone https://github.com/EOSIO/eos.git --recursive
cd eos
sudo ./eosio_build.sh
部署测试
//创建密钥对
cleos create key
Private key: 5KAST477BmcGQos8vt87vP8Jc8tFtvpL4LH4nQicyHgGG3Tqibr
Public key: EOS7S98x8ERfCLFJDtEC2NN78oEFR6uoZ9cgekDFwARLs12bFgs4v
//创建钱包
cleos wallet create -n mywallet
"PW5JYv6rA1N5N8PiEFms3bNBp9XFqfvdjYFNSqqbcSdEDcBCNsWxJ"
PW5JYv6rA1N5N8PiEFms3bNBp9XFqfvdjYFNSqqbcSdEDcBCNsWxJ 钱包密码 mywallet
//将私钥导入钱包
cleos wallet import -n mywallet 5KAST477BmcGQos8vt87vP8Jc8tFtvpL4LH4nQicyHgGG3Tqibr
//创建合约账户
cleos create account eosio hello EOS7S98x8ERfCLFJDtEC2NN78oEFR6uoZ9cgekDFwARLs12bFgs4v EOS7S98x8ERfCLFJDtEC2NN78oEFR6uoZ9cgekDFwARLs12bFgs4v
//部署默认合约
cleos set contract hello ~/Desktop/eos/build/contracts/eosio.token -p hello
//创建密钥对
cleos create key
Private key: 5JDXCgQUQyM8D2KFdhZaYMh7A8XkamTyU9y14AkTdbcSbAVji8F
Public key: EOS6QtKNJm4hSXAfV5YW9trB1vzAWNSysPsNFPkoJM9B3CCfQxvhH
//将私钥导入钱包
cleos wallet import -n mywallet 5JDXCgQUQyM8D2KFdhZaYMh7A8XkamTyU9y14AkTdbcSbAVji8F
//创建User1账户
cleos create account hello user1 EOS6QtKNJm4hSXAfV5YW9trB1vzAWNSysPsNFPkoJM9B3CCfQxvhH EOS6QtKNJm4hSXAfV5YW9trB1vzAWNSysPsNFPkoJM9B3CCfQxvhH
//创建密钥对
cleos create key
Private key: 5Jvk2qwRBZsLnUkXMXtWdZ2HkQceF98nJTtPDMev6ngLKuDUd1v
Public key: EOS6zhe2Ni8m77JZ1EeHbJ2gkjb1t6rsET67wzZLDdXD1FkW37s9u
//将私钥导入钱包
cleos wallet import -n mywallet 5Jvk2qwRBZsLnUkXMXtWdZ2HkQceF98nJTtPDMev6ngLKuDUd1v
//创建User1账户
cleos create account hello user2 EOS6zhe2Ni8m77JZ1EeHbJ2gkjb1t6rsET67wzZLDdXD1FkW37s9u EOS6zhe2Ni8m77JZ1EeHbJ2gkjb1t6rsET67wzZLDdXD1FkW37s9u
//查询钱包余额
cleos get table hello user1 accounts
cleos get table hello user2 accounts
//调用合约设置发放总额
cleos push action hello create '["eosio","10000000000.0000 EOS",0,0,0]' -p hello -x "1000"
//调用合约发放个User1 100EOS
cleos push action hello issue '[ "user1", "100.0000 EOS", "to user1" ]' -p eosio
//查询User1钱包余额
cleos get table hello user1 accounts
//调用合约User1转账给User250
cleos push action hello transfer '[ "user1", "user2", "50.0000 EOS", "user1 to user2" ]' -p user1
//查询User1钱包余额
cleos get table hello user1 accounts
//查询User2钱包余额
cleos get table hello user2 accounts
//查询Hello账户上部署的合约
cleos get code hello
//查询当前钱包所有的密钥对
cleos wallet keys
除了创建账户有区别其他与4.0并没有区别
//查询版本号
cleos version client
查询交易失败
//trx 为null
cleos get transaction 2f18d1e22aad7849d159a33de09acfc7f24233370a64cf46efdd58ca3946a356
{
"id": "2f18d1e22aad7849d159a33de09acfc7f24233370a64cf46efdd58ca3946a356",
"trx": null,
"block_time": "2000-01-01T00:00:00.000",
"block_num": 0,
"last_irreversible_block": 7544,
"traces": []
}
//git上对这个问题有个issue https://github.com/EOSIO/eos/issues/3583
cleos wallet unlock -n mywallet --password password
//加上--filter-on "*" 就可以查询到交易了
nodeos -e -p eosio --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin --filter-on "*"
cleos get actions user1 -j