Skip to content

Commit 883cd77

Browse files
Merge pull request duneanalytics#240 from duneanalytics/bitcoin-new
T-22842 Add Bitcoin documentation
2 parents aa77293 + acb5809 commit 883cd77

File tree

5 files changed

+166
-0
lines changed

5 files changed

+166
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Blocks
2+
3+
## `bitcoin.blocks`
4+
5+
|Column name |Column type |Description |
6+
|-------------------|---------|-----------------------------------------------------------------------------------------------------------------------------------------|
7+
|time |timestamp|The block time |
8+
|height |bigint |The block number |
9+
|date |date |The block date |
10+
|hash |string |The block hash |
11+
|transaction_count |int |The number of transactions in the block |
12+
|size |bigint |The size of the block |
13+
|mint_reward |double |The output paid out to the miner for minting the block |
14+
|total_fees |double |The fees paid out to the miner from transaction users. Each transaction's fee is what's left of output after input is subtracted from it.|
15+
|total_reward |double |The static reward given to the miner. It is the sum of the outputs in the coinbase transaction (the first transaction). |
16+
|stripped_size |bigint |The size of the block excluding witness data |
17+
|weight |bigint |The block weight as defined in BIP 141 |
18+
|chainwork |string |The expected number of hashes required to produce the current chain |
19+
|difficulty |string |The estimated amount of work done to find this block relative to the estimated amount of work done to find block 0 |
20+
|merkle_root |string |The root node of a Merkle tree, where leaves are transaction hashes |
21+
|nonce |string |The number of transactions made by the sender prior to this one |
22+
|coinbase |string |The data specified in the coinbase transaction of the block |
23+
|previous_block_hash|string |The hash of the previous block |
24+
|bits |string |The difficulty threshold specified in block header |
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: Bitcoin
3+
description: As a non-EVM chain, Bitcoin raw data looks quite different from other chains. Learn more about Bitcoin's data in these pages.
4+
---
5+
6+
Bitcoin probably needs no introduction.
7+
8+
## Data Available
9+
10+
<div class="cards grid" markdown>
11+
- [Blocks](blocks.md)
12+
- [Transactions](transactions.md)
13+
- [Outputs](outputs.md)
14+
- [Inputs](inputs.md)
15+
</div>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Inputs
2+
3+
## `bitcoin.inputs`
4+
5+
|Column name |Type |Description |
6+
|-------------------|------|-----------------------------------------------------------------------------------------------------------------------------------------|
7+
|block_time |timestamp|The block time |
8+
|block_date |date |The block date |
9+
|block_height |bigint|The block number |
10+
|index |int |The index of the input |
11+
|block_hash |bigint|The block hash of the output |
12+
|tx_id |string|The transaction id that this input was used |
13+
|spent_block_height |bigint|The block height of the output |
14+
|spent_tx_id |string|The transaction id of the output |
15+
|spent_output_number|bigint|The output number |
16+
|value |double|The number of Satoshis attached to this input |
17+
|address |string|The address that owned/owns the output used as input |
18+
|type |string|The address type of the input |
19+
|coinbase |string|This input was the coinbase input in the transaction |
20+
|is_coinbase |boolean|True if coinbase is not null, else false |
21+
|script_asm |string|Symbolic representation of the bitcoin's script language op-codes |
22+
|script_hex |string|Hexadecimal representation of the bitcoin's script language op-codes |
23+
|script_desc |string|The description |
24+
|script_signature_asm|string|Symbolic representation of the bitcoin's script language op-codes |
25+
|script_signature_hex|string|Hexadecimal representation of the bitcoin's script language op-codes |
26+
|sequence |bigint|A number intended to allow unconfirmed time-locked transactions to be updated before being finalized; not currently used except to disable locktime in a transaction|
27+
|witness_data |array&lt;string&gt;|Witness data |
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Outputs
2+
3+
## `bitcoin.outputs`
4+
5+
|Column name |Type |Description |
6+
|-------------------|------|-----------------------------------------------------------------------------------------------------------------------------------------|
7+
|block_time |timestamp|The block time |
8+
|block_date |date |The block date |
9+
|block_height |bigint|The block number |
10+
|block_hash |string|The block hash |
11+
|tx_id |string|The id (hash) of the transaction this is from |
12+
|index |int |0-indexed number of an output within a transaction. Used by inputs to identify outputs. |
13+
|value |double|The number of Satoshis attached to this output |
14+
|script_asm |string|Symbolic representation of the bitcoin's script language op-codes |
15+
|script_hex |string|Hexadecimal representation of the bitcoin's script language op-codes |
16+
|address |string|The address that owns this output |
17+
|type |string|The address type of the output |
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Transactions
2+
3+
## `bitcoin.transactions`
4+
5+
|Column name |Type |Description |
6+
|-------------------|------|-----------------------------------------------------------------------------------------------------------------------------------------|
7+
|block_time |timestamp|The block time |
8+
|block_date |date |The block date |
9+
|block_height |bigint|The block number |
10+
|block_hash |string|The hash of the block that contains this transaction |
11+
|index |int |The number of the transaction in the block. |
12+
|id |string|The id (hash) of this transaction |
13+
|input_value |double|Total value of inputs in the transaction |
14+
|output_value |double|Total value of outputs in the transaction |
15+
|fee |double|The transaction fee paid to the miner. = output_value - input_value |
16+
|input_count |int |The number of inputs in the transaction |
17+
|output_count |int |The number of outputs in the transaction |
18+
|size |bigint|The size of this transaction in bytes |
19+
|virtual_size |bigint|The virtual transaction size (differs from size for witness transactions) |
20+
|is_coinbase |boolean|The transaction is a coinbase transaction, which is the first transaction in a block |
21+
|coinbase |string|If the transaction is a coinbase transaction, contains the coinbase data. Otherwise, null. |
22+
|input |struct|Transaction inputs |
23+
|output |struct|Transaction outputs. See outputs table. |
24+
|lock_time |bigint|Earliest time that miners can include the transaction in their hashing of the Merkle root to attach it in the latest block of the blockchain|
25+
|hex |string|The transaction encoded as hexadecimal |
26+
27+
### Struct definitions
28+
29+
Within several of these columns is a data type of STRUCT which allows for representing nested hierarchical data and has key-value pairs. It's similar to a dictionary in python and can be used to group fields together to make them more accessible.
30+
31+
**input**
32+
33+
| Field | Data type | Description |
34+
|-------------------|------|-----------------------------------------------------------------------------------------------------------------------------------------|
35+
|value |double|The number of Satoshis attached to this output |
36+
|height |bigint|The height of the output |
37+
|tx_id |string|The transaction id of the output that is here used as input |
38+
|output_number|bigint|The number (index) of the output in transaction `tx_id`'s outputs |
39+
|coinbase |string|The data specified in this transaction, if it was a coinbase transaction |
40+
|sequence |bigint|Sequence number |
41+
|witness_data |array<string>|Array of hex encoded witness data |
42+
|script_signature|struct|The script signature |
43+
|script_pub_key|struct|The script public key |
44+
45+
***
46+
47+
**input.script_signature**
48+
| Field | Data type | Description |
49+
|---------|-----------|--------------|
50+
|hex|string|The transaction's script operations, in hex |
51+
|asm|string|The transaction's script operations, in symbolic representation |
52+
53+
***
54+
55+
**input.script_pub_key**
56+
57+
| Field | Data type | Description |
58+
|---------|-----------|--------------|
59+
|asm|string|The transaction's script operations, in symbolic representation |
60+
|desc|string|The transaction's script operations, in symbolic representation |
61+
|address|string|The transaction's script operations, in symbolic representation |
62+
|hex|string|The transaction's script operations, in hex |
63+
|type|string|The address type of the output |
64+
65+
***
66+
67+
**output**
68+
69+
| Field | Data type | Description |
70+
|-------------------|------|-----------------------------------------------------------------------------------------------------------------------------------------|
71+
|index |bigint|0-indexed number of an output within a transaction used by a later transaction to refer to that specific output |
72+
|value |double|The number of Satoshis attached to this output |
73+
|script_pub_key|struct|The public key |
74+
75+
***
76+
77+
**output.script_pub_key**
78+
| Field | Data type | Description |
79+
| ------- | --------- | -------------|
80+
|asm|string|The transaction's script operations, in symbolic representation |
81+
|hex|string|The transaction's script operations, in hex |
82+
|address|string|The address the BTC came from |
83+
|type|string|The address type of the output |

0 commit comments

Comments
 (0)