Deploy a Bitcoin Appchain (L3)
In this guide, we will walk through the process of deploying a Bitcoin Appchain (L3) on Citrea using the OP Stack, with Celestia as the data availability layer.
The following steps are appropriately modified from the Optimism documentation.
Prerequisites
We recommend to open a separate folder in your filesystem for the rest of this guide.
Appchains require strong hardware to function properly. For demo purposes, we used a machine with AMD EPYC 9124 @ 3.71GHz and 128 GB of RAM.
Step 1: Install & Run Celestia Light Node
Step 1.1 Install Celestia Light Node
Follow the steps here to install Celestia Light Node. You may install the latest version.
Step 1.2 Run Celestia Light Node
Run the following to start a Celestia Mocha Light Node:
celestia light init --p2p.network mocha
celestia light start --core.ip rpc-mocha.pops.one --p2p.network mochaStep 1.3 Get funds to your address
To write data into Celestia, you will need an address & funds. Please follow the steps here.
Step 2: DA Server Setup
Step 2.1 Build DA Server
Let's clone the op-plasma-celestia repository first and build the da-server:
This will form the da-server binary in the bin folder.
Step 2.2 Run DA Server
Then, let's create a namespace:
Lastly, let's get the Celestia auth token for the light node and put it into AUTH_TOKEN env variable to start the DA server:
This will start the DA server.
Step 3: Setup Optimism repositories and configure environment
Step 3.1: Clone repositories
Clone op-geth and Optimism mono-repository, then checkout to v1.9.2 for development purposes:
Step 3.2: Setup environment
Then, let's setup our environment using the .envrc file (alternatively you can set them in your shell):
Step 3.3: Run configuration scripts
Navigate to the op-node directory and generate the configuration:
Later in the same folder, let's run the deployment script using forge to deploy the necessary contracts on Citrea:
And also run the L3 genesis configuration script:
Step 4: Generate node configurations
Navigate to the op-node and generate the configuration for the L3 node:
Step 5: Initialize and start op-geth
Navigate to the op-geth directory and initialize the genesis configuration:
Then, start the op-geth:
Step 6: Add DA-config to op-node
Navigate to op-node folder and add the following to the rollup.json:
Step 7: Run op-node
Go back to the main optimism directory, and build op-node:
Then let's run the node:
Step 8: Run op-batcher
Go back to the main optimism directory, and build the op-batcher:
Then let's run the batcher:
Step 9: Run op-proposer
Go back to optimism main folder, and build the op-proposer:
Then let's run the proposer:
Thatβs it! Enjoy your Bitcoin Appchain on Citrea!
Last updated
Was this helpful?