-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docs] client-side-validation and extending bitcoin (#1650)
* [docs] client-side-validation and extending bitcoin * update the-application-layer-of-bitcoin * review and fix up --------- Co-authored-by: Joe Chen <[email protected]>
- Loading branch information
1 parent
85b9502
commit 38a1c32
Showing
22 changed files
with
965 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Extending Bitcoin | ||
|
||
Rooch, as the application layer of Bitcoin, provides a programmable environment for Bitcoin through off-chain smart contracts. Developers can use Rooch to extend the Bitcoin protocol and develop applications within its ecosystem. | ||
|
||
Rooch offers several ways to extend the Bitcoin protocol or to interact with Bitcoin: | ||
|
||
- **[Programming with Bitcoin blocks and transactions](./bitcoin/programming_with_block_and_tx)**: Developers can access Bitcoin blocks and transactions within contracts and use the data contained in them for programming. | ||
- **[Bitcoin Asset Protocol Extension](./bitcoin/ordinals_metaprotocol_extension)**: Developers can deploy contracts to Rooch to extend the Bitcoin asset protocol, such as by deploying a new asset protocol based on Ordinals. | ||
- **[Programming with Bitcoin UTXO and Inscription](./bitcoin/programming_with_utxo_and_inscription)**: Rooch has automatically parsed Bitcoin UTXO and Inscription through the bitcoin-move system contract, allowing developers to directly use these assets for programming. | ||
|
||
There are many more scenarios to explore, and we welcome everyone to join in the development of Bitcoin ecosystem applications. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# 扩展 Bitcoin | ||
|
||
Rooch 作为 Bitcoin 的应用层,通过运行于链下的智能合约为 Bitcoin 提供可编程环境,开发者可利用 Rooch 扩展 Bitcoin 协议并开发生态应用。 | ||
|
||
Rooch 提供了几种方式来扩展 Bitcoin 协议或者和 Bitcoin 交互: | ||
|
||
- **[通过 Bitcoin 区块以及交易编程](./bitcoin/programming_with_block_and_tx)**: 开发者可以在合约中读取到 Bitcoin 区块以及交易,利用区块和交易中携带的数据来进行编程。 | ||
- **[Bitcoin 资产协议扩展](./bitcoin/ordinals_metaprotocol_extension)**: 开发者可以通过部署合约到 Rooch 来扩展 Bitcoin 资产协议,比如通过部署一个合约来实现一个新的基于 Ordinals 的资产协议。 | ||
- **[通过 Bitcoin UTXO 以及 Inscription 编程](./bitcoin/programming_with_utxo_and_inscription)**: Rooch 已通过 bitcoin-move 系统合约自动解析 Bitcoin UTXO 和 Inscription,开发者可以直接使用这些资产来进行编程。 | ||
|
||
更多的场景需要大家一起来探索,欢迎大家一起来参与 Bitcoin 生态应用的开发。 | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"ordinals_metaprotocol_extension": "Ordinals Metaprotocol Extension", | ||
"programming_with_block_and_tx": "Programming with Block and Tx", | ||
"programming_with_utxo_and_inscription": "Programming with UTXO and Inscription" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"ordinals_metaprotocol_extension": "Ordinals Metaprotocol 扩展", | ||
"programming_with_block_and_tx": "通过区块和交易编程", | ||
"programming_with_utxo_and_inscription": "通过 UTXO 和 Inscription 编程" | ||
} |
15 changes: 15 additions & 0 deletions
15
docs/website/pages/build/bitcoin/ordinals_metaprotocol_extension.en-US.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Ordinals Metaprotocol Extension | ||
|
||
import { Callout, FileTree } from 'nextra/components' | ||
|
||
Rooch offers a plugin mechanism that allows developers to extend the Ordinals Metaprotocol using Move. | ||
|
||
[Bitseed](https://bitseed.pro) is an SFT protocol based on an extension of Ordinals, currently under development. We will use Bitseed as an example to demonstrate how to extend the Ordinals Metaprotocol using Move, implementing an asset validator for the Ordinals Metaprotocol, and facilitating asset transitions between Bitcoin and Rooch. | ||
|
||
<Callout> | ||
TODO: This section of the document needs improvement | ||
|
||
1. Specifications for extending contracts of the Metaprotocol. | ||
2. Specifications for the asset validator. | ||
3. Specifications for asset transitions. | ||
</Callout> |
15 changes: 15 additions & 0 deletions
15
docs/website/pages/build/bitcoin/ordinals_metaprotocol_extension.zh-CN.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Ordinals Metaprotocol 扩展 | ||
|
||
import { Callout, FileTree } from 'nextra/components' | ||
|
||
Rooch 提供了一种插件机制,开发者可以通过 Move 来扩展 Ordinals Metaprotocol。 | ||
|
||
[Bitseed](https://bitseed.pro) 是一种基于 Ordinals 扩展的 SFT 协议,当前还在开发中,我们会以 Bitseed 为例,展示如何通过 Move 来扩展 Ordinals Metaprotocol,实现 Ordinals Metaprocol 的资产验证器,以及资产在 Bitcoin 和 Rooch 之间的跃迁。 | ||
|
||
<Callout> | ||
TODO: 这部分文档需要改进 | ||
|
||
1. Metaprotocol 的扩展合约的规范 | ||
2. 资产验证器的规范 | ||
3. 资产跃迁的规范 | ||
</Callout> |
21 changes: 21 additions & 0 deletions
21
docs/website/pages/build/bitcoin/programming_with_block_and_tx.en-US.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Programming with Bitcoin Blocks and Transactions | ||
|
||
import { Callout, FileTree } from 'nextra/components' | ||
|
||
Rooch incorporates the [bitcoin-move](https://github.com/rooch-network/rooch/tree/main/frameworks/bitcoin-move) framework, which allows developers to read Bitcoin blocks and transactions through the bitcoin-move framework and use the data carried in them for programming. | ||
|
||
## Reading Bitcoin Blocks and Transactions in Contracts | ||
|
||
<Callout> | ||
TODO: This section of the document needs improvement | ||
|
||
1. How to read transactions, including explanations of transaction fields. | ||
2. How to read blocks, including explanations of block fields. | ||
3. An explanation of how Bitcoin hashes are expressed and differ in Move is required. | ||
</Callout> | ||
|
||
## Application Scenarios | ||
|
||
1. Use a Bitcoin hash as a random number seed to implement a random number generator. Note, this scenario requires using the hash of future blocks to prevent predictability. | ||
2. Embed application data in Bitcoin via OP_RETURN, then read the OP_RETURN data from the transaction using a Move contract for processing. | ||
3. Validate Bitcoin transaction scripts in Move to enable mixed programming with Move and Bitcoin Script. This feature is still in development, and progress can be tracked at [Issue #1651](https://github.com/rooch-network/rooch/issues/1651). |
21 changes: 21 additions & 0 deletions
21
docs/website/pages/build/bitcoin/programming_with_block_and_tx.zh-CN.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# 通过 Bitcoin 的区块和交易编程 | ||
|
||
import { Callout, FileTree } from 'nextra/components' | ||
|
||
Rooch 内置了 [bitcoin-move](https://github.com/rooch-network/rooch/tree/main/frameworks/bitcoin-move) 框架,开发者可以通过 bitcoin-move 框架来读取 Bitcoin 区块以及交易,利用区块和交易中携带的数据来进行编程。 | ||
|
||
## 在合约中读取 Bitcoin 区块和交易 | ||
|
||
<Callout> | ||
TODO: 这部分文档需要改进 | ||
|
||
1. 如何读取交易,以及交易字段说明 | ||
2. 如何读取区块,以及区块字段说明 | ||
3. 需要说明 Bitcoin 哈希在 Move 中的表达方式以及区别 | ||
</Callout> | ||
|
||
## 应用场景 | ||
|
||
1. 利用 Bitcoin 哈希作为随机数种子,实现一个随机数生成器。注意,这种场景需要使用未来的区块哈希,避免被预测。 | ||
2. 将应用数据通过 `OP_RETURN` 写入 Bitcoin 中,然后通过 Move 合约读取交易中的 `OP_RETURN` 数据,进行处理。 | ||
3. 在 Move 中校验 Bitcoin 交易的 Script,实现 Move 和 Bitcoin Script 混合编程。这个特性尚在开发中,可以跟踪 [Issue #1651](https://github.com/rooch-network/rooch/issues/1651)。 |
Oops, something went wrong.