OSDN Git Service

d333667ed20ecbe35c7fb110d8089941ad0268d4
[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 }
55
56 message BlockHeader {
57   uint64            version                 = 1;
58   uint64            height                  = 2;
59   Hash              previous_block_id       = 3;
60   uint64            timestamp               = 4;
61   Hash              transactions_root       = 5;
62   Hash              transaction_status_hash = 6;
63   uint64            nonce                   = 7;
64   uint64            bits                    = 8;
65   TransactionStatus transaction_status      = 9;
66   Proof             Proof                   = 10;
67 }
68
69 message TxHeader {
70   uint64        version         = 1;
71   uint64        serialized_size = 2;
72   uint64        time_range      = 3;
73   repeated Hash result_ids      = 4;
74 }
75
76 message TxVerifyResult {
77   bool status_fail = 1;
78 }
79
80 message TransactionStatus {
81   uint64                  version        = 1;
82   repeated TxVerifyResult verify_status  = 2;
83 }
84
85 message Mux {
86   repeated ValueSource      sources              = 1; // issuances, spends, and muxes
87   Program                   program              = 2;
88   repeated ValueDestination witness_destinations = 3; // outputs, retirements, and muxes
89   repeated bytes            witness_arguments    = 4;
90 }
91
92 message Coinbase {
93   ValueDestination witness_destination = 1;
94   bytes            arbitrary           = 2;
95 }
96
97 message Output {
98   ValueSource source          = 1;
99   Program     control_program = 2;
100   uint64      ordinal         = 3;
101 }
102
103 message Retirement {
104   ValueSource source   = 1;
105   uint64      ordinal  = 2;
106 }
107
108 message Issuance {
109   Hash             nonce_hash               = 1;
110   AssetAmount      value                    = 2;
111   ValueDestination witness_destination      = 3;
112   AssetDefinition  witness_asset_definition = 4;
113   repeated bytes   witness_arguments        = 5;
114   uint64           ordinal                  = 6;
115 }
116
117 message Spend {
118   Hash             spent_output_id     = 1;
119   ValueDestination witness_destination = 2;
120   repeated bytes   witness_arguments   = 3;
121   uint64           ordinal             = 4;
122 }
123
124 message Claim {
125   Hash             spent_output_id     = 1;
126   ValueDestination witness_destination = 2;
127   repeated bytes   witness_arguments   = 3;
128   uint64           ordinal             = 4;
129   repeated bytes   Peginwitness        = 5;
130 }