OSDN Git Service

add dpos consensus
[bytom/vapor.git] / protocol / bc / bc.proto
1 syntax = "proto3";
2
3 package bc;
4
5 message Hash {
6   fixed64 v0 = 1;
7   fixed64 v1 = 2;
8   fixed64 v2 = 3;
9   fixed64 v3 = 4;
10 }
11
12 message Program {
13   uint64 vm_version = 1;
14   bytes  code       = 2;
15 }
16
17 // This message type duplicates Hash, above. One alternative is to
18 // embed a Hash inside an AssetID. But it's useful for AssetID to be
19 // plain old data (without pointers). Another alternative is use Hash
20 // in any protobuf types where an AssetID is called for, but it's
21 // preferable to have type safety.
22 message AssetID {
23   fixed64 v0 = 1;
24   fixed64 v1 = 2;
25   fixed64 v2 = 3;
26   fixed64 v3 = 4;
27 }
28
29 message AssetAmount {
30   AssetID asset_id = 1;
31   uint64  amount   = 2;
32 }
33
34 message AssetDefinition {
35   Program issuance_program = 1;
36   Hash    data             = 2;
37 }
38
39 message ValueSource {
40   Hash        ref      = 1;
41   AssetAmount value    = 2;
42   uint64      position = 3;
43 }
44
45 message ValueDestination {
46   Hash        ref      = 1;
47   AssetAmount value    = 2;
48   uint64      position = 3;
49 }
50
51 message Proof {
52         bytes sign           = 1;
53         bytes controlProgram = 2;
54   bytes address        = 3;
55 }
56
57 message BytomBlockHeader {
58   uint64            version                 = 1;
59   uint64            height                  = 2;
60   Hash              previous_block_id       = 3;
61   uint64            timestamp               = 4;
62   Hash              transactions_root       = 5;
63   Hash              transaction_status_hash = 6;
64   uint64            nonce                   = 7;
65   uint64            bits                    = 8;
66   TransactionStatus transaction_status      = 9;
67 }
68
69 message BlockHeader {
70   uint64            version                 = 1;
71   uint64            height                  = 2;
72   Hash              previous_block_id       = 3;
73   uint64            timestamp               = 4;
74   Hash              transactions_root       = 5;
75   Hash              transaction_status_hash = 6;
76   uint64            nonce                   = 7;
77   uint64            bits                    = 8;
78   TransactionStatus transaction_status      = 9;
79   Proof             Proof                   = 10;
80   bytes             extra                   = 11;
81   bytes             coinbase                = 12;
82 }
83
84 message TxHeader {
85   uint64        version         = 1;
86   uint64        serialized_size = 2;
87   uint64        time_range      = 3;
88   repeated Hash result_ids      = 4;
89 }
90
91 message TxVerifyResult {
92   bool status_fail = 1;
93 }
94
95 message TransactionStatus {
96   uint64                  version        = 1;
97   repeated TxVerifyResult verify_status  = 2;
98 }
99
100 message Mux {
101   repeated ValueSource      sources              = 1; // issuances, spends, and muxes
102   Program                   program              = 2;
103   repeated ValueDestination witness_destinations = 3; // outputs, retirements, and muxes
104   repeated bytes            witness_arguments    = 4;
105 }
106
107 message Coinbase {
108   ValueDestination witness_destination = 1;
109   bytes            arbitrary           = 2;
110 }
111
112 message Output {
113   ValueSource source          = 1;
114   Program     control_program = 2;
115   uint64      ordinal         = 3;
116 }
117
118 message Retirement {
119   ValueSource source   = 1;
120   uint64      ordinal  = 2;
121 }
122
123 message Issuance {
124   Hash             nonce_hash               = 1;
125   AssetAmount      value                    = 2;
126   ValueDestination witness_destination      = 3;
127   AssetDefinition  witness_asset_definition = 4;
128   repeated bytes   witness_arguments        = 5;
129   uint64           ordinal                  = 6;
130 }
131
132 message Spend {
133   Hash             spent_output_id     = 1;
134   ValueDestination witness_destination = 2;
135   repeated bytes   witness_arguments   = 3;
136   uint64           ordinal             = 4;
137 }
138
139 message Claim {
140   Hash             spent_output_id     = 1;
141   ValueDestination witness_destination = 2;
142   repeated bytes   witness_arguments   = 3;
143   uint64           ordinal             = 4;
144   repeated bytes   Peginwitness        = 5;
145 }
146
147 message Dpos {
148   Hash             spent_output_id     = 1;
149   ValueDestination witness_destination = 2;
150   repeated bytes   witness_arguments   = 3;
151   uint64           ordinal             = 4;
152   uint32           type                = 5;
153   string           from                = 6;
154   string           to                  = 7;
155   uint64           stake               = 8;
156   string           data                = 9;
157 }