OP Stack Integration

Overview

Nubit DA significantly enhances the OP Stack by offering an efficient, cheap, trustless, and secure solution for storing and retrieving batched transactions. Instead of sending these batches to Ethereum L1 (which is expensive), they are sent to Nubit DA. This reduces the local storage requirements for sequencers (operators) and users.

Optimism uses Ethereum as a DA layer. Currently, settlement and DA for Optimism are on Ethereum, both on-chain. The op-batcher batches up rollup blocks and posts them to Ethereum. op-geth handles execution, while the op-proposer is responsible for state commitment submission.

By using Nubit as a DA layer, existing L2s can switch from posting their data calldata on Ethereum to posting to Nubit. The commitment to the block is posted on Nubit, which is purpose-built for data availability. This is more scalable than the traditional method of posting this data calldata on monolithic chains.

Technically, in our integration, we have op-batcher realized two functionalities: batching the transactions and sending them to the Nubit DA while sending the data commitment to the op-batcher. When reading op-node, it simply reads the data back from the DA layer by first reading the data commitment from the op-batcher, then reading the data from the DA layer using the data commitment. While previously op-node reading from Ethereum calldata , now reads data from Nubit.

After receiving the data, the Nubit backend returns a proof of data inclusion.

For an op-node to retrieve the transaction data, it first fetches the corresponding data commitment from op-batcher. Then, it retrieves the data from the DA backend and verifies it by the commitment.

After the integration, op-batcher batches up rollup blocks and posts them to Nubit's DA network, reducing the operator overhead of posting data as calldata. Compared with posting and fetching data from Ethereum calldata, the current version is more efficient and the verification cost is significantly lower. Hence, scalability and security are further improved.


Run the Integration Demo

Installation

Ensure you have Docker and Docker Compose installed, and that your user has the necessary permissions to run Docker commands. Also, make sure to have python with version >= python3.9.

Clone the Repository

Navigate to your home directory and clone the repository. Please contact the Nubit team for the repo access.

cd $HOME
git clone -b nubit-integration https://github.com/RiemaLabs/optimism.git
cd optimism
git submodule update --init --recursive

Setup FoundryUp

Install FoundryUp for managing the development environment.

curl -L https://foundry.paradigm.xyz | bash
source $HOME/.bashrc
foundryup

Setting up the Devnet

Start Devnet

Run the command to start the optimism devnet.

make devnet-up

If the command runs successfully, you will see Devnet ready. at the end.

Running the End-to-End Tests

Go to the op-e2e directory.

cd op-e2e

Set Environment Variables:

Set the necessary environment variables. Replace <YOUR_NUBIT_AUTH_TOKEN> and <YOUR_NUBIT_NODE_RPC_ENDPOINT> with your specific values.

To run a Nubit light node and get your Nubit Auth token, please refer to Run a Node.

Furthermore, please Get NUB for your Nubit light node before running end-to-end test.

export OP_E2E_DISABLE_PARALLEL=true
export OP_E2E_CANNON_ENABLED=false
# For example:
# export OP_E2E_AUTH_TOKEN=eyJhbxxxx.xxxx
# export OP_E2E_DA_NODE_RPC=http://localhost:26658
export OP_E2E_AUTH_TOKEN=<YOUR_NUBIT_AUTH_TOKEN>
export OP_E2E_DA_NODE_RPC=<YOUR_NUBIT_NODE_RPC_ENDPOINT>

Run the End-to-End Tests

Execute the command to run the end-to-end tests. (Remember to keep your Nubit light node running at the same time!)

make test

By following these steps, you can easily set up and run the integration demo.

Note: We have implemented the DA backend for the OP Stack chain to satisfy the requirements of collaborative projects.

Last updated