Sovereign Integration

What’s Sovereign

Sovereign is a rollup scheme with a novel transaction settlement layer. Different from optimistic rollups, sovereign rollup handles transaction settlements on its own and prove data directly instead of applying fraud proofs. This method enjoys the flexibility and composability merits of zero-knowledge proofs and opens up a wider range of applications. Furthermore, it executes independently of the data availability layer and enables pluggable DA services. Sovereign is a web3 project realizing a sovereign rollup, its data availability is realized by collaborative data availability projects which receive, batch, and send data to the execution layer by pluggable and tunable adapters.


Nubit DA for Sovereign

In short, we provide a data availability layer for Sovereign by receiving and storing data in the Nubit DA chain and sending the data to Sovereign after batching and proving.

Technically, we have constructed a DA layer as an adapter for Sovereign. This adapter fetches data from the Nubit DA (specified by a certain namespace), parses the data, completes the DA verification, and sends the data to sovereign rollup nodes.


Run the Integration Demo

Setup

Clone the repository for the Nubit DA adapter:

git clone git@github.com:RiemaLabs/nubit-sovereign-integration-demo.git

Ensure all artifacts are built successfully:

cd nubit-sovereign-integration-demo/examples/demo-rollup-nubit
cargo build --bins

Start the Nubit DA Node

Start the Nubit DA node based on Sovereign SDK:

# under examples/demo-rollup-nubit
make clean-mock-rollup-db
cargo run

Verify the node has started successfully. If you see the following output, the node has started correctly:

2024-06-28T06:29:56.477783Z DEBUG jmt: hashed jmt key key=b"sov_sequencer_registry/SequencerRegistry/preferred_sequencer/" key_hash=KeyHash("43445c224165f8859d292e72300449591ceaf77ff7d6e88aa3921be685645251")
2024-06-28T06:29:56.477880Z DEBUG jmt: hashed jmt key key=b"sov_value_setter/ValueSetter/admin/" key_hash=KeyHash("3462ef07e2f504d2e16f476bf7b1bcd7e831e753570c874beb60dd07ba228fa4")
2024-06-28T06:29:56.479183Z DEBUG sov_prover_storage_manager: Snapshot id=2 for block=MockBlockHeader { prev_hash: 0x0000000000000000000000000000000000000000000000000000000000000000, hash: 0x0101010101010101010101010101010101010101010101010101010101010101, height: 0, time: Time { secs: 1672531200, nanos: 0 } } has been saved to StorageManager
2024-06-28T06:29:56.479214Z DEBUG sov_prover_storage_manager: Finalizing block: MockBlockHeader { prev_hash: 0x0000000000000000000000000000000000000000000000000000000000000000, hash: 0x0101010101010101010101010101010101010101010101010101010101010101, height: 0, time: Time { secs: 1672531200, nanos: 0 } }
2024-06-28T06:29:56.479228Z DEBUG sov_prover_storage_manager: Finalizing block prev_hash=0x0000000000000000000000000000000000000000000000000000000000000000; current_hash=0x0101010101010101010101010101010101010101010101010101010101010101
2024-06-28T06:29:56.480676Z  INFO sov_stf_runner::runner: Chain initialization is done. Genesis root: 0x9d3d4c5b43f53935f9273b01a023e59497466e1fc33b65faade76ce0f36b7184
2024-06-28T06:29:56.480993Z DEBUG sov_stf_runner::runner: Requesting data for height 1
2024-06-28T06:29:56.481477Z  INFO sov_stf_runner::runner: Starting RPC server at 127.0.0.1:12350

Generate and List Keys

In another terminal, generate a new key pair:

# under examples/demo-rollup-nubit
# Generate a new key pair
make create-key
# or
make import-keys

List all keys to verify the creation:

# under examples/demo-rollup-nubit
# List all keys to verify
make list-keys

Run the Test to Create a Token

Run the test command to create a token:

# under examples/demo-rollup-nubit
make test-create-token

You should see the output in the log like:

# node
2024-06-28T06:30:13.249927Z  INFO sov_sequencer: Accepting tx: 0x8e6417f6fb6d1403e49c2d0e17dffcde96a148400ff3c9e63971b21033bfc1f753138299b66535033c7a4aebd51e896c92fdc1470fe74f25242ced1231152409f8ad2437a279e1c8932c07358c91dc4fe34864a98c6c25f298e2a0199c1509ffa000000000000b000000000000000e000000736f762d746573742d746f6b656ee803000000000000a3201954f70ad62230dc3d840a5bf767702c04869e85ab3eee0b962857ba759802000000fea6ac5b8751120fb62fff67b54d2eac66aef307c7dde1d394dea1e09e43dd44a3201954f70ad62230dc3d840a5bf767702c04869e85ab3eee0b962857ba75980000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
2024-06-28T06:30:13.250490Z  INFO sov_sequencer: Submit batch request has been received!
2024-06-28T06:30:13.250701Z  INFO sov_sequencer::batch_builder: Transaction has been included in the batch hash="f5752334022eaccfa1214084dfb39f3ae04a9e76de03fb71cb5224f9234b89ab"
2024-06-28T06:30:13.250924Z DEBUG sov_mock_da::service: Finalized MockHeader: MockBlockHeader { height: 1, prev_hash: 0101010101010101010101010101010101010101010101010101010101010101, next_hash: a3a909b0e98ae3264518bb4d803eeaa362039f15d342a28103e7681260c90e05 }

# Transaction issuer
Your batch was submitted to the sequencer for publication. Response: "Submitted 1 transactions"

Rerun

If you need to restart the node, please remove the original rollup database:

# under examples/demo-rollup-nubit
make clean-mock-rollup-db

Last updated