Edit me
运行节点
pct@Chandler:~/workspace/eos/eos/programs/nodeos$ rm -rf ~/.local/share/eosio/
pct@Chandler:~/workspace/eos/eos/programs/nodeos$ nodeos -e -p eosio --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin 
143207ms thread-0 chain_plugin.cpp:200 plugin_initialize ] initializing chain plugin
143210ms thread-0 chain_plugin.cpp:351 plugin_initialize ] Starting up fresh blockchain with default genesis state.
创建钱包
pct@Chandler:~/workspace/eos/eos/build/programs/cleos$ rm -rf ~/eosio-wallet/*
pct@Chandler:~/workspace/eos/eos/build/programs/cleos$ ./cleos wallet create
Creating wallet: default
Save password to use in the future to unlock this wallet.
Without password imported keys will not be retrievable.
"PW5KBKPsUk9QEjPesa5iuVgTA4HhdyRhYUoouM2F3HwwdVLynpu1L"
部署合约
pct@Chandler:~/workspace/eos/eos/build/programs/cleos$ ./cleos set contract eosio ../../contracts/eosio.bios -p eosio
Reading WAST/WASM from ../../contracts/eosio.bios/eosio.bios.wasm...
Using already assembled WASM...
Publishing contract...
executed transaction: 16fa9afcf37d8768a607496e8325f2f12e82140f9d3d8a9b9e66e069665060ad  3712 bytes  4951 us
#         eosio <= eosio::setcode               {"account":"eosio","vmtype":0,"vmversion":0,"code":"0061736d0100000001621260037f7e7f0060057f7e7e7e7e...
#         eosio <= eosio::setabi                {"account":"eosio","abi":"0e656f73696f3a3a6162692f312e30050c6163636f756e745f6e616d65046e616d650f7065...
warning: transaction executed locally, but may not be confirmed by the network yet
创建公钥
pct@Chandler:~/workspace/eos/eos/build/programs/cleos$ ./cleos create key
Private key: 5JrLkzAsaaxgwkg8MybZEP184rHJvzhZSsrjmKu85YM1AgorEUq
Public key: EOS7eGRMSHTuZ4awnu987XLhbbZJegvitoGVV3PesFimNJuPmHtVD

pct@Chandler:~/workspace/eos/eos/build/programs/cleos$ ./cleos create key
Private key: 5HtRj7mvgPKyppspQzjTUvFvX3832dHQvQQBmfuHipyQrni7MXY
Public key: EOS7Kr1vizEHdyDSA4q7nx9sgXDiRXzNMqZb2VmkXUtyxEd1hV5mg
导入私钥
pct@Chandler:~/workspace/eos/eos/build/programs/cleos$ ./cleos wallet import 5JrLkzAsaaxgwkg8MybZEP184rHJvzhZSsrjmKu85YM1AgorEUq
imported private key for: EOS7eGRMSHTuZ4awnu987XLhbbZJegvitoGVV3PesFimNJuPmHtVD

pct@Chandler:~/workspace/eos/eos/build/programs/cleos$ ./cleos wallet import 5HtRj7mvgPKyppspQzjTUvFvX3832dHQvQQBmfuHipyQrni7MXY
imported private key for: EOS7Kr1vizEHdyDSA4q7nx9sgXDiRXzNMqZb2VmkXUtyxEd1hV5mg
创建账号

user

pct@Chandler:~/workspace/eos/eos/build/programs/cleos$ ./cleos create account eosio user EOS7eGRMSHTuZ4awnu987XLhbbZJegvitoGVV3PesFimNJuPmHtVD
executed transaction: a9765d9f116b9cc2c89926e70541d3c1c06b6f2df8de124febe1d8a7a57fd0e0  200 bytes  163 us
#         eosio <= eosio::newaccount            {"creator":"eosio","name":"user","owner":{"threshold":1,"keys":[{"key":"EOS7eGRMSHTuZ4awnu987XLhbbZJ...
warning: transaction executed locally, but may not be confirmed by the network yet

tester

pct@Chandler:~/workspace/eos/eos/build/programs/cleos$ ./cleos create account eosio tester EOS7Kr1vizEHdyDSA4q7nx9sgXDiRXzNMqZb2VmkXUtyxEd1hV5mg
executed transaction: 11f722cd9718fd3043ee1326f8b1335eed17a77cbef14f96b9ccd39cf0cba0b1  200 bytes  229 us
#         eosio <= eosio::newaccount            {"creator":"eosio","name":"tester","owner":{"threshold":1,"keys":[{"key":"EOS7Kr1vizEHdyDSA4q7nx9sgX...
warning: transaction executed locally, but may not be confirmed by the network yet

#####设置权限

pct@Chandler:~/workspace/eos/eos/build/programs/cleos$ ./cleos set account permission eosio active '{"threshold":1,"keys":[{"key":"EOS7Kr1vizEHdyDSA4q7nx9sgXDiRXzNMqZb2VmkXUtyxEd1hV5mg","weight":1}],"accounts":[{"permission":{"actor":"tester","permission":"active"},"weight":1}]}' owner -p
executed transaction: 56b1e97fcb3424acb6948cd0448d9ed359e664d162f8b787374b5c59e50ceba6  184 bytes  161 us
#         eosio <= eosio::updateauth            {"account":"eosio","permission":"active","parent":"owner","auth":{"threshold":1,"keys":[{"key":"EOS7...
warning: transaction executed locally, but may not be confirmed by the network yet

即使设置为不同的也可以:

pct@Chandler:~/workspace/eos/eos/build/programs/cleos$ ./cleos set account permission eosio active '{"threshold":2,"keys":[{"key":"EOS5rygmwEJFyrbwSb44a3GZeZS3nAE7pc3wtgFZBgW4d4a6gQYgJ","weight":1}],"accounts":[{"permission":{"actor":"user","permission":"active"},"weight":2}]}' owner -p
executed transaction: e076c9ff027e6d4e0a539ae8dfcae465c98bec82ee8d9714f06d2aa35516eed6  184 bytes  167 us
#         eosio <= eosio::updateauth            {"account":"eosio","permission":"active","parent":"owner","auth":{"threshold":2,"keys":[{"key":"EOS5...
warning: transaction executed locally, but may not be confirmed by the network yet

超出阈值也可以:

pct@Chandler:~/workspace/eos/eos/build/programs/cleos$ ./cleos set account permission eosio active '{"threshold":2,"keys":[{"key":"EOS5rygmwEJFyrbwSb44a3GZeZS3nAE7pc3wtgFZBgW4d4a6gQYgJ","weight":1}],"accounts":[{"permission":{"actor":"user","permission":"active"},"weight":3}]}' owner -p
executed transaction: 5d42fde14852bc75b9b9990ca7df771afcf9858894092cbe78dca4a7ccf964d2  184 bytes  163 us
#         eosio <= eosio::updateauth            {"account":"eosio","permission":"active","parent":"owner","auth":{"threshold":2,"keys":[{"key":"EOS5...
warning: transaction executed locally, but may not be confirmed by the network yet
Tags: