目标:搭建私链,1个创世节点,2个BP节点,1个普通节点。新建9个系统级账户,10个普通账户。
#1、修改node配置文件,详细见https://www.jianshu.com/p/2fab5349b455
#2、启动node节点
./nodeos
#如果报错删除重试
rm -rf ~/.local/share/eosio/nodeos/data/*
#3、建钱包
./cleos wallet create -n terry_eoswallet --to-console
#钱包密码:PW5KZD1F9nR5zVfjdNH1LP89wKei9EqYZzrbxQwn3iLmumiurgwos
#查看钱包列表
./cleos wallet list
#解锁钱包
./cleos wallet unlock -n terry_eoswallet --password PW5KZD1F9nR5zVfjdNH1LP89wKei9EqYZzrbxQwn3iLmumiurgwos
#4、建9个key作为系统账户备用
./cleos create key --to-console
#如下:
Private key: 5JURsPQ7ohXQ4EeY7KD6jtcGiRXdsRYbi2KGZfr3F8AS7R4jf44
Public key: EOS78mNeNRsDCnoBGHegZTE2yGYJo94REzCPUpRNQuhbLwCWuv3h4
Private key: 5JppQupmJhEgiPsH2Bafo4teXngoT13dwFWpb5Lbjm6SEABd76L
Public key: EOS5ao32SiMFoYpmaKbUJbMNLK8CwZMJ3WP8euQUd1PEawHNnto5x
Private key: 5JFMYHH9LEYiHXZ48BHx2TLBahKJBN5ZZzDhKuk8q6qiXZk5xH3
Public key: EOS5LkjxREYJP4DSXeRWAgqoLPAdHi37pcTHG9Utwc34HmXvU2D9G
Private key: 5KGUA3hF49eYA5zQvGqQgGFsmbqewe8ZBcMWpCKRziweW71YK4Q
Public key: EOS5jSJHKJwQ7CgvpMPScb9DsVm2y7haQMJ6jrqJViPFov6bD6AMv
Private key: 5Kba2Vzs77LSm152R4SjxH4XZVcei2hnHrqjRVRmSDFsLpTXkFS
Public key: EOS64ugAMp9n1dSrM69cgYbPb7XpYeVenSHEPaccGMyU9oCGB5V5M
Private key: 5HsDrfFw5t3sAU4TTtq2xTKB113aaXt9Yfuj8CKfU9YxCRFoN5d
Public key: EOS61b6J5mT8T5NJuMq2pJgjJDAokP9NUp8cRg2gYQWSEdSsQsjEr
Private key: 5JvwPP2zj4au6Qe3AfC1595hpcYgnv5W3A9EVDdcTnCtLtqQape
Public key: EOS7XmbXgLrrXmY4o1enctCkwH5UyaxiCuZ4gGJrthMkreygwXgQr
Private key: 5Kkg9DB1nZjJrN19DZwwnGszHuXKjrVRyyjuaVchWJJHXq3GHwi
Public key: EOS5RBhf9tzrGJyiVJoBoZdTK7EvgJTgD8NjLgKD2NpkkUDstuR9M
Private key: 5KDG5ydm6UK91cmYzNvTJn2XYeqdKjQvR24MyfuEr1W2XUdLzQj
Public key: EOS631MLZ13Hn3EXZSZEgZiJwsV9Q4rrUKz3nnPs6FVViKdvYhK9c
#5、将9个key+eosio的key全部导入钱包(导入key过程略)
./cleos wallet import --private-key 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 -n terry_eoswallet
#查看当前导入key列表
./cleos wallet keys
#如下:
[
"EOS5LkjxREYJP4DSXeRWAgqoLPAdHi37pcTHG9Utwc34HmXvU2D9G",
"EOS5RBhf9tzrGJyiVJoBoZdTK7EvgJTgD8NjLgKD2NpkkUDstuR9M",
"EOS5ao32SiMFoYpmaKbUJbMNLK8CwZMJ3WP8euQUd1PEawHNnto5x",
"EOS5jSJHKJwQ7CgvpMPScb9DsVm2y7haQMJ6jrqJViPFov6bD6AMv",
"EOS61b6J5mT8T5NJuMq2pJgjJDAokP9NUp8cRg2gYQWSEdSsQsjEr",
"EOS631MLZ13Hn3EXZSZEgZiJwsV9Q4rrUKz3nnPs6FVViKdvYhK9c",
"EOS64ugAMp9n1dSrM69cgYbPb7XpYeVenSHEPaccGMyU9oCGB5V5M",
"EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"EOS78mNeNRsDCnoBGHegZTE2yGYJo94REzCPUpRNQuhbLwCWuv3h4",
"EOS7XmbXgLrrXmY4o1enctCkwH5UyaxiCuZ4gGJrthMkreygwXgQr"
]
#6、创建系统级别账号
#6.1创建eosio.token账户(发行和管理)
./cleos create account eosio eosio.token EOS5LkjxREYJP4DSXeRWAgqoLPAdHi37pcTHG9Utwc34HmXvU2D9G
#6.2创建eosio.msig账户(多重签名管理)
./cleos create account eosio eosio.msig EOS5RBhf9tzrGJyiVJoBoZdTK7EvgJTgD8NjLgKD2NpkkUDstuR9M
#6.3创建eosio.ram账户(内存买卖管理)
./cleos create account eosio eosio.ram EOS5ao32SiMFoYpmaKbUJbMNLK8CwZMJ3WP8euQUd1PEawHNnto5x
#6.4创建eosio.ramfee账户(内存买卖收手续费管理,每笔千分之五)
./cleos create account eosio eosio.ramfee EOS5jSJHKJwQ7CgvpMPScb9DsVm2y7haQMJ6jrqJViPFov6bD6AMv
#6.5创建eosio.stake账户(管理eos抵押账户)
./cleos create account eosio eosio.stake EOS61b6J5mT8T5NJuMq2pJgjJDAokP9NUp8cRg2gYQWSEdSsQsjEr
#6.6创建eosio.names账户(靓号拍卖管理)
./cleos create account eosio eosio.names EOS631MLZ13Hn3EXZSZEgZiJwsV9Q4rrUKz3nnPs6FVViKdvYhK9c
#6.7创建eosio.saving账户(增发eos临时存放账户,增发总量为5%,其中80%放在此账户,剩下20%再分成25%和75%,分别给eosio.bpay和eosio.vpay)
./cleos create account eosio eosio.saving EOS64ugAMp9n1dSrM69cgYbPb7XpYeVenSHEPaccGMyU9oCGB5V5M
#6.8创建eosio.bpay账户(矿工获取出块奖励的临时代管账户,增发eos的1%的25%会先转到这个账户)
./cleos create account eosio eosio.bpay EOS78mNeNRsDCnoBGHegZTE2yGYJo94REzCPUpRNQuhbLwCWuv3h4
#6.9创建eosio.vpay账户(矿工按照获得投票多少比例获取奖励的临时代管账户,增发eos的1%的75%会先转到这个账户)
./cleos create account eosio eosio.vpay EOS7XmbXgLrrXmY4o1enctCkwH5UyaxiCuZ4gGJrthMkreygwXgQr
#7、部署eosio.token合约
./cleos set contract eosio.token ~/eos/build/contracts/eosio.token/ -p eosio.token
#7.1创建代币SYS(必须是SYS)
./cleos push action eosio.token create '["eosio.token", "100000000.0000 SYS", 0, 0, 0]' -p eosio.token
#7.3发行代币
./cleos push action eosio.token issue '["eosio", "100000000.0000 SYS", "eosio.token to eosio 1个亿SYS"]' -p eosio.token
#8、部署eosio.msig合约
./cleos set contract eosio.msig ~/eos/build/contracts/eosio.msig/ -p eosio.msig
#9、部署eosio.system合约(注意用eosio)
./cleos set contract eosio ~/eos/build/contracts/eosio.system/ -p eosio
#PS:如果部署合约遇到这样的问题,重试即可。
Error 3080006: Transaction took too long
Error Details:
deadline exceeded
pending console output:
#10、授权
./cleos push action eosio setpriv '["eosio.msig", 1]' -p eosio@active
#11、创建10个账户备用key并且导入到钱包(导入过程略)
Private key: 5JbCFgBy2Tap5F3QfCFo7SRwFpCUeWrMSHVNrX15FfmxtJUni5X
Public key: EOS7VD7X7a4NgNBrw6FyxkoTvgcJdHnGEhbZeBottD4vZoz8sC1fu
Private key: 5K8LQejdq5yQwnP8YPfs86BwzXYfC64GA44AGHBKvy1iemZgYGR
Public key: EOS8gPqBWjrz9aesSiLD6qr1Uk2St9nGjY1ESWoYihv5csMsRRkms
Private key: 5JXQHpiAhxTZJLTDgLyoBByc3qDyF82dAenxCUEF1ukLjfZd7Fd
Public key: EOS624H9m3afpPLBXqidmZckR9jdeKiKtGkwqCMvPMYDH7AA1kHnM
Private key: 5KGLbiLA7yrx3mtJMYbXeMBog11FcyVU5zW8QoQL6vG2rdUo7iV
Public key: EOS67A15cM5m9yjuZmTZYjNKvPtTm6E7EQUmnGSh8YJdKPXXsKd7T
Private key: 5Jss2AQBQAG9pGBmA8fS5oyrx9ow6kpSCULDA3ZcL5zb2nSyQtz
Public key: EOS74NxNXgTFA37nQBRZECSUNyyNtZooSX2LztSYpMB7X3qhzVVV6
Private key: 5JZ4MF1S7mGeBe2QFKHJANw3Z9tBLDCxytSbVfTyQVJo6T6ehDT
Public key: EOS7SRW2SDRAspuUbMKnMEsHxtSDpeiwdXY3xX46qASM9Jtv7gW53
Private key: 5KQKsvevAuEeQgZ9QvRsPmQ8UmmkrsxLYiECxrk26EUQsy16T5g
Public key: EOS7dDXd7WMzWHZQzDYpWYiXr3vLCxcrh6vq8Ut1wDkiJGESmQNpr
Private key: 5J4b1HjfG9A3Uz45jrJ2Y9tAW2Fcc7nqKpJUvbLxyWfcYk9qkmx
Public key: EOS81rHEKXpShJ9b4TrQL9untEVNu14HQWNjmxpaAqKLaNy5JvugU
Private key: 5KF5wCXYHh9S6cLvVUsMDhTzerFbFmjGxFysVyjkP4okEJgn3Qj
Public key: EOS7g5qXmFX5oDbNjvyH4kpKEuG3LmGRT9mRjUyV2Vs5u5PgpSJd5
Private key: 5JCJukZBdTGSy6Had5QE31XCTnCBpASYmKobmzQ9BvGezT1zEZ7
Public key: EOS6BAttATTgeBQvAX1AzqjbM2t5bBRXFDaBVsDXr52GQoMqi8W5u
#查看当前导入key列表
./cleos wallet keys
#如下:
[
"EOS5LkjxREYJP4DSXeRWAgqoLPAdHi37pcTHG9Utwc34HmXvU2D9G",
"EOS5RBhf9tzrGJyiVJoBoZdTK7EvgJTgD8NjLgKD2NpkkUDstuR9M",
"EOS5ao32SiMFoYpmaKbUJbMNLK8CwZMJ3WP8euQUd1PEawHNnto5x",
"EOS5jSJHKJwQ7CgvpMPScb9DsVm2y7haQMJ6jrqJViPFov6bD6AMv",
"EOS61b6J5mT8T5NJuMq2pJgjJDAokP9NUp8cRg2gYQWSEdSsQsjEr",
"EOS624H9m3afpPLBXqidmZckR9jdeKiKtGkwqCMvPMYDH7AA1kHnM",
"EOS631MLZ13Hn3EXZSZEgZiJwsV9Q4rrUKz3nnPs6FVViKdvYhK9c",
"EOS64ugAMp9n1dSrM69cgYbPb7XpYeVenSHEPaccGMyU9oCGB5V5M",
"EOS67A15cM5m9yjuZmTZYjNKvPtTm6E7EQUmnGSh8YJdKPXXsKd7T",
"EOS6BAttATTgeBQvAX1AzqjbM2t5bBRXFDaBVsDXr52GQoMqi8W5u",
"EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV",
"EOS74NxNXgTFA37nQBRZECSUNyyNtZooSX2LztSYpMB7X3qhzVVV6",
"EOS78mNeNRsDCnoBGHegZTE2yGYJo94REzCPUpRNQuhbLwCWuv3h4",
"EOS7SRW2SDRAspuUbMKnMEsHxtSDpeiwdXY3xX46qASM9Jtv7gW53",
"EOS7VD7X7a4NgNBrw6FyxkoTvgcJdHnGEhbZeBottD4vZoz8sC1fu",
"EOS7XmbXgLrrXmY4o1enctCkwH5UyaxiCuZ4gGJrthMkreygwXgQr",
"EOS7dDXd7WMzWHZQzDYpWYiXr3vLCxcrh6vq8Ut1wDkiJGESmQNpr",
"EOS7g5qXmFX5oDbNjvyH4kpKEuG3LmGRT9mRjUyV2Vs5u5PgpSJd5",
"EOS81rHEKXpShJ9b4TrQL9untEVNu14HQWNjmxpaAqKLaNy5JvugU",
"EOS8gPqBWjrz9aesSiLD6qr1Uk2St9nGjY1ESWoYihv5csMsRRkms"
]
#12、创建账户(用于投票和注册BP)
#12.1创建terrybpone并抵押net 100w个SYS,抵押cpu100w个SYS,买内存8G的ram
./cleos system newaccount eosio --transfer terrybpone EOS7VD7X7a4NgNBrw6FyxkoTvgcJdHnGEhbZeBottD4vZoz8sC1fu EOS7VD7X7a4NgNBrw6FyxkoTvgcJdHnGEhbZeBottD4vZoz8sC1fu --stake-net "1000000.0000 SYS" --stake-cpu "1000000.0000 SYS" --buy-ram-kbytes 8192 -p eosio@active
#12.2创建terrybptwo并抵押net 100w个SYS,抵押cpu100w个SYS,买内存8G的ram
./cleos system newaccount eosio --transfer terrybptwo EOS8gPqBWjrz9aesSiLD6qr1Uk2St9nGjY1ESWoYihv5csMsRRkms EOS8gPqBWjrz9aesSiLD6qr1Uk2St9nGjY1ESWoYihv5csMsRRkms --stake-net "1000000.0000 SYS" --stake-cpu "1000000.0000 SYS" --buy-ram-kbytes 8192 -p eosio@active
#12.3创建账户terryone并抵押net 100w个SYS,抵押cpu100w个SYS,买内存8G的ram
./cleos system newaccount eosio --transfer terryone EOS624H9m3afpPLBXqidmZckR9jdeKiKtGkwqCMvPMYDH7AA1kHnM EOS624H9m3afpPLBXqidmZckR9jdeKiKtGkwqCMvPMYDH7AA1kHnM --stake-net "1000000.0000 SYS" --stake-cpu "1000000.0000 SYS" --buy-ram-kbytes 8192 -p eosio@active
#12.4创建账户terrytwo并抵押net 100w个SYS,抵押cpu100w个SYS,买内存8G的ram
./cleos system newaccount eosio --transfer terrytwo EOS67A15cM5m9yjuZmTZYjNKvPtTm6E7EQUmnGSh8YJdKPXXsKd7T EOS67A15cM5m9yjuZmTZYjNKvPtTm6E7EQUmnGSh8YJdKPXXsKd7T --stake-net "1000000.0000 SYS" --stake-cpu "50000000.0000 SYS" --buy-ram-kbytes 8192 -p eosio@active
#12.5创建账户terrythree并抵押net 100w个SYS,抵押cpu100w个SYS,买内存8G的ram
./cleos system newaccount eosio --transfer terrythree EOS74NxNXgTFA37nQBRZECSUNyyNtZooSX2LztSYpMB7X3qhzVVV6 EOS74NxNXgTFA37nQBRZECSUNyyNtZooSX2LztSYpMB7X3qhzVVV6 --stake-net "1000000.0000 SYS" --stake-cpu "1000000.0000 SYS" --buy-ram-kbytes 8192 -p eosio@active
#12.6创建账户terryfour并抵押net 100w个SYS,抵押cpu100w个SYS,买内存8G的ram
./cleos system newaccount eosio --transfer terryfour EOS7SRW2SDRAspuUbMKnMEsHxtSDpeiwdXY3xX46qASM9Jtv7gW53 EOS7SRW2SDRAspuUbMKnMEsHxtSDpeiwdXY3xX46qASM9Jtv7gW53 --stake-net "1000000.0000 SYS" --stake-cpu "1000000.0000 SYS" --buy-ram-kbytes 8192 -p eosio@active
#12.7创建账户terryfive并抵押net 100w个SYS,抵押cpu100w个SYS,买内存8G的ram
./cleos system newaccount eosio --transfer terryfive EOS7dDXd7WMzWHZQzDYpWYiXr3vLCxcrh6vq8Ut1wDkiJGESmQNpr EOS7dDXd7WMzWHZQzDYpWYiXr3vLCxcrh6vq8Ut1wDkiJGESmQNpr --stake-net "1000000.0000 SYS" --stake-cpu "1000000.0000 SYS" --buy-ram-kbytes 8192 -p eosio@active
#12.8创建账户terrysix并抵押net 100w个SYS,抵押cpu100w个SYS,买内存8G的ram
./cleos system newaccount eosio --transfer terrysix EOS81rHEKXpShJ9b4TrQL9untEVNu14HQWNjmxpaAqKLaNy5JvugU EOS81rHEKXpShJ9b4TrQL9untEVNu14HQWNjmxpaAqKLaNy5JvugU --stake-net "1000000.0000 SYS" --stake-cpu "1000000.0000 SYS" --buy-ram-kbytes 8192 -p eosio@active
#12.9创建账户terryseven并抵押net 100w个SYS,抵押cpu100w个SYS,买内存8G的ram
./cleos system newaccount eosio --transfer terryseven EOS7g5qXmFX5oDbNjvyH4kpKEuG3LmGRT9mRjUyV2Vs5u5PgpSJd5 EOS7g5qXmFX5oDbNjvyH4kpKEuG3LmGRT9mRjUyV2Vs5u5PgpSJd5 --stake-net "1000000.0000 SYS" --stake-cpu "1000000.0000 SYS" --buy-ram-kbytes 8192 -p eosio@active
#12.10创建账户terryeight并抵押net 100w个SYS,抵押cpu100w个SYS,买内存8G的ram
./cleos system newaccount eosio --transfer terryeight EOS6BAttATTgeBQvAX1AzqjbM2t5bBRXFDaBVsDXr52GQoMqi8W5u EOS6BAttATTgeBQvAX1AzqjbM2t5bBRXFDaBVsDXr52GQoMqi8W5u --stake-net "1000000.0000 SYS" --stake-cpu "1000000.0000 SYS" --buy-ram-kbytes 8192 -p eosio@active
#13、注册BP
#terrybpone
./cleos system regproducer terrybpone EOS7VD7X7a4NgNBrw6FyxkoTvgcJdHnGEhbZeBottD4vZoz8sC1fu https://terrybpone
#terrybptwo
./cleos system regproducer terrybptwo EOS8gPqBWjrz9aesSiLD6qr1Uk2St9nGjY1ESWoYihv5csMsRRkms https://terrybptwo
#14、普通节点投票
./cleos system voteproducer prods terryone terrybpone -p terryone@active
#15、查看bp投票情况
./cleos system listproducers
#PS:投票总数SYS占发行总数的至少15%,得票结果根据投票用户所持有的总数SYS决定,每人投一次。
#16、用terrybpone部署合约
./cleos set contract terrybpone ~/eos/build/contracts/eosio.token/ -p terrybpone
#16.1创建1亿个UFO
./cleos push action terrybpone create '["eosio", "100000000.0000 UFO", 0, 0, 0]' -p terrybpone
#16.2转给发行账户terryone
./cleos push action terrybpone issue '["terryone", "100000000.0000 UFO", "terrybpone to terryone 1个亿UFO"]' -p eosio
#16.3查询terryone余额
./cleos get currency balance terrybpone terryone UFO