Skip to content

ColiseumProject/colichain-docs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Colichain

Colichain is an OP Stack L2 rollup that uses Celestia as its DA Layer.

Develop On Colichain

To get started with developing on Colichain, dive into our Developer Guide for everything you need to get started.

Spinning Up a Roll up

1. System Dependencies Installation

sudo apt update && sudo apt install -y build-essential git curl make jq direnv
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs npm
sudo npm install -g pnpm

2. Install Go

sudo rm -rf /usr/local/go
GO_VERSION=1.22.3
wget https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
echo 'export GOPATH=$HOME/go' >> ~/.bashrc
echo 'export PATH=$PATH:$GOPATH/bin' >> ~/.bashrc
source ~/.bashrc

3. Generate Alt-DA App Key

mkdir avail-appkey && cd avail-appkey
npm init -y
npm install avail-js-sdk dotenv
npm install -D ts-node typescript @types/node
npx tsc --init
cat > .env <<EOF
SEED=
EOF
# Edit .env to set SEED
touch createAppKey.ts
# Write script to generate app key
npx ts-node createAppKey.ts  # copy APP ID from output
cd ..

Find more granular instructions on generating app key visit avail docs.

4. Build and Run Alt-DA Server

git clone https://github.com/availproject/avail-alt-da-server.git
cd avail-alt-da-server
make da-server
./bin/avail-da-server \
  --addr=localhost \
  --port=8000 \
  --avail.rpc=wss://turing-rpc.avail.so/ws \
  --avail.seed='' \
  --avail.appid=440

5. Clone and Build OP Stack Components

git clone https://github.com/ethereum-optimism/optimism.git
cd optimism
git checkout v1.13.3
curl -L https://foundry.paradigm.xyz | bash && ~/.foundry/bin/foundryup && export PATH=$HOME/.foundry/bin:$PATH
# Install Rust and Just for contract builds
curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env
cargo install just
# Build Bedrock contracts
cd packages/contracts-bedrock
just install
just build
cd ../..
# Build op-geth
git clone https://github.com/ethereum-optimism/op-geth.git
cd op-geth
make geth

6. Configure Direnv and Environment Variables

eval $(direnv hook bash)

Use the .envrc.example file to populate the required variables.

7. Configure Rollup (getting-started.json)

Open packages/contracts-bedrock/deploy-config/getting-started.json and add the following fields under the main object:

  • useAltDA: true
  • daCommitmentType: GenericCommitment
  • daChallengeWindow: 160
  • daResolveWindow: 160
  • daBondSize: 1000000
  • daResolverRefundPercentage: 0
  • requiredProtocolVersion: 0x0000000000000000000000000000000000000000000000000000000000090000
  • recommendedProtocolVersion: 0x0000000000000000000000000000000000000000000000000000000000090000
  • finalSystemOwner: 0xF57DE4A519C0D9F776F8C079B05f83795c31e387
  • proofMaturityDelaySeconds: 604800
  • disputeGameFinalityDelaySeconds: 604800
  • l1StartingBlockTag: BLOCKNUMBER

Fetch finalized block data and update the config:

HASH=$(cast block finalized --rpc-url $L1_RPC_URL -f hash)
TS_HEX=$(cast block finalized --rpc-url $L1_RPC_URL -f timestamp)
TIMESTAMP=$(cast to-dec $TS_HEX)
echo $HASH $TIMESTAMP

Update l1StartingBlockTag and l2OutputOracleStartingTimestamp accordingly.

8. Initialize and Apply op-deployer

Find the latest build binaries of op-deplyer here.

wget https://github.com/ethereum-optimism/optimism/releases/download/op-deployer%2Fv0.2.0/op-deployer-0.2.0-linux-amd64.tar.gz
tar -xzf op-deployer-0.2.0-linux-amd64.tar.gz
chmod +x op-deployer
sudo mv op-deployer /usr/local/bin/
op-deployer init \
  --l1-chain-id 11155111 \
  --l2-chain-ids <chainId> \
  --workdir .deployer

