From 3ae29b2d04da7494b5bc7f113f7fb400d2fac85a Mon Sep 17 00:00:00 2001 From: paulobressan Date: Wed, 2 Apr 2025 18:06:30 -0300 Subject: [PATCH] feat: added bitcoin module --- pages/_meta.json | 1 + pages/bitcoin.mdx | 75 ++++++++++++++++++++++++++++++++++++++++++ pages/introduction.mdx | 3 +- 3 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 pages/bitcoin.mdx diff --git a/pages/_meta.json b/pages/_meta.json index 694b84c..ce38f00 100644 --- a/pages/_meta.json +++ b/pages/_meta.json @@ -25,6 +25,7 @@ "title": "Ledgers" }, "cardano": "Cardano Module", + "bitcoin": "Bitcoin Module", "-- SDK --": { "type": "separator", "title": "SDK" diff --git a/pages/bitcoin.mdx b/pages/bitcoin.mdx new file mode 100644 index 0000000..afae568 --- /dev/null +++ b/pages/bitcoin.mdx @@ -0,0 +1,75 @@ +# Bitcoin Module + + + +## Block + +Represents a block in the Bitcoin blockchain. + +| Field | Type | Label | Description | +| --------------- | -------------------------------------- | -------- | ------------------------------------------- | +| version | [uint32](#uint32) | | Block version number | +| prev_block_hash | [bytes](#bytes) | | Hash of the previous block | +| merkle_root | [bytes](#bytes) | | Root hash of the Merkle tree | +| timestamp | [uint32](#uint32) | | Time when the block was created | +| bits | [uint32](#uint32) | | Target difficulty value | +| nonce | [uint32](#uint32) | | Value used for Proof-of-Work | +| transactions | [Transaction](#bitcoin-v1-Transaction) | repeated | List of transactions included in the block | + + + + +## Transaction + +Represents a transaction in the Bitcoin network. + +| Field | Type | Label | Description | +| ---------- | -------------------------------- | -------- | --------------------------------------------------- | +| version | [uint32](#uint32) | | Transaction version number. Currently 1 | +| inputs | [TxInput](#bitcoin-v1-TxInput) | repeated | List of transaction inputs | +| outputs | [TxOutput](#bitcoin-v1-TxOutput) | repeated | List of transaction outputs | +| locktime | [uint32](#uint32) | | Block height or timestamp when transaction is final | +| hash | [bytes](#bytes) | | | +| block_hash | [bytes](#bytes) | | Transactions reference their block | +| timestamp | [uint32](#uint32) | | | + + + + +## TxInput + +Represents an input in a Bitcoin transaction. + +| Field | Type | Label | Description | +| ---------- | ----------------- | -------- | ------------------------------------------------------------- | +| tx_id | [bytes](#bytes) | | Hash of the previous transaction output | +| script_sig | [bytes](#bytes) | | Unlocking script for spending the UTXO | +| sequence | [uint32](#uint32) | | Used for relative timelocks | +| coinbase | [bytes](#bytes) | | Coinbase transactions have this instead of txid and scriptSig | +| witnesses | [bytes](#bytes) | repeated | | + + + + +## TxOutput + +Represents an output in a Bitcoin transaction. + +| Field | Type | Label | Description | +| -------------- | ---------------------------------------- | ----- | ------------------------------------- | +| value | [uint64](#uint64) | | Amount of Bitcoin in Satoshis | +| script_pub_key | [ScriptPubKey](#bitcoin-v1-ScriptPubKey) | | Locking script defining spendability | + + + + +## ScriptPubKey + +Represents a script pub key in the output. + +| Field | Type | Label | Description | +| ----------- | -------------------- | ----- | ------------------------------- | +| asm | [bytes](#bytes) | | Script in human-readable format | +| hex | [bytes](#bytes) | | Script in hexadecimal format | +| script_type | [ScriptType](#bytes) | | Can be ScriptHash, Multsig, etc | + diff --git a/pages/introduction.mdx b/pages/introduction.mdx index 6144e3d..4c38781 100644 --- a/pages/introduction.mdx +++ b/pages/introduction.mdx @@ -26,11 +26,12 @@ The interface is divided into different modules that represent specific use-case Modules are blockchain-agnostic, they need to be paired with a specific ledger to be used. A ledger represents a set of primitive structures that are specific to a particular blockchain ecosystem. - So far, the spec focuses only on Cardano. Other UTxO-based blockchains will follow. + So far, the spec focuses on Cardano and Bitcoin. Other UTxO-based blockchains will follow. + ## SDKs