eos节点部署

Eos 节点部署

git clone https://github.com/eosio/eos.git --recursive

cd /data/eos/scripts

sudo ././eosio_build.sh   #需要3个小时左右

Eos 节点启动命令

./nodeos -e -p eosio --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin
curl http://127.0.0.1:8888/v1/chain/get_info
sudo ./cleos  get info

相关配置文件

./home/superuser/eosio-wallet/config.ini
./home/superuser/.local/share/eosio/nodeos/config/config.ini

创建默认钱包

cd /data/eos/build/programs/cleos/

sudo ./cleos wallet create --to-console

钱包密码

    "PW5K9ePxXHv6dWHcuLAudL6HUSa97M8u4BKDLAu15TMpL1ApsaPRr"

解锁钱包
    
    sudo ./cleos wallet unlock
    PW5K9ePxXHv6dWHcuLAudL6HUSa97M8u4BKDLAu15TMpL1ApsaPRr

生成密钥对

sudo ./cleos create key --to-console

Private key: 5J5N4U8npr4hnxRtYfMWpiHDuLt3zYWScSzBvTvaCntQPByvU6e
Public key: EOS5YuLqQ6Si9LPw6deueCPg8m4t5sp1NvUFcJ6Ssb6DU3yJxxoDQ

Private key: 5HqcwfFKhRpK22a8tenJBEsogpshJDCcxrrXqtLssfHxmHHcLtZ
Public key: EOS6tErA2V2moSgFcbij58JhWtphPdAeVQXPsxTe8FKTAWTiDwdXx

Private key: 5KKSd33B6afa22EcXReTYs5CeoFWrLUL3uV735CYWFDr2BAxSx8
Public key: EOS8Hr4u2WTiVBh6wecyTGWtQzphAjmq2CSXDUubLwKM7zmmtEgzv

私钥导入钱包(导入私钥后会自动给出对应的公钥)

sudo ./cleos wallet import --private-key 5J5N4U8npr4hnxRtYfMWpiHDuLt3zYWScSzBvTvaCntQPByvU6e
sudo ./cleos wallet import --private-key 5HqcwfFKhRpK22a8tenJBEsogpshJDCcxrrXqtLssfHxmHHcLtZ
sudo ./cleos wallet import --private-key 5KKSd33B6afa22EcXReTYs5CeoFWrLUL3uV735CYWFDr2BAxSx8

查看钱包中的密钥对

sudo ./cleos wallet keys

发行代币:

在部署eosio.EOStem合约之前,必须先创建如下账户,创建账号使用eosio的公私钥对:
EOStemAccounts = [
    'eosio.bpay',
    'eosio.msig',
    'eosio.names',
    'eosio.ram',
    'eosio.ramfee',
    'eosio.saving',
    'eosio.stake',
    'eosio.token',
    'eosio.upay',
]

命令如下:

    sudo ./cleos create account eosio eosio.bpay EOS5YuLqQ6Si9LPw6deueCPg8m4t5sp1NvUFcJ6Ssb6DU3yJxxoDQ;
    sudo ./cleos create account eosio eosio.msig EOS5YuLqQ6Si9LPw6deueCPg8m4t5sp1NvUFcJ6Ssb6DU3yJxxoDQ;
    sudo ./cleos create account eosio eosio.names EOS5YuLqQ6Si9LPw6deueCPg8m4t5sp1NvUFcJ6Ssb6DU3yJxxoDQ;
    sudo ./cleos create account eosio eosio.ram EOS5YuLqQ6Si9LPw6deueCPg8m4t5sp1NvUFcJ6Ssb6DU3yJxxoDQ;
    sudo ./cleos create account eosio eosio.ramfee EOS5YuLqQ6Si9LPw6deueCPg8m4t5sp1NvUFcJ6Ssb6DU3yJxxoDQ;
    sudo ./cleos create account eosio eosio.saving EOS5YuLqQ6Si9LPw6deueCPg8m4t5sp1NvUFcJ6Ssb6DU3yJxxoDQ;
    sudo ./cleos create account eosio eosio.stake EOS5YuLqQ6Si9LPw6deueCPg8m4t5sp1NvUFcJ6Ssb6DU3yJxxoDQ;
    sudo ./cleos create account eosio eosio.token EOS5YuLqQ6Si9LPw6deueCPg8m4t5sp1NvUFcJ6Ssb6DU3yJxxoDQ;
    sudo ./cleos create account eosio eosio.upay EOS5YuLqQ6Si9LPw6deueCPg8m4t5sp1NvUFcJ6Ssb6DU3yJxxoDQ;
    
