### Install Dependencies and Run Rollup Source: https://github.com/sovereign-labs/rollup-starter/blob/main/examples/privy/README.md Commands to install project dependencies using npm and to build and run the Sovereign SDK rollup using Cargo. ```bash npm install cargo run ``` -------------------------------- ### Start Development Server Source: https://github.com/sovereign-labs/rollup-starter/blob/main/examples/privy/README.md Command to start the development server for the Privy example package. ```bash npm run dev ``` -------------------------------- ### Initialize TypeScript Client Source: https://github.com/sovereign-labs/rollup-starter/blob/main/README.md Navigates to the example TypeScript client directory and installs its dependencies using npm. This prepares the client for programmatic interaction with the rollup. ```bash cd examples/starter-js && npm install ``` -------------------------------- ### Start Rollup Node Source: https://github.com/sovereign-labs/rollup-starter/blob/main/README.md Starts the main rollup node binary. This command compiles and runs the Rust project, initiating the rollup process. It's configured to automatically install the correct Rust toolchain version. ```bash cargo run ``` -------------------------------- ### Start and Interact with Local Celestia Network Source: https://github.com/sovereign-labs/rollup-starter/blob/main/integrations/README.md This snippet demonstrates how to start a local Celestia network using Docker Compose, retrieve the authentication token, query the Celestia RPC for block headers, and stop the network. ```shell # start the celestia network docker compose -f docker/docker-compose.yml up --build --force-recreate -d # grab the jwt CELESTIA_NODE_AUTH_TOKEN=$(cat docker/celestia/credentials/bridge-0.jwt) # check the celestia rpc curl -X POST \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${CELESTIA_NODE_AUTH_TOKEN}" \ -d '{ "id": 1, "jsonrpc": "2.0", "method": "header.GetByHeight", "params": [2] }' \ localhost:26658 # stop the Celestia network docker compose -f docker/docker-compose.yml down ``` ```json { "id": 1, "jsonrpc": "2.0", "method": "header.GetByHeight", "params": [2] } ``` -------------------------------- ### Run Rollup Starter Script Source: https://github.com/sovereign-labs/rollup-starter/blob/main/README.md Executes the start script for the rollup client, initializes the signer, and sends a create token transaction. Displays transaction details including events and receipt. ```bash $ npm run start Initializing rollup client... Rollup client initialized. Initializing signer... Signer initialized. Signer address: 0x9b08ce57a93751ae790698a2c9ebc76a78f23e25 Sending create token transaction... Tx sent successfully. Response: { "id": "0x633b06f81b2884f8f40a3f06535cdbedb859c37d328c24fd4518377c78dac60e", "events": [ { "type": "event", "number": 0, "key": "Bank/TokenCreated", "value": { "token_created": { "token_name": "Example Token", "coins": { "amount": "1000000000", "token_id": "token_10jrdwqkd0d4zf775np8x3tx29rk7j5m0nz9wj8t7czshylwhnsyqpgqtr9" }, "mint_to_address": { "user": "0x9b08ce57a93751ae790698a2c9ebc76a78f23e25" }, "minter": { "user": "0x9b08ce57a93751ae790698a2c9ebc76a78f23e25" }, "supply_cap": "100000000000", "admins": [] } }, "module": { "type": "moduleRef", "name": "Bank" }, "tx_hash": "0x633b06f81b2884f8f40a3f06535cdbedb859c37d328c24fd4518377c78dac60e" } ], "receipt": { "result": "successful", "data": { "gas_used": [ 21119, 21119 ] } }, "tx_number": 0, "status": "submitted" } ``` -------------------------------- ### Start and Stop Observability Stack Source: https://github.com/sovereign-labs/rollup-starter/blob/main/README.md Provides commands to start and stop the local observability stack, which includes Grafana and InfluxDB, for monitoring the rollup. ```bash $ make start-obs ... Waiting for all services to become healthy... ⏳ Waiting for services... (45 seconds remaining) ✅ All observability services are healthy! 🚀 Observability stack is ready: - Grafana: http://localhost:3000 (admin/admin123) - InfluxDB: http://localhost:8086 (admin/admin123) ``` ```bash $ make stop-obs ``` -------------------------------- ### Environment Configuration Source: https://github.com/sovereign-labs/rollup-starter/blob/main/examples/privy/README.md Example environment variables required for the Privy integration, including Privy App ID and Rollup URL. ```javascript VITE_PRIVY_APP_ID=your_privy_app_id_here VITE_ROLLUP_URL=http://localhost:12346 ``` -------------------------------- ### Interact with Rollup Modules Source: https://github.com/sovereign-labs/rollup-starter/blob/main/README.md Shows how to interact with different modules in the rollup by constructing a `RuntimeCall` object. The example demonstrates setting a value in the `ValueSetter` module. ```javascript // Example: Call the ValueSetter's SetValue method let callMessage: RuntimeCall = { value_setter: { // Must match Runtime field name of the module set_value: 10 }, }; ``` -------------------------------- ### TypeScript Rollup Interaction Example Source: https://github.com/sovereign-labs/rollup-starter/blob/main/README.md Demonstrates how to programmatically interact with the rollup using a TypeScript client. It covers initializing the rollup client, setting up a signer with a private key, creating a transaction to mint a new token via the 'bank' module, and sending the transaction. ```javascript // 1. Initialize rollup client // defaults to http://localhost:12346, or pass url: "custom-endpoint" const rollup = await createStandardRollup(); // 2. Initialize signer const privKey = "0d87c12ea7c12024b3f70a26d735874608f17c8bce2b48e6fe87389310191264"; let signer = new Secp256k1Signer(privKey, chainHash); // 3. Create a transaction (call message) let callMessage: RuntimeCall = { bank: { create_token: { admins: [], token_decimals: 8, supply_cap: 100000000000, token_name: "Example Token", initial_balance: 1000000000, mint_to_address: signerAddress, // derived from privKey above (can be any valid address) }, }, }; // 4. Send transaction let tx_response = await rollup.call(callMessage, { signer }); ``` -------------------------------- ### Celestia RPC Methods Source: https://github.com/sovereign-labs/rollup-starter/blob/main/integrations/README.md This section outlines the Celestia RPC methods used for interacting with the network. It includes the `header.GetByHeight` method for retrieving block headers. ```APIDOC Celestia RPC: header.GetByHeight(height: uint64) returns Header - Retrieves the block header at a specific height. - Parameters: - height: The block height to query. - Returns: - Header: The block header information. Authentication: - Requires a JWT token in the Authorization header: Bearer ``` -------------------------------- ### Celestia Genesis Parameters Source: https://github.com/sovereign-labs/rollup-starter/blob/main/UPGRADE.md Specifies the directory containing genesis parameters for the Celestia DA setup. ```toml ./test-data/genesis/celestia ``` -------------------------------- ### Rust Version Check Source: https://github.com/sovereign-labs/rollup-starter/blob/main/README.md Verifies the installed Rust version, which is critical for compatibility with the Sovereign SDK. Version 1.88.0 or later is recommended. ```bash rustc --version ``` -------------------------------- ### Relayer and Validator Environment Variables Source: https://github.com/sovereign-labs/rollup-starter/blob/main/integrations/hyperlane/README.md Example of a .env file configuration for setting up private keys for the relayer and validator agents, which are necessary for running the Hyperlane agents. ```dotenv # .env file RELAYER_KEY=your_relayer_private_key VALIDATOR_KEY=your_validator_private_key ``` -------------------------------- ### Clean Rollup Database Source: https://github.com/sovereign-labs/rollup-starter/blob/main/README.md Cleans the existing database for the rollup node. This command is optional and ensures a fresh start by removing any previous state or data. ```bash make clean-db ``` -------------------------------- ### TypeScript Module Resolution Source: https://github.com/sovereign-labs/rollup-starter/blob/main/README.md Instructions for resolving 'Module not found' errors in TypeScript projects by installing dependencies and ensuring a compatible Node.js version. ```bash npm install ``` -------------------------------- ### Configuration Example for Bridging Source: https://github.com/sovereign-labs/rollup-starter/blob/main/integrations/hyperlane/README.md Illustrates the configuration structure for native and synthetic tokens when setting up warp routes for cross-chain communication. It specifies token details, interchain security modules, and foreign deployment identifiers. ```json { "solanatestnet": { "type": "native", "decimals": 9, "name": "sol", "symbol": "SOL", "interchainSecurityModule": "7ym4qpYoX5z22wJxuLo3pChpLXvVM6xiW7FEDpseBKbQ" // The new ISM you just deployed on Solana }, "sovstarter": { "type": "synthetic", "decimals": 9, "name": "sol", "symbol": "SOL", "token": "token_1zaggz39msqa6dceryw25w6770vmlrjrgt2x53yece4pftyvlvvysxn0h7x", // The token ID of the new synthetic on the Sovereign SDK side. Taken from the emitted events "foreignDeployment": "0xe14e75006fa7444985b9876c71b6a7689631af98658b10598c5151f18490e812" // The warp route ID on the sovereign side. Taken from the emitted events } } ``` -------------------------------- ### Authenticate with GitHub Container Registry Source: https://github.com/sovereign-labs/rollup-starter/blob/main/integrations/README.md This command authenticates your Docker client with GitHub's Container Registry (ghcr.io) using a personal access token. This is necessary for pulling images hosted on GitHub Packages. ```shell # this has to be ran only once, unless your token expires $ echo $MY_PERSONAL_GITHUB_TOKEN | docker login ghcr.io -u $MY_GITHUB_USERNAME --password-stdin ``` -------------------------------- ### Set Interchain Gas Paymaster Transaction Source: https://github.com/sovereign-labs/rollup-starter/blob/main/integrations/hyperlane/README.md Example TypeScript transaction for setting up an interchain gas paymaster, which is crucial for sponsoring transactions from counterparty chains in the Sovereign SDK ecosystem. ```typescript // ../js/src/set-igp.ts ``` -------------------------------- ### Create Warp Route Transaction Source: https://github.com/sovereign-labs/rollup-starter/blob/main/integrations/hyperlane/README.md Example TypeScript transaction for creating a warp route on the Sovereign SDK chain. This requires modifying the transaction with the correct contract address from the counterparty chain's warp route deployment. ```typescript // ../js/src/create-warp-route.ts ``` -------------------------------- ### Clone Repository and Navigate Source: https://github.com/sovereign-labs/rollup-starter/blob/main/README.md Clones the Sovereign Labs rollup-starter repository from GitHub and navigates into the project directory. This is the initial step for setting up the development environment. ```bash git clone https://github.com/Sovereign-Labs/rollup-starter.git cd rollup-starter ``` -------------------------------- ### Enabling the Prover Source: https://github.com/sovereign-labs/rollup-starter/blob/main/README.md Explains how to enable and configure the prover by setting the `SOV_PROVER_MODE` environment variable. Options include skipping verification, simulating, executing, or proving. ```bash export SOV_PROVER_MODE=skip - Skip verification logic ``` ```bash export SOV_PROVER_MODE=simulate - Run verification logic in the current process ``` ```bash export SOV_PROVER_MODE=execute - Run verifier in a zkVM executor ``` ```bash export SOV_PROVER_MODE=prove - Run verifier and create a SNARK proof ``` -------------------------------- ### Alternative Configurations: DA Layers and zkVMs Source: https://github.com/sovereign-labs/rollup-starter/blob/main/README.md Demonstrates how to configure the rollup to use Celestia DA with Risc0 zkVM by spinning up a Celestia devnet container and recompiling the rollup with specific features. ```bash $ make start-celestia # this will spin up celestia devnet container $ cargo run --no-default-features --features celestia_da,risc0 ``` -------------------------------- ### Run Lint and Tests Source: https://github.com/sovereign-labs/rollup-starter/blob/main/UPGRADE.md Commands to ensure code quality and functionality by running linters and unit tests. ```bash make lint ``` ```bash cargo test ``` -------------------------------- ### Subscribe and Unsubscribe to Rollup Events Source: https://github.com/sovereign-labs/rollup-starter/blob/main/README.md Demonstrates how to subscribe to events from the sequencer using the `rollup.subscribe` method and how to unsubscribe from these events. ```javascript // Subscribe to events async function handleNewEvent(event: any): Promise { console.log(event); } const subscription = rollup.subscribe("events", handleNewEvent); // Unsubscribe subscription.unsubscribe(); ``` -------------------------------- ### Paymaster Configuration Source: https://github.com/sovereign-labs/rollup-starter/blob/main/README.md Details how to configure the paymaster for covering transaction gas costs. Shows the default configuration and how to run without a paymaster by emptying the `payers` array. ```json { "paymaster": { "payers": [] } } ``` -------------------------------- ### Rollup Configuration Files Source: https://github.com/sovereign-labs/rollup-starter/blob/main/UPGRADE.md Specifies the paths to rollup configuration files for both Mock DA and Celestia DA environments. ```toml # Mock DA rollup config ./configs/mock/rollup.toml # Celestia DA rollup config ./configs/celestia/rollup.toml ``` -------------------------------- ### Cargo.toml Dependencies Source: https://github.com/sovereign-labs/rollup-starter/blob/main/UPGRADE.md Illustrates the location of Cargo.toml files that may need updates for specific prover configurations. ```toml # Main Cargo.toml # crates/provers/risc0/guest-celestia/Cargo.toml # crates/provers/risc0/guest-mock/Cargo.toml ``` -------------------------------- ### Genesis Parameters Source: https://github.com/sovereign-labs/rollup-starter/blob/main/UPGRADE.md Indicates the paths to genesis parameter JSON files for Mock DA and Celestia DA configurations. ```json # Mock DA genesis params ./configs/mock/genesis.json # Celestia DA genesis params ./configs/celestia/genesis.json ``` -------------------------------- ### Database Cleaning and Rollup Restart Source: https://github.com/sovereign-labs/rollup-starter/blob/main/README.md Command to clean the rollup database, often a prerequisite before restarting the node to resolve startup crashes. ```bash make clean-db ``` -------------------------------- ### Clean Build Data Source: https://github.com/sovereign-labs/rollup-starter/blob/main/UPGRADE.md Command to clean previous build artifacts. It's recommended to also clean the wallet data if facing deployment issues. ```bash make clean ``` -------------------------------- ### Access Rollup REST API (Swagger UI) Source: https://github.com/sovereign-labs/rollup-starter/blob/main/README.md Opens the Swagger UI for the rollup's REST API in the default web browser. This allows exploration of available API endpoints for querying rollup state and interacting with modules. ```bash open http://127.0.0.1:12346/swagger-ui/#/ ``` -------------------------------- ### ValueSetter Module Structure Source: https://github.com/sovereign-labs/rollup-starter/blob/main/examples/value-setter/README.md This snippet outlines the basic structure of the ValueSetter module, including the struct definition, the CallMessage variant, and the initial call method. ```rust struct ValueSetter { value: StateValue, } enum CallMessage { SetValue(u32), } impl Module for ValueSetter { type CallMessage = CallMessage; type QueryMessage = (); fn call(&mut self, message: Self::CallMessage) -> Response { match message { CallMessage::SetValue(new_value) => { self.value.set(new_value); Response::new() } } } fn query(&self, _message: Self::QueryMessage) -> Response { Response::new() } } ``` -------------------------------- ### Identify SDK Changes Source: https://github.com/sovereign-labs/rollup-starter/blob/main/UPGRADE.md Command to compare changes between two Git commit hashes in the Sovereign SDK's CHANGELOG.md file. ```bash git diff EXISTING_COMMIT_IN_CARGO_TOML COMMIT_UPDATE_TO -- CHANGELOG.md ``` -------------------------------- ### Rollup Configuration - Storage Buckets Source: https://github.com/sovereign-labs/rollup-starter/blob/main/README.md Parameter for increasing the number of user hash table buckets in the rollup's storage configuration to prevent 'buckets exhausted' errors. ```toml storage.user_hashtable_buckets = 1024 # Example value, adjust as needed ``` -------------------------------- ### Module Registration in stf-declaration Source: https://github.com/sovereign-labs/rollup-starter/blob/main/crates/stf/README.md New blockchain modules are defined and registered within the `stf-declaration` crate. This crate is independent of the DA layer and ZKVM, ensuring a clear separation of concerns. The `CHAIN_HASH` is automatically updated to include newly registered modules. ```rust // In stf-declaration/src/lib.rs // Define your module mod my_module { // ... module logic ... } // Register the module use stf_declaration::register_module; register_module!(my_module); // The CHAIN_HASH will be derived from all registered modules. ``` -------------------------------- ### Update SDK Revision Source: https://github.com/sovereign-labs/rollup-starter/blob/main/UPGRADE.md Helper script to update the SDK revision in all Cargo.toml files. Replace NEW_REV with the desired commit hash. ```bash ./scripts/update_rev.sh NEW_REV ``` -------------------------------- ### Rollup Configuration - Bind Port Source: https://github.com/sovereign-labs/rollup-starter/blob/main/README.md Adjusts the bind port for the rollup node to resolve 'Address already in use' errors. This setting is crucial for network communication. ```toml bind_port = 12346 ``` -------------------------------- ### Query ValueSetter Module State Source: https://github.com/sovereign-labs/rollup-starter/blob/main/README.md Queries the current state value of the 'value-setter' module using the rollup's REST API. Initially, this is expected to return null as the value has not been set. ```bash curl http://127.0.0.1:12346/modules/value-setter/state/value ``` -------------------------------- ### Genesis Configuration - Paymaster Address Source: https://github.com/sovereign-labs/rollup-starter/blob/main/README.md Specifies the paymaster address in the genesis configuration file. This is important for transaction fee management when using a paymaster. ```json "paymaster_address": "0x..." ``` -------------------------------- ### Runtime Trait Implementation Source: https://github.com/sovereign-labs/rollup-starter/blob/main/crates/stf/README.md The `stf` crate implements the `Runtime` trait, handling DA layer integration, authentication, and deriving the `CHAIN_HASH`. It uses feature flags to select the appropriate DA layer and retrieves the correct `CHAIN_HASH` based on DA configuration. ```rust pub trait Runtime { // Method signatures and associated types for runtime behavior fn process_transaction(&mut self, tx: Transaction) -> Result<(), Error>; fn get_chain_hash(&self) -> Hash; // ... other methods } // In stf/src/runtime.rs impl Runtime for YourRuntime { // ... implementation details ... } ``` -------------------------------- ### TransferRemote Callmessage Structure Source: https://github.com/sovereign-labs/rollup-starter/blob/main/integrations/hyperlane/README.md Rust struct definition for the `TransferRemote` callmessage, used to initiate token transfers from the Sovereign SDK chain to a destination chain via Hyperlane. It includes parameters for the warp route, recipient, amount, and optional relayer. ```rust TransferRemote { warp_route: route_id, destination_domain: {DESTINATION_DOMAIN}, recipient: {RECIPIENT}, // The eth address of the EOA that should receive funds amount: {AMOUNT}, // in units of 1e-18 ETH relayer: Some(relayer.address()), // Optional gas_payment_limit: Amount::MAX, }) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.