OSDN Git Service

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