OSDN Git Service

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