Skip to content

Commit e9ade96

Browse files
authored
Merge pull request #6 from FuelLabs/adlerjohn-initial_tx_format
Add initial transaction format
2 parents 0b83b4f + 110c0a8 commit e9ade96

1 file changed

Lines changed: 92 additions & 0 deletions

File tree

tx_format.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Transaction Format
2+
3+
- [Transaction](#transaction)
4+
- [Input](#input)
5+
- [InputCoin](#inputcoin)
6+
- [InputContract](#inputcontract)
7+
- [Output](#output)
8+
- [OutputCoin](#outputcoin)
9+
- [OutputContract](#outputcontract)
10+
- [Witness](#witness)
11+
12+
## Transaction
13+
14+
| name | type | description |
15+
| ---------------- | ----------------------- | -------------------------- |
16+
| `scriptLength` | `uint16` | Script length, in words. |
17+
| `script` | `byte[]` | Script to execute. |
18+
| `gasPrice` | `uint64` | Gas price for transaction. |
19+
| `gasLimit` | `uint64` | Gas limit for transaction. |
20+
| `inputsCount` | `uint8` | Number of inputs. |
21+
| `inputs` | [Input](#input)`[]` | List of inputs. |
22+
| `outputsCount` | `uint8` | Number of outputs. |
23+
| `outputs` | [Output](#output)`[]` | List of outputs. |
24+
| `witnessesCount` | `uint8` | Number of witnesses. |
25+
| `witnesses` | [Witness](#witness)`[]` | List of witnesses. |
26+
27+
## Input
28+
29+
```
30+
enum InputType : uint8 {
31+
Coin = 0,
32+
Contract = 1,
33+
}
34+
```
35+
36+
| name | type | description |
37+
| ------ | ----------------------------------------------------------------- | -------------- |
38+
| `type` | `InputType` | Type of input. |
39+
| `data` | One of [InputCoin](#inputcoin) or [InputContract](#inputcontract) | Input data. |
40+
41+
42+
### InputCoin
43+
44+
| name | type | description |
45+
| -------------- | ---------- | --------------------------------------------------- |
46+
| `utxoID` | `byte[32]` | UTXO ID. |
47+
| `dataLength` | `uint16` | Length of data, in bytes. |
48+
| `data` | `byte[]` | Data to input into script. |
49+
| `witnessIndex` | `uint8` | Index of witness that authorizes spending the coin. |
50+
51+
### InputContract
52+
53+
| name | type | description |
54+
| ------------ | ---------- | ------------ |
55+
| `utxoID` | `byte[32]` | UTXO ID. |
56+
| `contractID` | `byte[32]` | Contract ID. |
57+
58+
## Output
59+
60+
```
61+
enum OutputType : uint8 {
62+
Coin = 0,
63+
Contract = 1,
64+
}
65+
```
66+
67+
| name | type | description |
68+
| ------ | --------------------------------------------------------------------- | --------------- |
69+
| `type` | `OutputType` | Type of output. |
70+
| `data` | One of [OutputCoin](#outputcoin) or [OutputContract](#outputcontract) | Output data. |
71+
72+
### OutputCoin
73+
74+
| name | type | description |
75+
| -------- | ---------- | --------------------------------- |
76+
| `to` | `byte[32]` | Receiving address or script hash. |
77+
| `amount` | `uint64` | Amount of coins to send. |
78+
79+
### OutputContract
80+
81+
| name | type | description |
82+
| -------------------- | ------- | ------------------------------------------------------- |
83+
| `inputIndex` | `uint8` | Index of input contract. |
84+
| `amountWitnessIndex` | `uint8` | Index of witness for amount of coins owned by contract. |
85+
| `stateWitnessIndex` | `uint8` | Index of witness for state root of contract. |
86+
87+
## Witness
88+
89+
| name | type | description |
90+
| ------------ | -------- | --------------------------------- |
91+
| `dataLength` | `uint16` | Length of witness data, in bytes. |
92+
| `data` | `byte[]` | Witness data. |

0 commit comments

Comments
 (0)