OSDN Git Service

f82e9c8148831d52aa70d3c59a1dd66cf2d86e94
[bytom/bytom.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   Hash    initial_block_id = 1;
36   Program issuance_program = 2;
37   Hash    data             = 3;
38 }
39
40 message ValueSource {
41   Hash        ref      = 1;
42   AssetAmount value    = 2;
43   uint64      position = 3;
44 }
45
46 message ValueDestination {
47   Hash        ref      = 1;
48   AssetAmount value    = 2;
49   uint64      position = 3;
50 }
51
52 message BlockHeader {
53   uint64 version                   = 1;
54   uint64 height                    = 2;
55   Hash   previous_block_id         = 3;
56   uint64 timestamp_ms              = 4;
57   Hash   transactions_root         = 5;
58   Hash   assets_root               = 6;
59   uint64 nonce                     = 7;
60   uint64 bits                      = 8;
61 }
62
63 message TxHeader {
64   uint64        version     = 1;
65   repeated Hash result_ids  = 2;
66   Hash          data        = 3;
67   uint64        min_time_ms = 4;
68   uint64        max_time_ms = 5;
69   Hash          ext_hash    = 6;
70 }
71
72 message Mux {
73   repeated ValueSource      sources              = 1; // issuances, spends, and muxes
74   Program                   program              = 2;
75   Hash                      ext_hash             = 3;
76   repeated ValueDestination witness_destinations = 4; // outputs, retirements, and muxes
77   repeated bytes            witness_arguments    = 5;
78 }
79
80 message Nonce {
81   Program        program             = 1;
82   Hash           time_range_id       = 2;
83   Hash           ext_hash            = 3;
84   repeated bytes witness_arguments   = 4;
85   Hash           witness_anchored_id = 5;
86 }
87
88 message Coinbase {
89   Program        program             = 1;
90   Hash           block_id            = 2;
91   Hash           ext_hash            = 3;
92   repeated bytes witness_arguments   = 4;
93   Hash           witness_anchored_id = 5;
94 }
95
96 message Output {
97   ValueSource source          = 1;
98   Program     control_program = 2;
99   Hash        data            = 3;
100   Hash        ext_hash        = 4;
101   uint64      ordinal         = 5;
102 }
103
104 message Retirement {
105   ValueSource source   = 1;
106   Hash        data     = 2;
107   Hash        ext_hash = 3;
108   uint64      ordinal  = 4;
109 }
110
111 message TimeRange {
112   uint64    min_time_ms = 1;
113   uint64    max_time_ms = 2;
114   Hash      ext_hash    = 3;
115 }
116
117 message Issuance {
118   Hash             anchor_id                = 1;
119   AssetAmount      value                    = 2;
120   Hash             data                     = 3;
121   Hash             ext_hash                 = 4;
122   ValueDestination witness_destination      = 5;
123   AssetDefinition  witness_asset_definition = 6;
124   repeated bytes   witness_arguments        = 7;
125   Hash             witness_anchored_id      = 8;
126   uint64           ordinal                  = 9;
127 }
128
129 message Spend {
130   Hash             spent_output_id     = 1;
131   Hash             data                = 2;
132   Hash             ext_hash            = 3;
133   ValueDestination witness_destination = 4;
134   repeated bytes   witness_arguments   = 5;
135   Hash             witness_anchored_id = 6;
136   uint64           ordinal             = 7;
137 }