-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbitcoin_trans_without_sign.ksy
152 lines (152 loc) · 3.61 KB
/
bitcoin_trans_without_sign.ksy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
meta:
id: bitcoin_transaction
title: Bitcoin Transaction
license: CC-BY-SA-4.0
endian: le
doc-ref: |
https://bitcoin.org/en/developer-guide#transactions
https://en.bitcoin.it/wiki/Transaction
seq:
- id: version
type: u4
doc: |
Version number.
- id: num_vins
type: u1
doc: |
Number of input transactions.
- id: vins
type: vin
repeat: expr
repeat-expr: num_vins
doc: |
Input transactions.
An input refers to an output from a previous transaction.
- id: num_vouts
type: u1
doc: |
Number of output transactions.
- id: vouts
type: vout
repeat: expr
repeat-expr: num_vouts
doc: |
Output transactions.
- id: locktime
type: u4
types:
vin:
seq:
- id: txid
size: 32
doc: |
Previous transaction hash.
- id: output_id
type: u4
doc: |
ID indexing an ouput of the transaction refered by txid.
This output will be used as an input in the present transaction.
- id: script_len
type: u1
doc: |
ScriptSig's length.
- id: script_sig
size: script_len
doc: |
ScriptSig.
doc-ref: |
https://en.bitcoin.it/wiki/Transa3ction#Input
https://en.bitcoin.it/wiki/Script
- id: end_of_vin
type: u4
enum: end_of_vin_seq
doc: |
Magic number indicating the end of the current input.
vout:
seq:
- id: amount
type: u8
doc: |
Number of Satoshis to be transfered.
- id: script_len
type: u1
doc: |
ScriptPubKey's length.
- id: script_pub_key
size: script_len
doc: |
ScriptPubKey.
doc-ref: |
https://en.bitcoin.it/wiki/Transaction#Output
https://en.bitcoin.it/wiki/Script
script_signature:
seq:
- id: sig_stack_len
type: u1
- id: der_sig
type: der_signature
doc: |
DER-encoded ECDSA signature.
doc-ref: |
https://en.wikipedia.org/wiki/X.690#DER_encoding
https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm
- id: sig_type
type: u1
enum: sighash_type
doc: |
Type of signature.
- id: pubkey_stack_len
type: u1
- id: pubkey
type: public_key
doc: |
Public key (bitcoin address of the recipient).
der_signature:
seq:
- id: sequence
contents: [0x30]
- id: sig_len
type: u1
- id: sep_1
contents: [0x02]
- id: sig_r_len
type: u1
doc: |
'r' value's length.
- id: sig_r
size: sig_r_len
doc: |
'r' value of the ECDSA signature.
doc-ref: 'https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm'
- id: sep_2
contents: [0x02]
- id: sig_s_len
type: u1
doc: |
's' value's length.
- id: sig_s
size: sig_s_len
doc: |
's' value of the ECDSA signature.
doc-ref: 'https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm'
public_key:
seq:
- id: type
type: u1
- id: x
size: 32
doc: |
'x' coordinate of the public key on the elliptic curve.
- id: y
size: 32
doc: |
'y' coordinate of the public key on the elliptic curve.
enums:
sighash_type:
1: sighash_all
2: sighash_none
3: sighash_single
80: sighash_anyonecanpay
end_of_vin_seq:
0xfeffffff: fe
0xffffffff: ff