From f3183ae0776cfc513e3690e22c3e62a699823ca9 Mon Sep 17 00:00:00 2001 From: Marlon Hanks Date: Thu, 24 Dec 2020 21:09:23 -0500 Subject: [PATCH] Update XLT_Protobuf_Protocol.md --- XLT_Protobuf_Protocol.md | 934 +++++++++++++++++++++++++++++++++------ 1 file changed, 797 insertions(+), 137 deletions(-) diff --git a/XLT_Protobuf_Protocol.md b/XLT_Protobuf_Protocol.md index f4fc975d3..83a51e286 100644 --- a/XLT_Protobuf_Protocol.md +++ b/XLT_Protobuf_Protocol.md @@ -1,110 +1,115 @@ -# LITETOKENS protobuf protocol - -## LITETOKENS uses Google protobuf protocol, which involves accounts, blocks, and multiple levels of transmission. - -+ There are three types of accounts: basic account, asset release account and contract account. An account contains 6 attributes: account name, account type, address, balance, voting, and other assets. -+ Furthermore, the basic account can be applied to become a verification node, which has additional attributes, statistical voting number, public key, URL, and historical performance parameters. - - Three types of `Account`: `Normal`, `AssetIssue`, and `Contract`. - - enum AccountType { - Normal = 0; - AssetIssue = 1; - Contract = 2; - } - - A `Account` contains 7 kinds of parameters: - `account_name`: The name of the account-for example: "_SicCongsAccount_". - `type`: The type of the account-for example: _0_ represents the account type is `Normal`. - `balance`: XLT balance of the account-for example: _4213312_. - `votes`: The number of votes from the account-for example: _{("0x1b7w...9xj3",323),("0x8djq...j12m",88),...,("0x82nd...mx6i",10001)}_. - `asset`: other assets on the account except XLT-for example: _{<"WishToken",66666>,<"Dogie",233>}_. - `latest_operation_time`: The latest active time of the account. - - // Account - message Account { - message Vote { - bytes vote_address = 1; - int64 vote_count = 2; - } - bytes accout_name = 1; - AccountType type = 2; - bytes address = 3; - int64 balance = 4; - repeated Vote votes = 5; - map asset = 6; +[](#litetokens-protobuf-protocol)LITETOKENS protobuf protocol +============================================================= + +[](#litetokens使用google-protobuf协议协议内容涉及到账户区块传输多个层面)LITETOKENS uses the Google protobuf protocol, which involves accounts, blocks, and multiple levels of transmission. +---------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +* There are three types of accounts: basic accounts, asset release accounts and contract accounts. An account contains 6 attributes: account name, account type, address, balance, voting, and other assets. +* Furthermore, the basic account can apply to become a verification node. The verification node has additional attributes, voting statistics, public key, URL, and historical performance parameters. + +Three kinds of types:`Account` , , .`Normal``AssetIssue``Contract` + + enum AccountType {
 + Normal = 0;
 + AssetIssue = 1;
 + Contract = 2;
 + } + + +One `Account`contains 7 kinds of parameters:: +`account_name`The name of the account-for example: " _SicCongsAccount_ ". +`type`: The type of the account-for example: _0_ represents the type of account `Normal`. +`balance`: The XLT balance of the account-for example: _4213312_ . +`votes`: The number of votes from the account-for example: _{("0x1b7w...9xj3",323),("0x8djq...j12m",88),...,("0x82nd...mx6i",10001)}_ . +`asset`: Other assets on the account except XLT-for example: _{<"WishToken",66666>,<"Dogie",233>}_ . `latest_operation_time`: The latest active time of the account. + + // Account
 + message Account {
 + message Vote {
 + bytes vote_address = 1;
 + int64 vote_count = 2;
 + }
 + bytes accout_name = 1;
 + AccountType type = 2;
 + bytes address = 3;
 + int64 balance = 4;
 + repeated Vote votes = 5;
 + map asset = 6;
 int64 latest_operation_time = 10; } + - A `Witness` contains 8 kinds of parameters: - `address`: the address of the verification node-for example: _"0xu82h...7237"_. - `voteCount`: The number of votes obtained by the verification node-for example: _234234_. - `pubKey`: the public key of the verification node-for example: _"0xu82h...7237"_. - `url`: url link of verification node. - `totalProduce`: the number of blocks produced by the verification node-for example: _2434_. - `totalMissed`: The number of blocks lost by the verification node-for example: _7_. - `latestBlockNum`: The latest block height-for example: _4522_. - `isJobs`: Boolean table type flag bit. +One `Witness`contains 8 kinds of parameters:: +`address`the address of the verification node-for example: _"0xu82h...7237"_ . +`voteCount`: The number of votes obtained by the verification node-for example: _234234_ . +`pubKey`: The public key of the verification node-for example: _"0xu82h...7237"_ . +`url`: Verify the url link of the node. +`totalProduce`: The number of blocks generated by the verification node-for example: _2434_ . +`totalMissed`: The number of blocks lost by the verification node-for example: _7_ . +`latestBlockNum`: The latest block height-for example: _4522_ . `isJobs`: Boolean table type flag bit. - // Witness - message Witness { - bytes address = 1; - int64 voteCount = 2; - bytes pubKey = 3; - string url = 4; - int64 totalProduced = 5; - int64 totalMissed = 6; + // Witness
 + message Witness {
 + bytes address = 1;
 + int64 voteCount = 2;
 + bytes pubKey = 3;
 + string url = 4;
 + int64 totalProduced = 5;
 + int64 totalMissed = 6;
 int64 latestBlockNum = 7; bool isJobs = 9; - } + 
} + -+ A block consists of a block header and multiple transactions. The block header contains the basic information of the block such as timestamp, the root of the transaction dictionary tree, parent hash, and signature. +* A block consists of a block header and multiple transactions. The block header contains the basic information of the block such as timestamp, the root of the transaction dictionary tree, parent hash, and signature. - A `block` contains `transactions` and `block_header`. - `transactions`: Transaction information in the block. - `block_header`: One of the components of the block. +An `block`inclusive `transactions`sum `block_header`. +`transactions`: Transaction information in the block. +`block_header`: One of the components of the block. - // block - message Block { - repeated Transaction transactions = 1; + // block
 + message Block {
 + repeated Transaction transactions = 1;
 BlockHeader block_header = 2; - } + 
} + - `BlockHeader` includes `raw_data` and `witness_signature`. - `raw_data`: `raw` information. - `witness_signature`: The signature from the block header to the verification node. - - The message `raw` contains 6 kinds of parameters: - `timestamp`: The timestamp of the message body-for example: _14356325_. - `txTrieRoot`: The root of the Merkle Tree-for example: _"7dacsa...3ed"_. - `parentHash`: The hash value of the previous block-for example: _"7dacsa...3ed"_. - `number`: block height-for example: _13534657_. - `witness_id`: the id of the verification node-for example: _"0xu82h...7237"_. - `witness_address`: the address of the verification node-for example: _"0xu82h...7237"_. - - message BlockHeader { - message raw { - int64 timestamp = 1; - bytes txTrieRoot = 2; - bytes parentHash = 3; - //bytes nonce = 5; - //bytes difficulty = 6; - uint64 number = 7; - uint64 witness_id = 8; - bytes witness_address = 9; - } - raw raw_data = 1; +`BlockHeader`Including `raw_data`and `witness_signature`. +`raw_data`: `raw`Information. +`witness_signature`: The signature from the block head to the verification node. + +The message `raw`contains 6 kinds of parameters:: +`timestamp`The timestamp of the message body-for example: _14356325_ . +`txTrieRoot`: The root of the Merkle Tree-for example: _"7dacsa...3ed"_ . +`parentHash`: The hash value of the previous block-for example: _"7dacsa...3ed"_ . +`number`: Block height-for example: _13534657_ . +`witness_id`: Verify the id of the node-for example: _"0xu82h...7237"_ . +`witness_address`: The address of the verification node-for example: _"0xu82h...7237"_ . + + message BlockHeader {
 + message raw {
 + int64 timestamp = 1;
 + bytes txTrieRoot = 2;
 + bytes parentHash = 3;
 + //bytes nonce = 5;
 + //bytes difficulty = 6;
 + uint64 number = 7;
 + uint64 witness_id = 8;
 + bytes witness_address = 9;
 + }
 + raw raw_data = 1;
 bytes witness_signature = 2; - } + 
} + + +Message body `ChainInventory`comprises `BlockId`and `remain_num`. +`BlockId`: Identity information of the block. +`remain_num`: The number of remaining blocks during the synchronization process. + +A `BlockId`contains 2 parameters:: +`hash`The hash value of the block. +`number`: The height is the current block number. - The message body `ChainInventory` includes `BlockId` and `remain_num`. - `BlockId`: the identity information of the block. - `remain_num`: The number of remaining blocks during the synchronization process. - - A `BlockId` contains 2 parameters: - `hash`: The hash value of the block. - `number`: The height is the current block number. - message ChainInventory { message BlockId { bytes hash = 1; @@ -113,64 +118,719 @@ repeated BlockId ids = 1; int64 remain_num = 2; } - -+ There are many types of trading contracts, including account creation contract, account update contract, transfer contract, transfer assertion contract, asset voting contract, witness node voting contract, witness node creation contract, witness node update contract, asset release contract, participation in asset release 11 types of and deployment contracts. + + +* There are many types of trading contracts, including account creation contract, account update contract, transfer contract, transfer assertion contract, asset voting contract, witness node voting contract, witness node creation contract, witness node update contract, asset release contract, participation in asset release and 11 types of deployment contracts. - `AccountCreatContract` contains 3 kinds of parameters: - `type`: Account type-for example: _0_ represents the account type `Normal`. - `account_name`: Account name-for example: _"SiCongsaccount"_. - `owner_address`: the address of the contract holder-for example: _"0xu82h...7237"_. +`AccountCreatContract`Contains 3 kinds of parameters:: +`type`account type-for example: _0_ represents the account type `Normal`. +`account_name`: Account name-for example: _"SiCongsaccount"_ . +`owner_address`: The address of the contract holder-for example: _"0xu82h...7237"_ . - message AccountCreateContract { - AccountType type = 1; - bytes account_name = 2; - bytes owner_address = 3; + message AccountCreateContract {
 + AccountType type = 1;
 + bytes account_name = 2;
 + bytes owner_address = 3;
 } - `AccountUpdateContract` contains 2 kinds of parameters: - `account_name`: Account name-for example: _"SiCongsaccount"_. - `owner_address`: the address of the contract holder-for example: _"0xu82h...7237"_. - + + +`AccountUpdateContract`Contains 2 kinds of parameters:: +`account_name`Account name-for example: _"SiCongsaccount"_ . +`owner_address`: The address of the contract holder-for example: _"0xu82h...7237"_ . + message AccountUpdateContract { bytes account_name = 1; bytes owner_address = 2; } - - `TransferContract` contains 3 kinds of parameters: - `amount`: XLT amount-for example: _12534_. - `to_address`: Receiver's address-for example: _"0xu82h...7237"_. - `owner_address`: the address of the contract holder-for example: _"0xu82h...7237"_. + - message TransferContract { - bytes owner_address = 1; - bytes to_address = 2; +`TransferContract`Contains 3 kinds of parameters:: +`amount`XLT number-for example: _12534_ . +`to_address`: Recipient's address-for example: _"0xu82h...7237"_ . +`owner_address`: The address of the contract holder-for example: _"0xu82h...7237"_ . + + message TransferContract {
 + bytes owner_address = 1;
 + bytes to_address = 2;
 int64 amount = 3; + 
} + + +`TransferAssetContract`Contains 4 kinds of parameters:: +`asset_name`Asset name-for example: _"SiCongsaccount"_ . +`to_address`: Recipient's address-for example: _"0xu82h...7237"_ . +`owner_address`: The address of the contract holder-for example: _"0xu82h...7237"_ . +`amount`: The number of target assets-for example: _12353_ . + + message TransferAssetContract {
 + bytes asset_name = 1;
 + bytes owner_address = 2;
 + bytes to_address = 3;
 + int64 amount = 4;
 } + - `TransferAssetContract` contains 4 kinds of parameters: - `asset_name`: Asset name-for example: _”SiCongsaccount”_. - `to_address`: recipient address-for example: _"0xu82h...7237"_. - `owner_address`: the address of the contract holder-for example: _"0xu82h...7237"_. - `amount`: The target asset amount-for example: _12353_. +`VoteAssetContract`Contains 4 kinds of parameters:: +`vote_address`Voter address-for example: _"0xu82h...7237"_ . +`support`: Vote for or not-for example: _true_ . +`owner_address`: The address of the contract holder-for example: _"0xu82h...7237"_ . +`count`: The number of votes-for example: _2324234_ . - message TransferAssetContract { - bytes asset_name = 1; - bytes owner_address = 2; - bytes to_address = 3; - int64 amount = 4; + message VoteAssetContract {
 + bytes owner_address = 1;
 + repeated bytes vote_address = 2;
 + bool support = 3;
 + int32 count = 5; + } + + +`VoteWitnessContract`Contains 4 kinds of parameters:: +`vote_address`Voter address-for example: _"0xu82h...7237"_ . +`support`: Vote for or not-for example: _true_ . +`owner_address`: The address of the contract holder-for example: _"0xu82h...7237"_ . +`count`: The number of votes-for example: _32632_ . + + message VoteWitnessContract {
 + bytes owner_address = 1;
 + repeated bytes vote_address = 2;
 + bool support = 3;
 + int32 count = 5;
 } + + +`WitnessCreateContract`Contains 3 kinds of parameters:: +`private_key`The private key of the contract-for example: _"0xu82h...7237"_ . +`owner_address`: The address of the contract holder-for example: _"0xu82h...7237"_ . +`url`: The url link of the contract. - `VoteAssetContract` contains 4 kinds of parameters: - `vote_address`: voter's address-for example: _"0xu82h...7237"_. - `support`: vote for or not-for example: _true_. - `owner_address`: the address of the contract holder-for example: _"0xu82h...7237"_. - `count`: the number of votes-for example: _2324234_. + message WitnessCreateContract {
 + bytes owner_address = 1;
 + bytes private_key = 2;
 + bytes url = 12; + 
} + - message VoteAssetContract { +`WitnessUpdateContract`Contains 2 kinds of parameters:: the +`owner_address`address of the contract holder-for example: _"0xu82h...7237"_ . +`update_url`: The url link of the contract. + + message WitnessUpdateContract { bytes owner_address = 1; - repeated bytes vote_address = 2; - bool support = 3; - int32 count = 5; + bytes update_url = 12; + } + + +`AssetIssueContract`Contains 11 kinds of parameters:: +`name`Contract name-for example: _"SiCongcontract"_ . +`total_supply`: The total number of votes in favor of the contract-for example: _100000000_ . +`owner_address`: The address of the contract holder-for example: _"0xu82h...7237"_ . +`xlt_num`: Corresponding to the number of XLT-for example: _232241_ . +`num`: The number of corresponding custom assets. +`start_time`: Start time-for example: _20170312_ . +`end_time`: End time-for example: _20170512_ . +`decav_ratio`: Decay rate. +`vote_score`: The score of the contract-for example: _12343_ . +`description`: The description of the contract-for example: _"litetokensdada"_ . +`url`: The url address link of the contract. + + message AssetIssueContract {
 + bytes owner_address = 1;
 + bytes name = 2;
 + int64 total_supply = 4;
 + int32 xlt_num = 6;
 + int32 num = 8;
 + int64 start_time = 9;
 + int64 end_time = 10;
 + int32 decay_ratio = 15;
 + int32 vote_score = 16;
 + bytes description = 20;
 + bytes url = 21;
 + } + + +`ParticipateAssetIssueContract`Contains 4 kinds of parameters:: the +`owner_address`address of the contract holder-for example: _"0xu82h...7237"_ . +`to_address`: Recipient's address-for example: _"0xu82h...7237"_ . +`asset_name`: The name of the target asset. +`amount`: Small part quantity. + +`DeployContract`Contains 2 kinds of parameters +`script`:: Script. +`owner_address`: The address of the contract holder-for example: _"0xu82h...7237"_ . + + message DeployContract {
 + bytes owner_address = 1;
 + bytes script = 2;
 + } + + +Message body `Result`contains `fee`and `ret`2 parameters. +`ret`: Trading results. +`fee`: The cost deducted from the transaction. + +`code`Is `ret`the type of definition, `SUCCESS`and `FAILED`two types. + + message Result { + enum code { + SUCESS = 0; + FAILED = 1; + } + int64 fee = 1; + code ret = 2; + } + + +* Each transaction also contains multiple inputs and multiple outputs, as well as other related attributes. The input in the transaction, the transaction itself, and the block header all need to be signed. + +Message body `Transaction`comprises `raw_data`and `signature`. +`raw_data`: Message body `raw`. +`signature`: The signatures of all input nodes. + +`raw_data`Contains 8 kinds of parameters:: +`type`The transaction type of the message body raw. +`vin`: input value. +`vout`: output value. +`expiration`: Expiration time-for example: _20170312_ . +`data`: Data. +`contract`: The contract within the transaction. +`script`: Script. `timestamp`: The timestamp of the message body. + +Message body `Contract`comprising `type`and `parameter`. +`type`: The type of contract. +`parameter`: Any parameter. + +There are eight types of account `AccountCreateContract`contracts: `TransferContract`, `TransferAssetContract`, `VoteAssetContract`, `VoteWitnessContract`, `WitnessCreateContract`, , `AssetIssueContract`and `DeployContract`. + +`TransactionType`Including `UtxoType`and `ContractType`. + + message Transaction {
 + enum TranscationType {
 + UtxoType = 0;
 + ContractType = 1;
 + }
 + message Contract {
 + enum ContractType {
 + AccountCreateContract = 0;
 + TransferContract = 1;
 + TransferAssetContract = 2;
 + VoteAssetContract = 3;
 + VoteWitnessContract = 4;
 + WitnessCreateContract = 5;
 + AssetIssueContract = 6;
 + DeployContract = 7;
 + }
 + ContractType type = 1;
 + google.protobuf.Any parameter = 2;
 + }
 + message raw {
 + TranscationType type = 2;
 + repeated TXInput vin = 5;
 + repeated TXOutput vout = 7;
 + int64 expiration = 8;
 + bytes data = 10;
 + repeated Contract contract = 11;
 + bytes scripts = 16;
 + in64 timestamp = 17; + }
 + raw raw_data = 1;
 + repeated bytes signature = 5;
 + } + + +Message body `TXOutputs`from the `outputs`configuration. +`outputs`: `TXOutput`An array of elements . + + message TXOutputs {
 + repeated TXOutput outputs = 1; + 
} + + +Message body `TXOutput`comprises `value`and `pubKeyHash`. +`value`:output value. +`pubKeyhash`: The hash of the public key. + + message TXOutput {
 + int64 value = 1;
 + bytes pubKeyHash = 2; + 
} + + +Message body `TXIutput`comprises `raw_data`and `signature`. +`raw_data`: Message body `raw`. +`signature`: `TXInput`The signature. + +Message body `raw`comprising `txID`, `vout`and `pubKey`. +`txID`: Transaction ID. +`Vout`: The last output value. +`pubkey`: Public key. + + message TXInput {
 + message raw {
 + bytes txID = 1;
 + int64 vout = 2;
 + bytes pubKey = 3;
 + }
 + raw raw_data = 1;
 + bytes signature = 4;
} + + +* Inventory, the protocol involved in the transmission, is mainly used to inform the receiver of the list of transmitted data during transmission. + +`Inventory`Including `type`and `ids`. +`type`: Listing type - for example: _0_ representatives `XLT`. +`ids`: The item ID in the list. + +`InventoryType`Contains `XLT`and `BLOCK`. +`XLT`:transaction. +`BLOCK`: Block. + + // Inventory
 + message Inventory {
 + enum InventoryType {
 + XLT = 0;
 + BLOCK = 1;
 + }
 + InventoryType type = 1;
 + repeated bytes ids = 2; + 
} + + +Message body `Items`contains four types of parameters: +`type`: Item Type - for example: _1_ representatives `XLT`. +`blocks`: The block in the item. +`blockheaders`: Block header. +`transactions`:transaction. + +`Items`There are four types, namely, `ERR`, `XLT`, `BLOCK`and `BLOCKHEADER`. +`ERR`:error. +`XLT`:transaction. +`BLOCK`: Block. +`BLOCKHEADER`: Block header. + + message Items {
 + enum ItemType {
 + ERR = 0;
 + XLT = 1;
 + BLOCK = 2;
 + BLOCKHEADER = 3;
 + }
 + ItemType type = 1;
 + repeated Block blocks = 2;
 + repeated BlockHeader block_headers = 3;
 + repeated Transaction transactions = 4;
 + } + + +`Inventory`Contains `type`and `items`. +`type`: List type. +`items`: List of lists. + + message InventoryItems {
 + int32 type = 1;
 + repeated bytes items = 2;
 + } + + +Message body `BlockInventory`contains `type`. +`type`: List type. + +There are three types: `SYNC`, `ADVTISE`, `FETCH`. + + // Inventory + message BlockInventory { + enum Type { + SYNC = 0; + ADVTISE = 1; + FETCH = 2; + } + + +Message body `BlockId`comprises `ids`and `type`. +`ids`: Block identity information. +`type`: Block type. + +`ids`Contains 2 kinds of parameters:: +`hash`The hash value of the block. +`number`: The hash value and block height are the current block number. + + message BlockId { + bytes hash = 1; + int64 number = 2; + } + repeated BlockId ids = 1; + Type type = 2; + } + + +`ReasonCode` There are 15 possible reasons for disconnection: +`REQUESTED` +`TCP_ERROR` +`BAD_PROTOCOL` +`USELESS_PEER` +`TOO_MANY_PEERS` +`DUPLICATE_PEER` +`INCOMPATIBLE_PROTOCOL` +`NULL_IDENTITY` +`PEER_QUITING` +`UNEXPECTED_IDENTITY` +`LOCAL_IDENTITY` +`PING_TIMEOU` +`USER_REASON` +`RESET` +`UNKNOWN` + + enum ReasonCode { + REQUESTED = 0; + TCP_ERROR = 1; + BAD_PROTOCOL = 2; + USELESS_PEER = 3; + TOO_MANY_PEERS = 4; + DUPLICATE_PEER = 5; + INCOMPATIBLE_PROTOCOL = 6; + NULL_IDENTITY = 7; + PEER_QUITING = 8; + UNEXPECTED_IDENTITY = 9; + LOCAL_IDENTITY = 10; + PING_TIMEOUT = 11; + USER_REASON = 12; + RESET = 16; + UNKNOWN = 255; + } + + +The message body `DisconnectMessage`contains `reason`. +`DisconnectMessage`: Disconnect yes message. +`reason`: The reason when disconnected. + +The message body `HelloMessage`contains 2 parameters: +`from`Please: request the node to establish the connection. +`version`: The node to establish the connection. + +* Wallet service RPC and blockchain browser. + +`Wallet`The wallet service contains multiple RPCs. +**`Getbalance`**: Take parameters `Account`and return the object `Account`. +**`CreatTransaction`**: Take parameters `TransferContract`and return the object `Transaction`. +**`BroadcastTransaction`**: Take parameters `Transaction`and return the object `Return`. +**`CreateAccount`**: Take parameters `AccountCreateContract`and return the object `Transaction`. +**`CreatAssetIssue`**: Take parameters `AssetIssueContract`and return the object `Transaction`. +**`ListAccounts`**: Take parameters `EmptyMessage`and return the object `AccountList`. +**`UpdateAccount`**: Take parameters `AccountUpdateContract`and return the object `Transaction`. +**`VoteWitnessAccount`**: Take parameters `VoteWitnessContract`and return the object `Transaction`. +**`WitnessList`**: Take parameters `EmptyMessage`and return the object `WitnessList`. +**`UpdateWitness`**: Take parameters `WitnessUpdateContract`and return the object `Transaction`. +**`CreateWitness`**: Take parameters `WitnessCreateContract`and return the object `Transaction`. +**`TransferAsset`**: Take parameters `TransferAssetContract`and return the object `Transaction`. +**`ParticipateAssetIssue`**: Take parameters `ParticipateAssetIssueContract`and return the object `Transaction`. +**`ListNodes`**: Take parameters `EmptyMessage`and return the object `NodeList`. +**`GetAssetIssueList`**: Take parameters `EmptyMessage`and return the object `GetIssueList`. +**`GetAssetIssueByAccount`**: Take parameters `Account`and return the object `AssetIssueList`. +**`GetAssetIssueByName`**: Adopt parameters`BytesMessage`, Return the object `AssetIssueContract`. +**`GetNowBlock`**: Take parameters `EmptyMessage`and return the object `Block`. +**`GetBlockByNum`**: Take parameters `NumberMessage`and return the object `Block`. +**`TotalTransaction`**: Take parameters `EmptyMessage`and return the object `NumberMessage`. + + service Wallet { + + rpc GetAccount (Account) returns (Account) { + option (google.api.http) = { + post: "/wallet/getaccount" + body: "*" + }; + + }; + + rpc CreateTransaction (TransferContract) returns (Transaction) { + option (google.api.http) = { + post: "/wallet/createtransaction" + body: "*" + }; + }; + + rpc BroadcastTransaction (Transaction) returns (Return) { + option (google.api.http) = { + post: "/wallet/broadcasttransaction" + body: "*" + }; + }; + + rpc ListAccounts (EmptyMessage) returns (AccountList) { + option (google.api.http) = { + post: "/wallet/listaccount" + body: "*" + }; + + }; + + rpc UpdateAccount (AccountUpdateContract) returns (Transaction) { + option (google.api.http) = { + post: "/wallet/updateaccount" + body: "*" + }; + }; + + rpc CreateAccount (AccountCreateContract) returns (Transaction) { + option (google.api.http) = { + post: "/wallet/createaccount" + body: "*" + }; + }; + + rpc VoteWitnessAccount (VoteWitnessContract) returns (Transaction) { + option (google.api.http) = { + post: "/wallet/votewitnessaccount" + body: "*" + }; + }; + + rpc CreateAssetIssue (AssetIssueContract) returns (Transaction) { + option (google.api.http) = { + post: "/wallet/createassetissue" + body: "*" + }; + }; + + rpc ListWitnesses (EmptyMessage) returns (WitnessList) { + option (google.api.http) = { + post: "/wallet/listwitnesses" + body: "*" + }; + }; + + rpc UpdateWitness (WitnessUpdateContract) returns (Transaction) { + option (google.api.http) = { + post: "/wallet/updatewitness" + body: "*" + }; + }; + + rpc CreateWitness (WitnessCreateContract) returns (Transaction) { + option (google.api.http) = { + post: "/wallet/createwitness" + body: "*" + }; + }; + + rpc TransferAsset (TransferAssetContract) returns (Transaction) { + option (google.api.http) = { + post: "/wallet/transferasset" + body: "*" + }; + } + + rpc ParticipateAssetIssue (ParticipateAssetIssueContract) returns (Transaction) { + option (google.api.http) = { + post: "/wallet/participateassetissue" + body: "*" + }; + } + + rpc ListNodes (EmptyMessage) returns (NodeList) { + option (google.api.http) = { + post: "/wallet/listnodes" + body: "*" + }; + } + rpc GetAssetIssueList (EmptyMessage) returns (AssetIssueList) { + option (google.api.http) = { + post: "/wallet/getassetissuelist" + body: "*" + }; + } + rpc GetAssetIssueByAccount (Account) returns (AssetIssueList) { + option (google.api.http) = { + post: "/wallet/getassetissuebyaccount" + body: "*" + }; + } + rpc GetAssetIssueByName (BytesMessage) returns (AssetIssueContract) { + option (google.api.http) = { + post: "/wallet/getassetissuebyname" + body: "*" + }; + } + rpc GetNowBlock (EmptyMessage) returns (Block) { + option (google.api.http) = { + post: "/wallet/getnowblock" + body: "*" + }; + } + rpc GetBlockByNum (NumberMessage) returns (Block) { + option (google.api.http) = { + post: "/wallet/getblockbynum" + body: "*" + }; + } + rpc TotalTransaction (EmptyMessage) returns (NumberMessage) { + option (google.api.http) = { + post: "/wallet/totaltransaction" + body: "*" + }; + } + }; + + +`WalletSolidity`The wallet service contains multiple RPCs. +**`GetAccount`**: Take parameters `Account`and return the object `Account`. +**`ListAccounts`**: Take parameters `EmptyMessage`and return the object `AccountList`. +**`ListWitness`**: Take parameters `EmptyMessage`and return the object `WitnessList`. +**`ListNodes`**: Take parameters `EmptyMessage`and return the object `NodeList`. +**`GetAssetIssueList`**: Take parameters `EmptyMessage`and return the object `AssetIssueList`. +**`GetAssetIssueByTimeStamp`**: Take parameters `NumberMessage`and return the object `AssetIssueList`. +**`GetAssetIssueByAccount`**: Using parameters `Account`, return the object to `AssetIssueList`obtain issued assets. +**`GetAssetIssueByName`**: Take parameters `BytesMessage`and return the object `AssetIssueContract`. +**`GetNowBlock`**: Take parameters `EmptyMessage`and return the object `AssetIssueList`. +**`GetBlockByNum`**: Take parameters `EmptyMessage`and return the object `Block`. +**`TotalTransaction`**: Take parameters `EmptyMessage`and return the object `NumberMessage`. +**`getTransactionById`**: Take parameters `EmptyMessage`and return the object `Transaction`. +**`getTransactionInfoById`**: Take parameters `BytesMessage`and return the object `Transaction`. +**`getTransactionsByTimestamp`**: Take parameters `TimeMessage`and return the object `Transactionlist`. +**`getTransactionsFromThis`**: Take parameters `Account`and return the object `Transactionlist`. +**`getTransactionsToThis`**: Take parameters `Account`and return the object `NumberMessage`. + + service WalletSolidity { + + rpc GetAccount (Account) returns (Account) { + + }; + + rpc ListAccounts (EmptyMessage) returns (AccountList) { + + }; + + rpc ListWitnesses (EmptyMessage) returns (WitnessList) { + + }; + + rpc ListNodes (EmptyMessage) returns (NodeList) { + + } + rpc GetAssetIssueList (EmptyMessage) returns (AssetIssueList) { + + } + rpc GetAssetIssueListByTimestamp (NumberMessage) returns (AssetIssueList) { + + } + rpc GetAssetIssueByAccount (Account) returns (AssetIssueList) { + + } + rpc GetAssetIssueByName (BytesMessage) returns (AssetIssueContract) { + + } + rpc GetNowBlock (EmptyMessage) returns (Block) { + + } + rpc GetBlockByNum (NumberMessage) returns (Block) { + + } + + //获取交易。 + + rpc TotalTransaction (EmptyMessage) returns (NumberMessage) { + + } + rpc getTransactionById (BytesMessage) returns (Transaction) { + + } + rpc getTransactionsByTimestamp (TimeMessage) returns (TransactionList) { + + } + rpc getTransactionsFromThis (Account) returns (TransactionList) { + + } + rpc getTransactionsToThis (Account) returns (NumberMessage) { + + } + }; + + +`Address`: Node address. +The message body `Address`contains 2 parameters +`host`:: the node owner. +`port`: The port number of the node. + + message Address { + bytes host = 1; + int32 port = 2; + } + + +The message body `Return`only contains one parameter +`result`:: Boolean table type flag bit. + + message `Return` {
 + bool result = 1;
 + } + + +* Network UDP message structure. + +`Endpoint`: Node information storage structure in the network. The +message body `Endpoint`contains 3 parameters +`address`:: Node address. +`port`:The port number. +`nodeId`: Node ID information. + + message Endpoint { + bytes address = 1; + int32 port = 2; + bytes nodeId = 3; + } + + +`PingMessage`: The message sent when the node establishes a connection. +The message body `PingMessage`contains 4 parameters:: +`from`the node the message comes from. +`to`: The node where the message is sent. +`version`: Network version. +`timestamp`: The timestamp when the message was created. + + message PingMessage { + Endpoint from = 1; + Endpoint to = 2; + int32 version = 3; + int64 timestamp = 4; + } + + +`PongMessage`: Reply message when the connection is established successfully. +The message body `PongMessage`contains 3 parameters:: +`from`The node the message comes from. +`echo`:: +`timestamp`The timestamp when the message was created. + + message PongMessage { + Endpoint from = 1; + int32 echo = 2; + int64 timestamp = 3; + } + + +`FindNeighbours`: The message sent when a node queries neighboring nodes. +The message body `FindNeighbours`contains 3 parameters:: +`from`The node the message comes from. +`targetId`: The information of the target node. +`timestamp`: The timestamp when the message was created. + + message FindNeighbours { + Endpoint from = 1; + bytes targetId = 2; + int64 timestamp = 3; + } + + +`Neighbour`: Adjacent contact reply message. +The message body `Neighbours`contains 3 parameters:: +`from`The node the message comes from. +`neighbours`: Adjacent nodes. +`timestamp`: The timestamp when the message was created. + + message Neighbours { + Endpoint from = 1; + repeated Endpoint neighbours = 2; + int64 timestamp = 3; } + - `VoteWitnessContract` contains 4 kinds of parameters: - `vote_ad +[](#详细的协议见附属文件详细协议随着程序的迭代随时都可能发生变化请以最新的版本为准)See the attached file for the detailed agreement. The detailed agreement may change at any time with the iteration of the program, please refer to the latest version. +==================================================================================================================================================================================================================