This guide show the steps to run a demonstration of the Bitcoin Executor, which operates as a Move smart contract on the Sui blockchain. The demo will show the execution of Bitcoin blocks and the management of the UTXO set on-chain.
-
Bitcoin Core (
bitcoind):- Installed and running in
regtestmode. - Ensure you can interact with it via
bitcoin-cli -regtest. - For a clean state, you might want to stop
bitcoind, remove yourregtestdata directory (e.g.,rm -rf ~/.bitcoin/regtest), and restartbitcoind -regtest -daemon.
As an alternative you can use docker setup from
relayer/contrib - Installed and running in
-
Relayer Scripts
- checkout gonative-cc/relayer repository.
- You will need the
btc_executor.shandsubmit_blocks.shscripts fromdemo_scriptsdirectory. (Or you can perform these actions manually).
-
Sui Development Environment:
- Sui client installed and configured to connect to a Sui network.
- A Sui address with sufficient SUI gas tokens for deploying and interacting with the smart contract.
First, you need to deploy the Move package containing the bitcoin_executor module to your target Sui network.
-
Navigate to your Move package directory.
-
Publish the contract using the Sui client:
sui client publish
-
Save Package ID and State Object ID:
- After successful publication, the output will include a "Created Objects" section.
- Note down the Package ID and State Object ID.
You will need these IDs for
btc_executor.shandsubmit_blocks.shscripts.
This step involves creating wallets, generating addresses, and mining blocks on your local Bitcoin regtest node.
-
Option A: Using
btc_executor.shscript:-
Navigate to your
relayer/demo_scripts/directory. -
Ensure the
btc_executor.shscript is executable (chmod +x btc_executor.sh). -
Run the script:
./btc_executor.sh
-
This script should:
- Create/load "alice" and "bob" wallets.
- Generate P2WPKH addresses for Alice and Bob.
- Mine 200 blocks to Alice's address (maturing coinbase outputs and ensuring SegWit is active).
- Create a SegWit transaction where Alice sends 1 BTC to Bob.
- Mine 1 more block (total 201 blocks from genesis, block index 200) to confirm this transaction.
- Output the raw hex of that transaction.
-
-
Option B: Manual Steps Check the bitcoin-cli docs for it.
Now, we will send the hex data of these Bitcoin blocks
-
Option A: Using
submit_blocks.shscript:-
This script will loop from block 0 to 201, fetch each block's raw hex, and perform the
sui client call. -
Important: You will need to edit
submit_blocks.shto setPACKAGE_IDandSTATE_OBJECT_IDto the values you obtained in Step 1. -
Ensure the
submit_blocks.shscript is executable (chmod +x submit_blocks.sh). -
Run the script:
./submit_blocks.sh
-
Observe the logs from the script and potentially from your Sui node/Move contract.
-
-
Option B: Manual Submission (Example for one block): Check the bitcoin-cli and sui-client docs for it.