Make sure to edit the intent file from .deployer/intent.toml as required. This intent can file can than be used to deploy the contracts by using:

op-deployer apply --workdir .deployer --l1-rpc-url https://eth-sepolia.g.alchemy.com/v2/... --private-key 0x...
op-deployer inspect genesis --workdir .deployer <chainId> > .deployer/genesis.json
op-deployer inspect rollup --workdir .deployer <chainId> > .deployer/rollup.json

Copy genesis.json and rollup.json to the geth and op-node directories.

9. Run op-geth

cd op-geth
./build/bin/geth \
  --datadir ./datadir \
  --http \
  --http.corsdomain='*' \
  --http.vhosts='*' \
  --http.addr=0.0.0.0 \
  --http.api=web3,debug,eth,txpool,net,engine,miner \
  --ws \
  --ws.addr=0.0.0.0 \
  --ws.port=8546 \
  --ws.origins='*' \
  --ws.api=debug,eth,txpool,net,engine,web3,miner \
  --syncmode=full \
  --gcmode=archive \
  --nodiscover \
  --maxpeers=0 \
  --networkid=<chainId> \
  --authrpc.addr=0.0.0.0 \
  --authrpc.port=8551 \
  --authrpc.vhosts='*' \
  --authrpc.jwtsecret=./jwt.txt \
  --rollup.disabletxpoolgossip=true

10. Run op-node

cd ~/optimism/op-node
cp ~/optimism/op-deployer/.deployer/rollup.json ./rollup.json
./bin/op-node \
  --l2=http://localhost:8551 \
  --l2.jwt-secret=/root/op-geth/jwt.txt \
  --sequencer.enabled \
  --sequencer.l1-confs=5 \
  --verifier.l1-confs=4 \
  --rollup.config=./rollup.json \
  --rpc.addr=0.0.0.0 \
  --rpc.enable-admin \
  --p2p.disable \
  --p2p.sequencer.key=$GS_SEQUENCER_PRIVATE_KEY \
  --l1=$L1_RPC_URL \
  --l1.rpckind=$L1_RPC_KIND \
  --l1.beacon=https://eth-beacon-chain-sepolia.drpc.org/rest

11. Run op-batcher

cd ~/optimism/op-batcher
./bin/op-batcher \
  --l2-eth-rpc=http://localhost:8545 \
  --rollup-rpc=http://localhost:9545 \
  --poll-interval=1s \
  --sub-safety-margin=6 \
  --num-confirmations=1 \
  --safe-abort-nonce-too-low-count=3 \
  --resubmission-timeout=30s \
  --rpc.addr=0.0.0.0 \
  --rpc.port=8548 \
  --rpc.enable-admin \
  --max-channel-duration=25 \
  --l1-eth-rpc=$L1_RPC_URL \
  --private-key=$GS_BATCHER_PRIVATE_KEY

12. Run op-proposer

cd ~/optimism/op-proposer
export OP_PROPOSER_WAIT_NODE_SYNC=true
export OP_PROPOSER_GAME_FACTORY_ADDRESS=$(jq -r .opChainDeployment.disputeGameFactoryProxyAddress ~/optimism/op-deployer/l1-contracts.json)
export OP_PROPOSER_PROPOSAL_INTERVAL=4m
export GS_PROPOSER_PRIVATE_KEY=0x...
export L1_RPC_URL=https://eth-sepolia.g.alchemy.com/v2/...
export OP_PROPOSER_GAME_TYPE=1
./bin/op-proposer \
  --poll-interval=12s \
  --rpc.port=8560 \
  --rollup-rpc=http://localhost:9545 \
  --private-key=$GS_PROPOSER_PRIVATE_KEY \
  --l1-eth-rpc=$L1_RPC_URL

Architecture

Architectures

About

Documentation for ColiChain L2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors