OSDN Git Service

e45143a479e76b0451ac40dc0edddaf8ff91a11f
[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   Hash          data            = 3;
88   uint64        time_range      = 4;
89   repeated Hash result_ids      = 5;
90 }
91
92 message TxVerifyResult {
93   bool status_fail = 1;
94 }
95
96 message TransactionStatus {
97   uint64                  version        = 1;
98   repeated TxVerifyResult verify_status  = 2;
99 }
100
101 message Mux {
102   repeated ValueSource      sources              = 1; // issuances, spends, and muxes
103   Program                   program              = 2;
104   repeated ValueDestination witness_destinations = 3; // outputs, retirements, and muxes
105   repeated bytes            witness_arguments    = 4;
106 }
107
108 message Coinbase {
109   ValueDestination witness_destination = 1;
110   bytes            arbitrary           = 2;
111 }
112
113 message Output {
114   ValueSource source          = 1;
115   Program     control_program = 2;
116   uint64      ordinal         = 3;
117 }
118
119 message Retirement {
120   ValueSource source   = 1;
121   uint64      ordinal  = 2;
122 }
123
124 message Issuance {
125   Hash             nonce_hash               = 1;
126   AssetAmount      value                    = 2;
127   ValueDestination witness_destination      = 3;
128   AssetDefinition  witness_asset_definition = 4;
129   repeated bytes   witness_arguments        = 5;
130   uint64           ordinal                  = 6;
131 }
132
133 message Spend {
134   Hash             spent_output_id     = 1;
135   ValueDestination witness_destination = 2;
136   repeated bytes   witness_arguments   = 3;
137   uint64           ordinal             = 4;
138 }
139
140 message Claim {
141   Hash             spent_output_id     = 1;
142   ValueDestination witness_destination = 2;
143   repeated bytes   witness_arguments   = 3;
144   uint64           ordinal             = 4;
145   repeated bytes   Peginwitness        = 5;
146 }
147
148 message Dpos {
149   Hash             spent_output_id     = 1;
150   ValueDestination witness_destination = 2;
151   repeated bytes   witness_arguments   = 3;
152   uint64           ordinal             = 4;
153   uint32           type                = 5;
154   string           from                = 6;
155   string           to                  = 7;
156   uint64           stake               = 8;
157   string           data                = 9;
158 }