代币合约部署到eosio.token账户中:

进入编译后的合约
    /data/eos/build/unittests/contracts
     sudo ./cleos set contract eosio.token ./eosio.token

第一步,创建用来部署合约的账户

cleos create account eosio eosio.token             EOS8kTP7dWruLSZidZfRkcaQiwKPS1eApwnojeBo6QnaVKt2rMGMM EOS8kTP7dWruLSZidZfRkcaQiwKPS1eApwnojeBo6QnaVKt2rMG

    executed transaction: 46c68f270dfceb36ce2270a6bad89ca2228b9750a19a3a3bc92578a46637fbb1 352 bytes 102400 cycles
    # eosio <= eosio::newaccount {"creator":"eosio","name":"eosio.token","owner":{"threshold":1,"keys":[{"key":"EOS8kTP7dWruLSZidZfRk...

第二步,把eosio.token合约部署到eosio.token账户上

    sudo ./cleos set contract eosio.token  /data/eos/build/unittests/contracts/eosio.token
    
    Reading WAST/WASM from build/contracts/eosio.token/eosio.token.wast...
    Assembling WASM...
    Publishing contract...
    executed transaction: 5a0305bcab99b9d9f8590f51ce4d55bb0a0e60c2d79f4d61cd1ab210571171e2 8288 bytes 2200576 cycles
    # eosio <= eosio::setcode {"account":"eosio.token","vmtype":0,"vmversion":0,"code":"0061736d010000000183011560067f7e7f7f7f7f00...
    # eosio <= eosio::setabi {"account":"eosio.token","abi":{"types":[],"structs":[{"name":"transfer","base":"","fields":[{"name"...

第三步,创建代币

cleos push action eosio.token create '[ "eosio", "1000000000.0000 EOS", 0, 0, 0]' -p eosio.token

executed transaction: b6ffc0fbb62ff4c23b7d24b8b55a34bf0c74e7c710b18d16af326b939ae9ecfd 248 bytes 104448 cycles
# eosio.token <= eosio.token::create {"issuer":"eosio","maximum_supply":"1000000000.0000 EOS","can_freeze":0,"can_recall":0,"can_whitelis...

第四步,账户发放token

cleos push action eosio.token issue '[ "lilei", "1000.0000 EOS", "" ]' -p eosio
executed transaction: 8e33d754aa7dd8987522c3c76ab9a1bffada096363f71169e6da71d444552631 248 bytes 124928 cycles
# eosio.token <= eosio.token::issue {"to":"lilei","quantity":"1000.0000 EOS","memo":""}
>> issue
# eosio.token <= eosio.token::transfer {"from":"eosio","to":"lilei","quantity":"1000.0000 EOS","memo":""}
>> transfer
# eosio <= eosio.token::transfer {"from":"eosio","to":"lilei","quantity":"1000.0000 EOS","memo":""}
# lilei <= eosio.token::transfer {"from":"eosio","to":"lilei","quantity":"1000.0000 EOS","memo":""}

第五步,查询余额

cleos get table eosio.token lilei accounts
{
  "rows": [{
      "balance": "1000.0000 EOS",
      "frozen": 0,
      "whitelist": 1
    }
  ],
  "more": false
}

你可能感兴趣的:(eos节点部署)