eos的工程文件中包含了一些程序和工具下面就是你目標能夠用的,能看到的。node
EOS daemon的縮寫,能夠理解爲EOS的主程序,用來運行節點的。好比說你是個區塊生產者,那你能夠只跑這個程序。json
EOS commandline tool。也就是命令行工具。能夠操做eosd中有的REST api。 官方也在介紹裏說了,想要使用eosc,必須有一個端口開放給eosd,同時設置好eosc去加載「eosio::chain_api_plugin」。api
eosc支持的指令以下bash
ERROR: RequiredError: Subcommand required
Command Line Interface to Eos Client
Usage: ./eosc [OPTIONS] SUBCOMMAND
Options:
-h,--help Print this help message and exit
-H,--host TEXT=localhost the host where eosd is running
-p,--port UINT=8888 the port where eosd is running
--wallet-host TEXT=localhost
the host where eos-walletd is running
--wallet-port UINT=8888 the port where eos-walletd is running
-v,--verbose output verbose messages on error
Subcommands:
version Retrieve version information
create Create various items, on and off the blockchain
get Retrieve various items and information from the blockchain
set Set or update blockchain state
transfer Transfer EOS from account to account
net Interact with local p2p network connections
wallet Interact with local wallet
benchmark Configure and execute benchmarks
push Push arbitrary transactions to the blockchain
複製代碼
EOS 錢包主程序。app
用於簡化多個eosd在LAN下分發。能夠用CLI對每一個node的配置文件進行配置。函數
位於EOSIO/genesis
下的一個模塊,其中有一個nodejs程序用於生成密集交易合約快照。工具
用於生成ABI規範文件的工具測試
eoscpp可以識別合約中源代碼內容,生成ABI規範文件。ui
如需申明一個類型處處到ABI中,好比是一個操做,或者是一張表格,必須在類型生命以前的註釋中添加**@abi**標識符。this
語法以下:
eoscpp在使用的時候必須附加上-g選項。
eoscpp -g abi.json types.hpp
Generated abi.json ...
複製代碼
eoscpp固然也能夠用以生成 序列化/逆序列化 的輔助函數。
eoscpp -g abi.json -gs types.hpp
Generated abi.json ...
Generated types.gen.hpp ...
複製代碼
#include <eoslib/types.hpp>
#include <eoslib/string.hpp>
//@abi action
struct action_name {
uint64_t param1;
uint64_t param2;
eosio::string param3;
};
{
"types": [],
"structs": [{
"name": "action_name",
"base": "",
"fields": {
"param1": "uint64",
"param2": "uint64",
"param3": "string"
}
}
],
"actions": [{
"action_name": "actionname",
"type": "action_name"
}
],
"tables": []
}
複製代碼
#include <eoslib/types.hpp>
#include <eoslib/string.hpp>
//@abi action action1 action2
struct action_name {
uint64_t param1;
uint64_t param2;
eosio::string param3;
};
{
"types": [],
"structs": [{
"name": "action_name",
"base": "",
"fields": {
"param1": "uint64",
"param2": "uint64",
"param3": "string"
}
}
],
"actions": [{
"action_name": "action1",
"type": "action_name"
},{
"action_name": "action2",
"type": "action_name"
}
],
"tables": []
}
複製代碼
#include <eoslib/types.hpp>
#include <eoslib/string.hpp>
//@abi table
struct my_table {
uint64_t key;
};
{
"types": [],
"structs": [{
"name": "my_table",
"base": "",
"fields": {
"key": "uint64"
}
}
],
"actions": [],
"tables": [{
"table_name": "mytable",
"index_type": "i64",
"key_names": [
"key"
],
"key_types": [
"uint64"
],
"type": "my_table"
}
]
}
複製代碼
#include <eoslib/types.hpp>
//@abi table i64
struct my_new_table {
uint64_t key;
uint64_t name;
uint64_t age;
};
{
"types": [],
"structs": [{
"name": "my_new_table",
"base": "",
"fields": {
"key": "uint64",
"name": "uint64",
"age": "uint64"
}
}
],
"actions": [],
"tables": [{
"table_name": "mynewtable",
"index_type": "i64",
"key_names": [
"key"
],
"key_types": [
"uint64"
],
"type": "my_new_table"
}
]
}
複製代碼
#include <eoslib/types.hpp>
#include <eoslib/string.hpp>
/*
* @abi table
* @abi action
*/
struct my_type {
eosio::string key;
eosio::name value;
};
{
"types": [],
"structs": [{
"name": "my_type",
"base": "",
"fields": {
"key": "string",
"value": "name"
}
}
],
"actions": [{
"action_name": "mytype",
"type": "my_type"
}
],
"tables": [{
"table_name": "mytype",
"index_type": "str",
"key_names": [
"key"
],
"key_types": [
"string"
],
"type": "my_type"
}
]
}
複製代碼
#include <eoslib/types.hpp>
struct simple {
uint64_t u64;
};
typedef simple simple_alias;
typedef eosio::name name_alias;
//@abi action
struct action_one : simple_alias {
uint32_t u32;
name_alias name;
};
{
"types": [{
"new_type_name": "simple_alias",
"type": "simple"
},{
"new_type_name": "name_alias",
"type": "name"
}
],
"structs": [{
"name": "simple",
"base": "",
"fields": {
"u64": "uint64"
}
},{
"name": "action_one",
"base": "simple_alias",
"fields": {
"u32": "uint32",
"name": "name_alias"
}
}
],
"actions": [{
"action_name": "actionone",
"type": "action_one"
}
],
"tables": []
}
複製代碼
#include <eoslib/types.hpp>
#include <eoslib/string.hpp>
struct simple {
uint32_t u32;
fixed_string16 s16;
};
struct my_complex_type {
uint64_t u64;
eosio::string str;
simple simple;
bytes bytes;
public_key pub;
};
typedef my_complex_type complex;
//@abi action
struct test_action {
uint32_t u32;
complex cplx;
};
void apply( uint64_t code, uint64_t action ) {
if( code == N(mycontract) ) {
if( action == N(testaction) ) {
auto msg = eosio::current_message<test_action>();
eosio::print("test_action content\n");
eosio::dump(msg);
bytes b = eosio::raw::pack(msg);
printhex(b.data, b.len);
}
}
}
複製代碼
限制:表和操做名稱不能用下劃線(「_」)
eosc push message mycontract testaction '{"u32":"1000", "cplx":{"u64":"472", "str":"hello", "bytes":"B0CA", "pub":"EOS8CY2pCW5THmzvPTgEh5WLEAxgpVFXaPogPvgvVpVWCYMRdzmwx", "simple":{"u32":"164","s16":"small-string"}}}' -S mycontract
複製代碼
產生的結果以下:
test_action content
u32:[1000]
cplx:[
u64:[472]
str:[hello]
simple:[
u32:[164]
s16:[small-string]
]
bytes:[b0ca]
pub:[03b41078f445628882fe8c1e629909cbbd67ff4b592b832264dac187ac730177f1]
]
e8030000d8010000000000000568656c6c6fa40000000c736d616c6c2d737472696e6702b0ca03b41078f445628882fe8c1e629909cbbd67ff4b592b832264dac187ac730177f1
複製代碼