-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtx.py
65 lines (45 loc) · 1.09 KB
/
tx.py
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
from enum import Enum
from typing import NamedTuple, List
class Tx(NamedTuple):
inputs: List['Input']
outputs: List['Output']
preambles: List[bytes]
unlock_data: List['UnlockData']
signatures: List['Signature']
class Input(NamedTuple):
outpoints: List['Outpoint']
bytecode_merkle_path: List['MerkleBranch']
bytecode: bytes
class Output(NamedTuple):
amount: int
bytecode_merkle_root: bytes
class UnlockData(NamedTuple):
data: List[bytes]
loop_trees: bytes
ram_size: int
class Signature(NamedTuple):
sig_flags: int
num_covered_checks: int
signature: bytes
class Outpoint(NamedTuple):
tx_hash: bytes
idx: int
amount: int
constraints: List
carryover: bytes
class MerkleBranch(NamedTuple):
side: 'MerkleSide'
branch_hash: bytes
class MerkleSide(Enum):
LEFT = 1
RIGHT = 2
class Constraint(NamedTuple):
constraint_type: 'ConstraintType'
payload: bytes
class ConstraintType(Enum):
PREAMBLE_HASH = 1
PREAMBLES_HASH = 2
BLOCK_HEIGHT = 3
BLOCK_HASH = 4
AGE = 5
TIMESTAMP = 6