eos代码阅读笔记04

编程入门 行业动态 更新时间:2024-10-05 23:28:33

eos<a href=https://www.elefans.com/category/jswz/34/1771412.html style=代码阅读笔记04"/>

eos代码阅读笔记04

开始之前先改两个地方,注释掉 print_request,print_response 让它总是打印请求响应数据。方便看程序做了什么。记得从新编译 sudo ./eosio_build.sh
   //if ( print_request ) {string s(request.size(), '\0');buffer_copy(boost::asio::buffer(s), request.data());std::cerr << "REQUEST:" << std::endl<< "---------------------" << std::endl<< s << std::endl<< "---------------------" << std::endl;//}
// if( print_response ) {std::cerr << "RESPONSE:" << std::endl<< "---------------------" << std::endl<< fc::json::to_pretty_string( response_result ) << std::endl<< "---------------------" << std::endl;// }

创建钱包

$ ./cleos wallet create -n w1Creating wallet: w1
Save password to use in the future to unlock this wallet.
Without password imported keys will not be retrievable."PW5JPstGVWrThpcQvv2F9CB5tu9Pc34YJoHAy21coHEpdTUYTkWzv"

给eosio导入key

注意点:创建账号必须有用现有的账号创建新的账号。刚刚安装完,只能用eosio,需要先导入它的key。在配置文件,和源代码多个地方出现。

eos/programs/eosio-launcher/main.cpp

producer_names names(producers);int non_bios = prod_nodes - 1;int per_node = producers / non_bios;int extra = producers % non_bios;unsigned int i = 0;for (auto &h : bindings) {for (auto &inst : h.instances) {bool is_bios = inst.name == "bios";tn_node_def node;node.name = inst.name;node.instance = &inst;auto kp = is_bios ?private_key_type(string("5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3")) :private_key_type::generate();auto pubkey = kp.get_public_key();node.keys.emplace_back (move(kp));if (is_bios) {string prodname = "eosio";node.producers.push_back(prodname);producer_set.schedule.push_back({prodname,pubkey});}

名字是 eosio, 私钥是5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3

用eosio创建第一个账号后,就可以用自己创建的账号创建其他账号了。


~/.local/share/eosio/nodeos/config/config.ini 文件里的

signature-provider = EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV=KEY:5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3

导入

$ ./cleos wallet import -n w1 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
imported private key for: EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV

创建key

$ ./cleos create key
Private key: 5JZ1Pjyr7SBp2QEoC4voDLSfaB7WdeUw7Bzqc3jcxMQiwSKUt1p
Public key: EOS7bcZoaEmV46VDpHxxsyn4K3QwQZW13Nodp6K7Jpiyn3TjHbhsF

导入key到钱包

$ ./cleos wallet import -n w1 5JZ1Pjyr7SBp2QEoC4voDLSfaB7WdeUw7Bzqc3jcxMQiwSKUt1p
imported private key for: EOS7bcZoaEmV46VDpHxxsyn4K3QwQZW13Nodp6K7Jpiyn3TjHbhsF

创建账号t1

$ ./cleos create account eosio t1 EOS6iqBbXReXaERSW9Ubv19M8JtQFWJ3gsoJaxE4HiLsPsEGJjvqPREQUEST:
---------------------
POST /v1/chain/get_info HTTP/1.0
Host: localhost
content-length: 0
Accept: */*
Connection: close---------------------
RESPONSE:
---------------------
{"server_version": "79651199","chain_id": "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f",链ID"head_block_num": 47,"last_irreversible_block_num": 46"last_irreversible_block_id": "0000002e626849c451c58caeb079bec496734d1a48e5a7e0edc62eaf032db2e5",不可更改的块ID,上一个块ID"head_block_id": "0000002f67e0f8260a0a3188d4e7540db332867eb776daafc8100d61b00d3b8b",块ID"head_block_time": "2018-06-29T08:02:16.000",块时间"head_block_producer": "eosio",挖矿人"virtual_block_cpu_limit": 209398,"virtual_block_net_limit": 1097937,"block_cpu_limit": 199900,"block_net_limit": 1048576
}
---------------------
REQUEST:
---------------------
POST /v1/wallet/get_public_keys HTTP/1.0
Host: localhost
content-length: 0
Accept: */*
Connection: close---------------------
RESPONSE:
---------------------
["EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","EOS6iqBbXReXaERSW9Ubv19M8JtQFWJ3gsoJaxE4HiLsPsEGJjvqP","EOS7bcZoaEmV46VDpHxxsyn4K3QwQZW13Nodp6K7Jpiyn3TjHbhsF","EOS81YV1WK9nisqyFrbS7nZjh9NYS1K5xjntyMkCW1VopBDrtEMgT"
]
---------------------
REQUEST:
---------------------
POST /v1/chain/get_required_keys HTTP/1.0
Host: localhost
content-length: 781
Accept: */*
Connection: close{"transaction":{"expiration":"2018-06-29T08:02:46","ref_block_num":46,"ref_block_prefix":2928461137,"max_net_usage_words":0,"max_cpu_usage_ms":0,"delay_sec":0,"context_free_actions":[],"actions":[{"account":"eosio","name":"newaccount","authorization":[{"actor":"eosio","permission":"active"}],"data":"0000000000ea305500000000000040c801000000010002f17657f3303512f7b0ea2f2a682aa8b1b693817d98d959800fdcf480881aef0a0100000001000000010002f17657f3303512f7b0ea2f2a682aa8b1b693817d98d959800fdcf480881aef0a01000000"}],"transaction_extensions":[]},"available_keys":["EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","EOS6iqBbXReXaERSW9Ubv19M8JtQFWJ3gsoJaxE4HiLsPsEGJjvqP","EOS7bcZoaEmV46VDpHxxsyn4K3QwQZW13Nodp6K7Jpiyn3TjHbhsF","EOS81YV1WK9nisqyFrbS7nZjh9NYS1K5xjntyMkCW1VopBDrtEMgT"]}
---------------------
RESPONSE:
---------------------
{"required_keys": ["EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"]
}
---------------------
REQUEST:
---------------------
POST /v1/wallet/sign_transaction HTTP/1.0
Host: localhost
content-length: 688
Accept: */*
Connection: close[{"expiration":"2018-06-29T08:02:46","ref_block_num":46,"ref_block_prefix":2928461137,"max_net_usage_words":0,"max_cpu_usage_ms":0,"delay_sec":0,"context_free_actions":[],"actions":[{"account":"eosio","name":"newaccount","authorization":[{"actor":"eosio","permission":"active"}],"data":"0000000000ea305500000000000040c801000000010002f17657f3303512f7b0ea2f2a682aa8b1b693817d98d959800fdcf480881aef0a0100000001000000010002f17657f3303512f7b0ea2f2a682aa8b1b693817d98d959800fdcf480881aef0a01000000"}],"transaction_extensions":[],"signatures":[],"context_free_data":[]},["EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"],"cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f"]
---------------------
RESPONSE:
---------------------
{"expiration": "2018-06-29T08:02:46","ref_block_num": 46,"ref_block_prefix": 2928461137,"max_net_usage_words": 0,"max_cpu_usage_ms": 0,"delay_sec": 0,"context_free_actions": [],"actions": [{"account": "eosio","name": "newaccount","authorization": [{"actor": "eosio","permission": "active"}],"data": "0000000000ea305500000000000040c801000000010002f17657f3303512f7b0ea2f2a682aa8b1b693817d98d959800fdcf480881aef0a0100000001000000010002f17657f3303512f7b0ea2f2a682aa8b1b693817d98d959800fdcf480881aef0a01000000"}],"transaction_extensions": [],"signatures": ["SIG_K1_KenQx2BuGv5tYU31Q97oQLgowyw9woDhRdxuUcRYrk34qyoBnEMjUcECL14juchJATCzM5rj14LP5ATViy5mDyZVpyGh8N"],"context_free_data": []
}
---------------------
REQUEST:
---------------------
POST /v1/chain/push_transaction HTTP/1.0
Host: localhost
content-length: 491
Accept: */*
Connection: close{"signatures":["SIG_K1_KenQx2BuGv5tYU31Q97oQLgowyw9woDhRdxuUcRYrk34qyoBnEMjUcECL14juchJATCzM5rj14LP5ATViy5mDyZVpyGh8N"],"compression":"none","packed_context_free_data":"","packed_trx":"a6e7355b2e0051c58cae00000000010000000000ea305500409e9a2264b89a010000000000ea305500000000a8ed3232660000000000ea305500000000000040c801000000010002f17657f3303512f7b0ea2f2a682aa8b1b693817d98d959800fdcf480881aef0a0100000001000000010002f17657f3303512f7b0ea2f2a682aa8b1b693817d98d959800fdcf480881aef0a0100000000"}
---------------------
RESPONSE:
---------------------
{"transaction_id": "774f5e219d78ecab70231cfe3e3ae056708a808aa8c37a3d9aa2aced69999188","processed": {"id": "774f5e219d78ecab70231cfe3e3ae056708a808aa8c37a3d9aa2aced69999188","receipt": {"status": "executed","cpu_usage_us": 860,"net_usage_words": 25},"elapsed": 860,"net_usage": 200,"scheduled": false,"action_traces": [{"receipt": {"receiver": "eosio","act_digest": "7bef9ed2c5a15dfdc4c4e999210ff4ea00ce4227f4503200898965ca25b6fcb8","global_sequence": 48,"recv_sequence": 48,"auth_sequence": [["eosio",48]],"code_sequence": 0,"abi_sequence": 0},"act": {"account": "eosio","name": "newaccount","authorization": [{"actor": "eosio","permission": "active"}],"data": {"creator": "eosio","name": "t1","owner": {"threshold": 1,"keys": [{"key": "EOS6iqBbXReXaERSW9Ubv19M8JtQFWJ3gsoJaxE4HiLsPsEGJjvqP","weight": 1}],"accounts": [],"waits": []},"active": {"threshold": 1,"keys": [{"key": "EOS6iqBbXReXaERSW9Ubv19M8JtQFWJ3gsoJaxE4HiLsPsEGJjvqP","weight": 1}],"accounts": [],"waits": []}},"hex_data": "0000000000ea305500000000000040c801000000010002f17657f3303512f7b0ea2f2a682aa8b1b693817d98d959800fdcf480881aef0a0100000001000000010002f17657f3303512f7b0ea2f2a682aa8b1b693817d98d959800fdcf480881aef0a01000000"},"elapsed": 246,"cpu_usage": 0,"console": "","total_cpu_usage": 0,"trx_id": "774f5e219d78ecab70231cfe3e3ae056708a808aa8c37a3d9aa2aced69999188","inline_traces": []}],"except": null}
}
---------------------
executed transaction: 774f5e219d78ecab70231cfe3e3ae056708a808aa8c37a3d9aa2aced69999188  200 bytes  860 us
#         eosio <= eosio::newaccount            {"creator":"eosio","name":"t1","owner":{"threshold":1,"keys":[{"key":"EOS6iqBbXReXaERSW9Ubv19M8JtQFW...
warning: transaction executed locally, but may not be confirmed by the network yet

创建账号的时候执行了这些请求

/v1/chain/get_info

/v1/wallet/get_public_keys

/v1/chain/get_required_keys

/v1/wallet/sign_transaction

/v1/chain/push_transaction

具体跟踪一下代码,在cleos/main.cpp, create account的回调函数

 createAccount->set_callback([this] {if( !active_key_str.size() )active_key_str = owner_key_str;public_key_type owner_key, active_key;try {owner_key = public_key_type(owner_key_str);} EOS_RETHROW_EXCEPTIONS(public_key_type_exception, "Invalid owner public key: ${public_key}", ("public_key", owner_key_str));try {active_key = public_key_type(active_key_str);} EOS_RETHROW_EXCEPTIONS(public_key_type_exception, "Invalid active public key: ${public_key}", ("public_key", active_key_str)); auto create = create_newaccount(creator, account_name, owner_key, active_key);if (!simple) {....} else {send_actions( { create } );}});

把创建账号当做一个事务来处理,action是具体的操作。

组装action, 这里的名字newaccount 说明要做的事情

chain::action create_newaccount(const name& creator, const name& newaccount, public_key_type owner, public_key_type active) {return action {tx_permission.empty() ? vector<chain::permission_level>{{creator,config::active_name}} : get_account_permissions(tx_permission),eosio::chain::newaccount{.creator      = creator,.name         = newaccount,.owner        = eosio::chain::authority{1, {{owner, 1}}, {}},.active       = eosio::chain::authority{1, {{active, 1}}, {}}}};
}


void send_actions(std::vector<chain::action>&& actions, int32_t extra_kcpu = 1000, packed_transaction::compression_type compression = packed_transaction::none ) {auto result = push_actions( move(actions), extra_kcpu, compression);if( tx_print_json ) {cout << fc::json::to_pretty_string( result ) << endl;} else {print_result( result );}
}

创建签名交易对象


fc::variant push_actions(std::vector<chain::action>&& actions, int32_t extra_kcpu, packed_transaction::compression_type compression = packed_transaction::none ) {signed_transaction trx;创建了签名交易trx.actions = std::forward<decltype(actions)>(actions);return push_transaction(trx, extra_kcpu, compression);
}



fc::variant push_transaction( signed_transaction& trx, int32_t extra_kcpu = 1000, packed_transaction::compression_type compression = packed_transaction::none ) {auto info = get_info();获取区块链信息trx.expiration = info.head_block_time + tx_expiration;用最后的块时间给当前交易做到期时间// Set tapos, default to last irreversible block if it's not specified by the userblock_id_type ref_block_id = info.last_irreversible_block_id;最后的不可逆的块IDtry {fc::variant ref_block;if (!tx_ref_block_num_or_id.empty()) {ref_block = call(get_block_func, fc::mutable_variant_object("block_num_or_id", tx_ref_block_num_or_id));ref_block_id = ref_block["id"].as<block_id_type>();}} EOS_RETHROW_EXCEPTIONS(invalid_ref_block_exception, "Invalid reference block num or id: ${block_num_or_id}", ("block_num_or_id", tx_ref_block_num_or_id));trx.set_reference_block(ref_block_id);if (tx_force_unique) {trx.context_free_actions.emplace_back( generate_nonce_action() );}trx.max_cpu_usage_ms = tx_max_net_usage;trx.max_net_usage_words = (tx_max_net_usage + 7)/8;if (!tx_skip_sign) { auto required_keys = determine_required_keys(trx);判断key sign_transaction(trx, required_keys, info.chain_id);}if (!tx_dont_broadcast) { return call(push_txn_func, packed_transaction(trx, compression));} else {return fc::variant(trx);}
}

区块链信息,包含最后一个块的时间head_block_time,块的id等信息

REQUEST:
---------------------
POST /v1/chain/get_info HTTP/1.0
Host: localhost
content-length: 0
Accept: */*
Connection: close---------------------
RESPONSE:
---------------------
{"server_version": "79651199","chain_id": "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f",链ID"head_block_num": 47,"last_irreversible_block_num": 46"last_irreversible_block_id": "0000002e626849c451c58caeb079bec496734d1a48e5a7e0edc62eaf032db2e5",不可更改的块ID,上一个块ID"head_block_id": "0000002f67e0f8260a0a3188d4e7540db332867eb776daafc8100d61b00d3b8b",块ID"head_block_time": "2018-06-29T08:02:16.000",块时间"head_block_producer": "eosio",挖矿人"virtual_block_cpu_limit": 209398,"virtual_block_net_limit": 1097937,"block_cpu_limit": 199900,"block_net_limit": 1048576
}

决定key

fc::variant determine_required_keys(const signed_transaction& trx) {// TODO better error checking//wdump((trx));const auto& public_keys = call(wallet_url, wallet_public_keys);auto get_arg = fc::mutable_variant_object("transaction", (transaction)trx)("available_keys", public_keys);const auto& required_keys = call(get_required_keys, get_arg);return required_keys["required_keys"];
}

wallet_public_key, 返回了打开着的钱包全部公钥

get_required_keys,把所有的公钥,

---------------------
REQUEST:
---------------------
POST /v1/wallet/get_public_keys HTTP/1.0
Host: localhost
content-length: 0
Accept: */*
Connection: close---------------------
RESPONSE:
---------------------
["EOS5DnBiXzg7WJDcqpVa5RtvBxnF94DadwokVtM1xCy3BSGiJpfJ3","EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","EOS6iqBbXReXaERSW9Ubv19M8JtQFWJ3gsoJaxE4HiLsPsEGJjvqP","EOS7bcZoaEmV46VDpHxxsyn4K3QwQZW13Nodp6K7Jpiyn3TjHbhsF","EOS81YV1WK9nisqyFrbS7nZjh9NYS1K5xjntyMkCW1VopBDrtEMgT","EOS82x2vmDFkvkzfHXaEF3SepfV9YRf58Z9pZDRcVeABVGA4LCoc2"
]
---------------------
REQUEST:
---------------------
POST /v1/chain/get_required_keys HTTP/1.0
Host: localhost
content-length: 893
Accept: */*
Connection: close
{"transaction": {"expiration": "2018-06-29T10:12:18","ref_block_num": 15590,"ref_block_prefix": 1895433715,"max_net_usage_words": 0,"max_cpu_usage_ms": 0,"delay_sec": 0,"context_free_actions": [],"actions": [{"account": "eosio","name": "newaccount","authorization": [{"actor": "t1","permission": "active"}],"data": "00000000000040c800000000002072e0010000000100039e4c3a6d769bf70ccde5b54ffbdfd8f664b2ff6e74a8d65b894889e388248ba101000000010000000100039e4c3a6d769bf70ccde5b54ffbdfd8f664b2ff6e74a8d65b894889e388248ba101000000"}],"transaction_extensions": []},"available_keys": ["EOS5DnBiXzg7WJDcqpVa5RtvBxnF94DadwokVtM1xCy3BSGiJpfJ3", 
"EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", 
"EOS6iqBbXReXaERSW9Ubv19M8JtQFWJ3gsoJaxE4HiLsPsEGJjvqP", 
"EOS7bcZoaEmV46VDpHxxsyn4K3QwQZW13Nodp6K7Jpiyn3TjHbhsF", 
"EOS81YV1WK9nisqyFrbS7nZjh9NYS1K5xjntyMkCW1VopBDrtEMgT","EOS82x2vmDFkvkzfHXaEF3SepfV9YRf58Z9pZDRcVeABVGA4LCoc2"]
}
---------------------
RESPONSE:
---------------------
{"required_keys": ["EOS6iqBbXReXaERSW9Ubv19M8JtQFWJ3gsoJaxE4HiLsPsEGJjvqP"]
}
---------------------

签名交易 sign_transaction,请求返回的结果里多了signatures 这一部分。如果用已经使用过的公钥创建账号,着一部会出错。

void sign_transaction(signed_transaction& trx, fc::variant& required_keys, const chain_id_type& chain_id) {fc::variants sign_args = {fc::variant(trx), required_keys, fc::variant(chain_id)};const auto& signed_trx = call(wallet_url, wallet_sign_trx, sign_args);trx = signed_trx.as<signed_transaction>();
}

REQUEST:
---------------------
POST /v1/wallet/sign_transaction HTTP/1.0
Host: localhost
content-length: 688
Accept: */*
Connection: close
[{"expiration": "2018-06-29T08:02:46","ref_block_num": 46,"ref_block_prefix": 2928461137,"max_net_usage_words": 0,"max_cpu_usage_ms": 0,"delay_sec": 0,"context_free_actions": [],"actions": [{"account": "eosio","name": "newaccount","authorization": [{"actor": "eosio","permission": "active"}],"data": "0000000000ea305500000000000040c801000000010002f17657f3303512f7b0ea2f2a682aa8b1b693817d98d959800fdcf480881aef0a0100000001000000010002f17657f3303512f7b0ea2f2a682aa8b1b693817d98d959800fdcf480881aef0a01000000"}],"transaction_extensions": [], "signatures": [],"context_free_data": []},["EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"], "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f"
]
---------------------
RESPONSE:
---------------------
{"expiration": "2018-06-29T08:02:46","ref_block_num": 46,"ref_block_prefix": 2928461137,"max_net_usage_words": 0,"max_cpu_usage_ms": 0,"delay_sec": 0,"context_free_actions": [],"actions": [{"account": "eosio","name": "newaccount","authorization": [{"actor": "eosio","permission": "active"}],"data": "0000000000ea305500000000000040c801000000010002f17657f3303512f7b0ea2f2a682aa8b1b693817d98d959800fdcf480881aef0a0100000001000000010002f17657f3303512f7b0ea2f2a682aa8b1b693817d98d959800fdcf480881aef0a01000000"}],"transaction_extensions": [], "signatures": ["SIG_K1_KenQx2BuGv5tYU31Q97oQLgowyw9woDhRdxuUcRYrk34qyoBnEMjUcECL14juchJATCzM5rj14LP5ATViy5mDyZVpyGh8N"],"context_free_data": []
}
---------------------


压缩交易,然后推送 push_transaction,发送了签名,和压缩后的交易信息。

返回交易执行情况,交易ID,

if (!tx_dont_broadcast) {return call(push_txn_func, packed_transaction(trx, compression));} else {return fc::variant(trx);}

REQUEST:
---------------------
POST /v1/chain/push_transaction HTTP/1.0
Host: localhost
content-length: 491
Accept: */*
Connection: close
{"signatures": ["SIG_K1_KenQx2BuGv5tYU31Q97oQLgowyw9woDhRdxuUcRYrk34qyoBnEMjUcECL14juchJATCzM5rj14LP5ATViy5mDyZVpyGh8N"],"compression": "none","packed_context_free_data": "","packed_trx": "a6e7355b2e0051c58cae00000000010000000000ea305500409e9a2264b89a010000000000ea305500000000a8ed3232660000000000ea305500000000000040c801000000010002f17657f3303512f7b0ea2f2a682aa8b1b693817d98d959800fdcf480881aef0a0100000001000000010002f17657f3303512f7b0ea2f2a682aa8b1b693817d98d959800fdcf480881aef0a0100000000"
}
---------------------
RESPONSE:
---------------------
{"transaction_id": "774f5e219d78ecab70231cfe3e3ae056708a808aa8c37a3d9aa2aced69999188",交易ID"processed": {"id": "774f5e219d78ecab70231cfe3e3ae056708a808aa8c37a3d9aa2aced69999188","receipt": {收据"status": "executed",  执行状态"cpu_usage_us": 860,   cpu使用"net_usage_words": 25  带宽使用},"elapsed": 860,"net_usage": 200,"scheduled": false,"action_traces": [{活动轨迹"receipt": {"receiver": "eosio","act_digest": "7bef9ed2c5a15dfdc4c4e999210ff4ea00ce4227f4503200898965ca25b6fcb8","global_sequence": 48,全局序列"recv_sequence": 48,"auth_sequence": [["eosio",48]],"code_sequence": 0,"abi_sequence": 0},"act": {活动"account": "eosio", 活动执行者"name": "newaccount",活动名字"authorization": [{"actor": "eosio","permission": "active"}],"data": {"creator": "eosio",创建者"name": "t1",创建的账号名字"owner": {拥有者权限"threshold": 1,"keys": [{"key": "EOS6iqBbXReXaERSW9Ubv19M8JtQFWJ3gsoJaxE4HiLsPsEGJjvqP","weight": 1}],"accounts": [],"waits": []},"active": {执行者权限"threshold": 1,"keys": [{"key": "EOS6iqBbXReXaERSW9Ubv19M8JtQFWJ3gsoJaxE4HiLsPsEGJjvqP","weight": 1}],"accounts": [],"waits": []}},"hex_data": "0000000000ea305500000000000040c801000000010002f17657f3303512f7b0ea2f2a682aa8b1b693817d98d959800fdcf480881aef0a0100000001000000010002f17657f3303512f7b0ea2f2a682aa8b1b693817d98d959800fdcf480881aef0a01000000"},"elapsed": 246,"cpu_usage": 0,"console": "","total_cpu_usage": 0,"trx_id": "774f5e219d78ecab70231cfe3e3ae056708a808aa8c37a3d9aa2aced69999188","inline_traces": []}],"except": null}
}


用eosio 创建test1, 然后用test1创建test2;

$ ./cleos wallet unlock -n w1
password: REQUEST:
---------------------
POST /v1/wallet/unlock HTTP/1.0
Host: localhost
content-length: 62
Accept: */*
Connection: close["w1","PW5JPstGVWrThpcQvv2F9CB5tu9Pc34YJoHAy21coHEpdTUYTkWzv"]
---------------------
RESPONSE:
---------------------
{}
---------------------
Unlocked: w1
$ ./cleos wallet unlock -n w2
password: REQUEST:
---------------------
POST /v1/wallet/unlock HTTP/1.0
Host: localhost
content-length: 62
Accept: */*
Connection: close["w2","PW5JtLpKfx6v7BGiko7ZcDD5AjbL6XAVTRGKMbASEQuEr4axCp2Q6"]
---------------------
RESPONSE:
---------------------
{}
---------------------
$ ./cleos wallet import -n w1 5JUskwAV6dyZM5jcWX8ftMLmnBMG3diCWCz2EJtVjuGciR1gmyJ
REQUEST:
---------------------
POST /v1/wallet/import_key HTTP/1.0
Host: localhost
content-length: 60
Accept: */*
Connection: close["w1","5JUskwAV6dyZM5jcWX8ftMLmnBMG3diCWCz2EJtVjuGciR1gmyJ"]
---------------------
RESPONSE:
---------------------
{}
---------------------
imported private key for: EOS5evHy7q26ReZ7FyAvtATWNpNr4FXfMmKU9BvP9s6ioCmZqQMCT
$ ./cleos create account eosio test1 EOS5evHy7q26ReZ7FyAvtATWNpNr4FXfMmKU9BvP9s6ioCmZqQMCT
REQUEST:
---------------------
POST /v1/chain/get_info HTTP/1.0
Host: localhost
content-length: 0
Accept: */*
Connection: close---------------------
RESPONSE:
---------------------
{"server_version": "79651199","chain_id": "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f","head_block_num": 25261,"last_irreversible_block_num": 25260,"last_irreversible_block_id": "000062acb3812f5fba158c82c53b921a34a8dec5c85cdc8d782a8f1a7e328968","head_block_id": "000062ad5ec347d0a08332ad6bede087d609709c1467ac08abfe728eea2816cc","head_block_time": "2018-07-02T01:54:41.000","head_block_producer": "eosio","virtual_block_cpu_limit": 200000000,"virtual_block_net_limit": 1048576000,"block_cpu_limit": 199900,"block_net_limit": 1048576
}
---------------------
REQUEST:
---------------------
POST /v1/wallet/get_public_keys HTTP/1.0
Host: localhost
content-length: 0
Accept: */*
Connection: close---------------------
RESPONSE:
---------------------
["EOS5DnBiXzg7WJDcqpVa5RtvBxnF94DadwokVtM1xCy3BSGiJpfJ3","EOS5evHy7q26ReZ7FyAvtATWNpNr4FXfMmKU9BvP9s6ioCmZqQMCT","EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","EOS6iqBbXReXaERSW9Ubv19M8JtQFWJ3gsoJaxE4HiLsPsEGJjvqP","EOS7bcZoaEmV46VDpHxxsyn4K3QwQZW13Nodp6K7Jpiyn3TjHbhsF","EOS81YV1WK9nisqyFrbS7nZjh9NYS1K5xjntyMkCW1VopBDrtEMgT","EOS82x2vmDFkvkzfHXaEF3SepfV9YRf58Z9pZDRcVeABVGA4LCoc2"
]
---------------------
REQUEST:
---------------------
POST /v1/chain/get_required_keys HTTP/1.0
Host: localhost
content-length: 952
Accept: */*
Connection: close{"transaction":{"expiration":"2018-07-02T01:55:11","ref_block_num":25260,"ref_block_prefix":2190218682,"max_net_usage_words":0,"max_cpu_usage_ms":0,"delay_sec":0,"context_free_actions":[],"actions":[{"account":"eosio","name":"newaccount","authorization":[{"actor":"eosio","permission":"active"}],"data":"0000000000ea3055000000008090b1ca0100000001000264e23cbd6efd22074d046cbfbbbe144083ae14b65e19b7d3ba40410938477a1b010000000100000001000264e23cbd6efd22074d046cbfbbbe144083ae14b65e19b7d3ba40410938477a1b01000000"}],"transaction_extensions":[]},"available_keys":["EOS5DnBiXzg7WJDcqpVa5RtvBxnF94DadwokVtM1xCy3BSGiJpfJ3","EOS5evHy7q26ReZ7FyAvtATWNpNr4FXfMmKU9BvP9s6ioCmZqQMCT","EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","EOS6iqBbXReXaERSW9Ubv19M8JtQFWJ3gsoJaxE4HiLsPsEGJjvqP","EOS7bcZoaEmV46VDpHxxsyn4K3QwQZW13Nodp6K7Jpiyn3TjHbhsF","EOS81YV1WK9nisqyFrbS7nZjh9NYS1K5xjntyMkCW1VopBDrtEMgT","EOS82x2vmDFkvkzfHXaEF3SepfV9YRf58Z9pZDRcVeABVGA4LCoc2"]}
---------------------
RESPONSE:
---------------------
{"required_keys": ["EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"]
}
---------------------
REQUEST:
---------------------
POST /v1/wallet/sign_transaction HTTP/1.0
Host: localhost
content-length: 691
Accept: */*
Connection: close[{"expiration":"2018-07-02T01:55:11","ref_block_num":25260,"ref_block_prefix":2190218682,"max_net_usage_words":0,"max_cpu_usage_ms":0,"delay_sec":0,"context_free_actions":[],"actions":[{"account":"eosio","name":"newaccount","authorization":[{"actor":"eosio","permission":"active"}],"data":"0000000000ea3055000000008090b1ca0100000001000264e23cbd6efd22074d046cbfbbbe144083ae14b65e19b7d3ba40410938477a1b010000000100000001000264e23cbd6efd22074d046cbfbbbe144083ae14b65e19b7d3ba40410938477a1b01000000"}],"transaction_extensions":[],"signatures":[],"context_free_data":[]},["EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"],"cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f"]
---------------------
RESPONSE:
---------------------
{"expiration": "2018-07-02T01:55:11","ref_block_num": 25260,"ref_block_prefix": 2190218682,"max_net_usage_words": 0,"max_cpu_usage_ms": 0,"delay_sec": 0,"context_free_actions": [],"actions": [{"account": "eosio","name": "newaccount","authorization": [{"actor": "eosio","permission": "active"}],"data": "0000000000ea3055000000008090b1ca0100000001000264e23cbd6efd22074d046cbfbbbe144083ae14b65e19b7d3ba40410938477a1b010000000100000001000264e23cbd6efd22074d046cbfbbbe144083ae14b65e19b7d3ba40410938477a1b01000000"}],"transaction_extensions": [],"signatures": ["SIG_K1_KAosuexthES1PSc8gmtweBdXpV4QwUGWacZSiwum7rTEAbykpwQxdxaYoo8qU6RSBjzphWwDY6QQ2HC48C8RcYoFZZ38QF"],"context_free_data": []
}
---------------------
REQUEST:
---------------------
POST /v1/chain/push_transaction HTTP/1.0
Host: localhost
content-length: 491
Accept: */*
Connection: close{"signatures":["SIG_K1_KAosuexthES1PSc8gmtweBdXpV4QwUGWacZSiwum7rTEAbykpwQxdxaYoo8qU6RSBjzphWwDY6QQ2HC48C8RcYoFZZ38QF"],"compression":"none","packed_context_free_data":"","packed_trx":"ff85395bac62ba158c8200000000010000000000ea305500409e9a2264b89a010000000000ea305500000000a8ed3232660000000000ea3055000000008090b1ca0100000001000264e23cbd6efd22074d046cbfbbbe144083ae14b65e19b7d3ba40410938477a1b010000000100000001000264e23cbd6efd22074d046cbfbbbe144083ae14b65e19b7d3ba40410938477a1b0100000000"}
---------------------
RESPONSE:
---------------------
{"transaction_id": "8f4e9fb3f840efff8b39f834da0dcf45b53b5fb2ef2e03945a31917f07b94ad7","processed": {"id": "8f4e9fb3f840efff8b39f834da0dcf45b53b5fb2ef2e03945a31917f07b94ad7","receipt": {"status": "executed","cpu_usage_us": 1247,"net_usage_words": 25},"elapsed": 1247,"net_usage": 200,"scheduled": false,"action_traces": [{"receipt": {"receiver": "eosio","act_digest": "dc21abe37639a466e558ddaade715e074c4ca0245c795941adf1226942354139","global_sequence": 25264,"recv_sequence": 25264,"auth_sequence": [["eosio",25263]],"code_sequence": 0,"abi_sequence": 0},"act": {"account": "eosio","name": "newaccount","authorization": [{"actor": "eosio","permission": "active"}],"data": {"creator": "eosio","name": "test1","owner": {"threshold": 1,"keys": [{"key": "EOS5evHy7q26ReZ7FyAvtATWNpNr4FXfMmKU9BvP9s6ioCmZqQMCT","weight": 1}],"accounts": [],"waits": []},"active": {"threshold": 1,"keys": [{"key": "EOS5evHy7q26ReZ7FyAvtATWNpNr4FXfMmKU9BvP9s6ioCmZqQMCT","weight": 1}],"accounts": [],"waits": []}},"hex_data": "0000000000ea3055000000008090b1ca0100000001000264e23cbd6efd22074d046cbfbbbe144083ae14b65e19b7d3ba40410938477a1b010000000100000001000264e23cbd6efd22074d046cbfbbbe144083ae14b65e19b7d3ba40410938477a1b01000000"},"elapsed": 495,"cpu_usage": 0,"console": "","total_cpu_usage": 0,"trx_id": "8f4e9fb3f840efff8b39f834da0dcf45b53b5fb2ef2e03945a31917f07b94ad7","inline_traces": []}],"except": null}
}
---------------------
executed transaction: 8f4e9fb3f840efff8b39f834da0dcf45b53b5fb2ef2e03945a31917f07b94ad7  200 bytes  1247 us
#         eosio <= eosio::newaccount            {"creator":"eosio","name":"test1","owner":{"threshold":1,"keys":[{"key":"EOS5evHy7q26ReZ7FyAvtATWNpN...
warning: transaction executed locally, but may not be confirmed by the network yet
$ ./cleos create key
Private key: 5JbYSevSM7sTmnbkb8hFEhpuEzjGiSSmDXVLx1jGoG8qtwedqEC
Public key: EOS5vGTBNYivtgT7w3bnZzSK6nEqAfoe3tGRfhxCgjdGr5zRXNJJP
$ ./cleos wallet import -n w1 5JbYSevSM7sTmnbkb8hFEhpuEzjGiSSmDXVLx1jGoG8qtwedqEC
REQUEST:
---------------------
POST /v1/wallet/import_key HTTP/1.0
Host: localhost
content-length: 60
Accept: */*
Connection: close["w1","5JbYSevSM7sTmnbkb8hFEhpuEzjGiSSmDXVLx1jGoG8qtwedqEC"]
---------------------
RESPONSE:
---------------------
{}
---------------------
imported private key for: EOS5vGTBNYivtgT7w3bnZzSK6nEqAfoe3tGRfhxCgjdGr5zRXNJJP
$ ./cleos create account test1 test2 EOS5vGTBNYivtgT7w3bnZzSK6nEqAfoe3tGRfhxCgjdGr5zRXNJJP
REQUEST:
---------------------
POST /v1/chain/get_info HTTP/1.0
Host: localhost
content-length: 0
Accept: */*
Connection: close---------------------
RESPONSE:
---------------------
{"server_version": "79651199","chain_id": "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f","head_block_num": 25347,"last_irreversible_block_num": 25346,"last_irreversible_block_id": "00006302a3f4852917b45436a8e282c1adc336b8256d3cad1d13cd8835586b17","head_block_id": "0000630381211b37a97fa2b4fa7e11b738db35493dea5904c15cad8b29d960b6","head_block_time": "2018-07-02T01:55:24.000","head_block_producer": "eosio","virtual_block_cpu_limit": 200000000,"virtual_block_net_limit": 1048576000,"block_cpu_limit": 199900,"block_net_limit": 1048576
}
---------------------
REQUEST:
---------------------
POST /v1/wallet/get_public_keys HTTP/1.0
Host: localhost
content-length: 0
Accept: */*
Connection: close---------------------
RESPONSE:
---------------------
["EOS5DnBiXzg7WJDcqpVa5RtvBxnF94DadwokVtM1xCy3BSGiJpfJ3","EOS5evHy7q26ReZ7FyAvtATWNpNr4FXfMmKU9BvP9s6ioCmZqQMCT","EOS5vGTBNYivtgT7w3bnZzSK6nEqAfoe3tGRfhxCgjdGr5zRXNJJP","EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","EOS6iqBbXReXaERSW9Ubv19M8JtQFWJ3gsoJaxE4HiLsPsEGJjvqP","EOS7bcZoaEmV46VDpHxxsyn4K3QwQZW13Nodp6K7Jpiyn3TjHbhsF","EOS81YV1WK9nisqyFrbS7nZjh9NYS1K5xjntyMkCW1VopBDrtEMgT","EOS82x2vmDFkvkzfHXaEF3SepfV9YRf58Z9pZDRcVeABVGA4LCoc2"
]
---------------------
REQUEST:
---------------------
POST /v1/chain/get_required_keys HTTP/1.0
Host: localhost
content-length: 1007
Accept: */*
Connection: close{"transaction":{"expiration":"2018-07-02T01:55:54","ref_block_num":25346,"ref_block_prefix":911520791,"max_net_usage_words":0,"max_cpu_usage_ms":0,"delay_sec":0,"context_free_actions":[],"actions":[{"account":"eosio","name":"newaccount","authorization":[{"actor":"test1","permission":"active"}],"data":"000000008090b1ca000000000091b1ca0100000001000287bb75b6def7ffc085b488a8ebc043442107242c620d0a256b5824ff9154c099010000000100000001000287bb75b6def7ffc085b488a8ebc043442107242c620d0a256b5824ff9154c09901000000"}],"transaction_extensions":[]},"available_keys":["EOS5DnBiXzg7WJDcqpVa5RtvBxnF94DadwokVtM1xCy3BSGiJpfJ3","EOS5evHy7q26ReZ7FyAvtATWNpNr4FXfMmKU9BvP9s6ioCmZqQMCT","EOS5vGTBNYivtgT7w3bnZzSK6nEqAfoe3tGRfhxCgjdGr5zRXNJJP","EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","EOS6iqBbXReXaERSW9Ubv19M8JtQFWJ3gsoJaxE4HiLsPsEGJjvqP","EOS7bcZoaEmV46VDpHxxsyn4K3QwQZW13Nodp6K7Jpiyn3TjHbhsF","EOS81YV1WK9nisqyFrbS7nZjh9NYS1K5xjntyMkCW1VopBDrtEMgT","EOS82x2vmDFkvkzfHXaEF3SepfV9YRf58Z9pZDRcVeABVGA4LCoc2"]}
---------------------
RESPONSE:
---------------------
{"required_keys": ["EOS5evHy7q26ReZ7FyAvtATWNpNr4FXfMmKU9BvP9s6ioCmZqQMCT"]
}
---------------------
REQUEST:
---------------------
POST /v1/wallet/sign_transaction HTTP/1.0
Host: localhost
content-length: 690
Accept: */*
Connection: close[{"expiration":"2018-07-02T01:55:54","ref_block_num":25346,"ref_block_prefix":911520791,"max_net_usage_words":0,"max_cpu_usage_ms":0,"delay_sec":0,"context_free_actions":[],"actions":[{"account":"eosio","name":"newaccount","authorization":[{"actor":"test1","permission":"active"}],"data":"000000008090b1ca000000000091b1ca0100000001000287bb75b6def7ffc085b488a8ebc043442107242c620d0a256b5824ff9154c099010000000100000001000287bb75b6def7ffc085b488a8ebc043442107242c620d0a256b5824ff9154c09901000000"}],"transaction_extensions":[],"signatures":[],"context_free_data":[]},["EOS5evHy7q26ReZ7FyAvtATWNpNr4FXfMmKU9BvP9s6ioCmZqQMCT"],"cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f"]
---------------------
RESPONSE:
---------------------
{"expiration": "2018-07-02T01:55:54","ref_block_num": 25346,"ref_block_prefix": 911520791,"max_net_usage_words": 0,"max_cpu_usage_ms": 0,"delay_sec": 0,"context_free_actions": [],"actions": [{"account": "eosio","name": "newaccount","authorization": [{"actor": "test1","permission": "active"}],"data": "000000008090b1ca000000000091b1ca0100000001000287bb75b6def7ffc085b488a8ebc043442107242c620d0a256b5824ff9154c099010000000100000001000287bb75b6def7ffc085b488a8ebc043442107242c620d0a256b5824ff9154c09901000000"}],"transaction_extensions": [],"signatures": ["SIG_K1_K8358DgTuxvSnzTqeBjjXC82Govb8SswFW6e1FaSQVQZh3VyZQg28bAFP4zx9mdoE2EgtUpSs2u2shA3bthuKEhKEKiw2d"],"context_free_data": []
}
---------------------
REQUEST:
---------------------
POST /v1/chain/push_transaction HTTP/1.0
Host: localhost
content-length: 491
Accept: */*
Connection: close{"signatures":["SIG_K1_K8358DgTuxvSnzTqeBjjXC82Govb8SswFW6e1FaSQVQZh3VyZQg28bAFP4zx9mdoE2EgtUpSs2u2shA3bthuKEhKEKiw2d"],"compression":"none","packed_context_free_data":"","packed_trx":"2a86395b026317b4543600000000010000000000ea305500409e9a2264b89a01000000008090b1ca00000000a8ed323266000000008090b1ca000000000091b1ca0100000001000287bb75b6def7ffc085b488a8ebc043442107242c620d0a256b5824ff9154c099010000000100000001000287bb75b6def7ffc085b488a8ebc043442107242c620d0a256b5824ff9154c0990100000000"}
---------------------
RESPONSE:
---------------------
{"transaction_id": "3a7bdff6986f1becd1855212caabe3f3599931eb0c26caf79cfd6301d814a963","processed": {"id": "3a7bdff6986f1becd1855212caabe3f3599931eb0c26caf79cfd6301d814a963","receipt": {"status": "executed","cpu_usage_us": 716,"net_usage_words": 25},"elapsed": 716,"net_usage": 200,"scheduled": false,"action_traces": [{"receipt": {"receiver": "eosio","act_digest": "c91d190f451f6acbeb1312479873ab9162d50b89c048e8f7730b6b5ba553e7a3","global_sequence": 25351,"recv_sequence": 25351,"auth_sequence": [["test1",1]],"code_sequence": 0,"abi_sequence": 0},"act": {"account": "eosio","name": "newaccount","authorization": [{"actor": "test1","permission": "active"}],"data": {"creator": "test1","name": "test2","owner": {"threshold": 1,"keys": [{"key": "EOS5vGTBNYivtgT7w3bnZzSK6nEqAfoe3tGRfhxCgjdGr5zRXNJJP","weight": 1}],"accounts": [],"waits": []},"active": {"threshold": 1,"keys": [{"key": "EOS5vGTBNYivtgT7w3bnZzSK6nEqAfoe3tGRfhxCgjdGr5zRXNJJP","weight": 1}],"accounts": [],"waits": []}},"hex_data": "000000008090b1ca000000000091b1ca0100000001000287bb75b6def7ffc085b488a8ebc043442107242c620d0a256b5824ff9154c099010000000100000001000287bb75b6def7ffc085b488a8ebc043442107242c620d0a256b5824ff9154c09901000000"},"elapsed": 282,"cpu_usage": 0,"console": "","total_cpu_usage": 0,"trx_id": "3a7bdff6986f1becd1855212caabe3f3599931eb0c26caf79cfd6301d814a963","inline_traces": []}],"except": null}
}
---------------------
executed transaction: 3a7bdff6986f1becd1855212caabe3f3599931eb0c26caf79cfd6301d814a963  200 bytes  716 us
#         eosio <= eosio::newaccount            {"creator":"test1","name":"test2","owner":{"threshold":1,"keys":[{"key":"EOS5vGTBNYivtgT7w3bnZzSK6nE...
warning: transaction executed locally, but may not be confirmed by the network yet

同一个key 创建多个账号,用一个账号创建test3

$ ./cleos create account test1 test3 EOS5vGTBNYivtgT7w3bnZzSK6nEqAfoe3tGRfhxCgjdGr5zRXNJJP
zfd locale_domain:cleoslocale_path:/usr/local/share/locale
zfd parse ,args[5]:EOS5vGTBNYivtgT7w3bnZzSK6nEqAfoe3tGRfhxCgjdGr5zRXNJJP
zfd parse ,args[4]:test3
zfd parse ,args[3]:test1
zfd parse ,args[2]:account
zfd parse ,args[1]:create
zfd _parse_subcommand: create
zfd _parse_subcommand: account
REQUEST:
---------------------
POST /v1/chain/get_info HTTP/1.0
Host: localhost
content-length: 0
Accept: */*
Connection: close---------------------
RESPONSE:
---------------------
{"server_version": "79651199","chain_id": "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f","head_block_num": 25441,"last_irreversible_block_num": 25440,"last_irreversible_block_id": "000063600b6a74134e3cd04569fb31fa2c869da25788cd2dd783fa8bd965c3c7","head_block_id": "000063611596e7b3e21cb4ed82c3a17469494e7fef368b55fd4db9eb84b7b0fd","head_block_time": "2018-07-02T01:56:11.000","head_block_producer": "eosio","virtual_block_cpu_limit": 200000000,"virtual_block_net_limit": 1048576000,"block_cpu_limit": 199900,"block_net_limit": 1048576
}
---------------------
REQUEST:
---------------------
POST /v1/wallet/get_public_keys HTTP/1.0
Host: localhost
content-length: 0
Accept: */*
Connection: close---------------------
RESPONSE:
---------------------
["EOS5DnBiXzg7WJDcqpVa5RtvBxnF94DadwokVtM1xCy3BSGiJpfJ3","EOS5evHy7q26ReZ7FyAvtATWNpNr4FXfMmKU9BvP9s6ioCmZqQMCT","EOS5vGTBNYivtgT7w3bnZzSK6nEqAfoe3tGRfhxCgjdGr5zRXNJJP","EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","EOS6iqBbXReXaERSW9Ubv19M8JtQFWJ3gsoJaxE4HiLsPsEGJjvqP","EOS7bcZoaEmV46VDpHxxsyn4K3QwQZW13Nodp6K7Jpiyn3TjHbhsF","EOS81YV1WK9nisqyFrbS7nZjh9NYS1K5xjntyMkCW1VopBDrtEMgT","EOS82x2vmDFkvkzfHXaEF3SepfV9YRf58Z9pZDRcVeABVGA4LCoc2"
]
---------------------
REQUEST:
---------------------
POST /v1/chain/get_required_keys HTTP/1.0
Host: localhost
content-length: 1008
Accept: */*
Connection: close{"transaction":{"expiration":"2018-07-02T01:56:41","ref_block_num":25440,"ref_block_prefix":1171274830,"max_net_usage_words":0,"max_cpu_usage_ms":0,"delay_sec":0,"context_free_actions":[],"actions":[{"account":"eosio","name":"newaccount","authorization":[{"actor":"test1","permission":"active"}],"data":"000000008090b1ca000000008091b1ca0100000001000287bb75b6def7ffc085b488a8ebc043442107242c620d0a256b5824ff9154c099010000000100000001000287bb75b6def7ffc085b488a8ebc043442107242c620d0a256b5824ff9154c09901000000"}],"transaction_extensions":[]},"available_keys":["EOS5DnBiXzg7WJDcqpVa5RtvBxnF94DadwokVtM1xCy3BSGiJpfJ3","EOS5evHy7q26ReZ7FyAvtATWNpNr4FXfMmKU9BvP9s6ioCmZqQMCT","EOS5vGTBNYivtgT7w3bnZzSK6nEqAfoe3tGRfhxCgjdGr5zRXNJJP","EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","EOS6iqBbXReXaERSW9Ubv19M8JtQFWJ3gsoJaxE4HiLsPsEGJjvqP","EOS7bcZoaEmV46VDpHxxsyn4K3QwQZW13Nodp6K7Jpiyn3TjHbhsF","EOS81YV1WK9nisqyFrbS7nZjh9NYS1K5xjntyMkCW1VopBDrtEMgT","EOS82x2vmDFkvkzfHXaEF3SepfV9YRf58Z9pZDRcVeABVGA4LCoc2"]}
---------------------
RESPONSE:
---------------------
{"required_keys": ["EOS5evHy7q26ReZ7FyAvtATWNpNr4FXfMmKU9BvP9s6ioCmZqQMCT"]
}
---------------------
REQUEST:
---------------------
POST /v1/wallet/sign_transaction HTTP/1.0
Host: localhost
content-length: 691
Accept: */*
Connection: close[{"expiration":"2018-07-02T01:56:41","ref_block_num":25440,"ref_block_prefix":1171274830,"max_net_usage_words":0,"max_cpu_usage_ms":0,"delay_sec":0,"context_free_actions":[],"actions":[{"account":"eosio","name":"newaccount","authorization":[{"actor":"test1","permission":"active"}],"data":"000000008090b1ca000000008091b1ca0100000001000287bb75b6def7ffc085b488a8ebc043442107242c620d0a256b5824ff9154c099010000000100000001000287bb75b6def7ffc085b488a8ebc043442107242c620d0a256b5824ff9154c09901000000"}],"transaction_extensions":[],"signatures":[],"context_free_data":[]},["EOS5evHy7q26ReZ7FyAvtATWNpNr4FXfMmKU9BvP9s6ioCmZqQMCT"],"cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f"]
---------------------
RESPONSE:
---------------------
{"expiration": "2018-07-02T01:56:41","ref_block_num": 25440,"ref_block_prefix": 1171274830,"max_net_usage_words": 0,"max_cpu_usage_ms": 0,"delay_sec": 0,"context_free_actions": [],"actions": [{"account": "eosio","name": "newaccount","authorization": [{"actor": "test1","permission": "active"}],"data": "000000008090b1ca000000008091b1ca0100000001000287bb75b6def7ffc085b488a8ebc043442107242c620d0a256b5824ff9154c099010000000100000001000287bb75b6def7ffc085b488a8ebc043442107242c620d0a256b5824ff9154c09901000000"}],"transaction_extensions": [],"signatures": ["SIG_K1_KkoTRLq8pZKS8q9PrBKYk6ELHQVg47Ub3qYy9k3fbyDMYeDg3oAcn2HY7pLwS27FwPDQU57BHqDTQrBj78a9KjTpVnXKBm"],"context_free_data": []
}
---------------------
REQUEST:
---------------------
POST /v1/chain/push_transaction HTTP/1.0
Host: localhost
content-length: 491
Accept: */*
Connection: close{"signatures":["SIG_K1_KkoTRLq8pZKS8q9PrBKYk6ELHQVg47Ub3qYy9k3fbyDMYeDg3oAcn2HY7pLwS27FwPDQU57BHqDTQrBj78a9KjTpVnXKBm"],"compression":"none","packed_context_free_data":"","packed_trx":"5986395b60634e3cd04500000000010000000000ea305500409e9a2264b89a01000000008090b1ca00000000a8ed323266000000008090b1ca000000008091b1ca0100000001000287bb75b6def7ffc085b488a8ebc043442107242c620d0a256b5824ff9154c099010000000100000001000287bb75b6def7ffc085b488a8ebc043442107242c620d0a256b5824ff9154c0990100000000"}
---------------------
RESPONSE:
---------------------
{"transaction_id": "68c792c7d5dfbc317282833d98e54e7165c8f836cb804055be15aff61693a485","processed": {"id": "68c792c7d5dfbc317282833d98e54e7165c8f836cb804055be15aff61693a485","receipt": {"status": "executed","cpu_usage_us": 1144,"net_usage_words": 25},"elapsed": 1144,"net_usage": 200,"scheduled": false,"action_traces": [{"receipt": {"receiver": "eosio","act_digest": "a759bbb1f0519c09c1eaf24893dd88197860edd29c914f8893f971983a584946","global_sequence": 25446,"recv_sequence": 25446,"auth_sequence": [["test1",2]],"code_sequence": 0,"abi_sequence": 0},"act": {"account": "eosio","name": "newaccount","authorization": [{"actor": "test1","permission": "active"}],"data": {"creator": "test1","name": "test3","owner": {"threshold": 1,"keys": [{"key": "EOS5vGTBNYivtgT7w3bnZzSK6nEqAfoe3tGRfhxCgjdGr5zRXNJJP","weight": 1}],"accounts": [],"waits": []},"active": {"threshold": 1,"keys": [{"key": "EOS5vGTBNYivtgT7w3bnZzSK6nEqAfoe3tGRfhxCgjdGr5zRXNJJP","weight": 1}],"accounts": [],"waits": []}},"hex_data": "000000008090b1ca000000008091b1ca0100000001000287bb75b6def7ffc085b488a8ebc043442107242c620d0a256b5824ff9154c099010000000100000001000287bb75b6def7ffc085b488a8ebc043442107242c620d0a256b5824ff9154c09901000000"},"elapsed": 469,"cpu_usage": 0,"console": "","total_cpu_usage": 0,"trx_id": "68c792c7d5dfbc317282833d98e54e7165c8f836cb804055be15aff61693a485","inline_traces": []}],"except": null}
}
---------------------
executed transaction: 68c792c7d5dfbc317282833d98e54e7165c8f836cb804055be15aff61693a485  200 bytes  1144 us
#         eosio <= eosio::newaccount            {"creator":"test1","name":"test3","owner":{"threshold":1,"keys":[{"key":"EOS5vGTBNYivtgT7w3bnZzSK6nE...
warning: transaction executed locally, but may not be confirmed by the network yet



更多推荐

eos代码阅读笔记04

本文发布于:2024-02-13 15:22:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1759309.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:代码   笔记   eos

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!