### Install QEMU and Start Docker Machine Source: https://docs.scroll.io/en/sdk/guides/devnet-deployment These commands are used to update package lists, install QEMU for cross-architecture emulation, and start the Docker Machine service for local development. ```bash minikube ssh "sudo apt-get update && sudo apt-get -y install qemu-user-static" sudo brew services start chipmk/tap/docker-mac-net-connect ``` -------------------------------- ### Configure Docker Group and Start Minikube Source: https://docs.scroll.io/en/sdk/guides/devnet-deployment This section explains how to add your user to the Docker group to manage Docker resources and then start the Minikube cluster with the Docker driver, enabling ingress and ingress-DNS addons for network access. ```bash sudo usermod -aG docker $USER && newgrp docker minikube start --driver=docker minikube addons enable ingress minikube addons enable ingress-dns ``` -------------------------------- ### Install Kubernetes Add-Ons Source: https://docs.scroll.io/en/sdk/guides/aws-deployment Installs the NGINX Ingress Controller via Helm and the Cert-Manager controller via kubectl to support cluster networking and HTTPS. ```bash # NGINX Ingress Controller helm repo add nginx-stable https://kubernetes.github.io/ingress-nginx helm repo update helm install nginx-ingress nginx-stable/ingress-nginx --namespace kube-system # Cert-Manager kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.16.0/cert-manager.yaml ``` -------------------------------- ### Install Scroll SDK Development Chain Source: https://docs.scroll.io/en/sdk/guides/devnet-deployment After potentially configuring values.yaml and config.toml, this command installs the Scroll SDK development chain. It deploys the necessary services and waits for them to become available. ```bash make install ``` -------------------------------- ### Demonstrate Syntax Highlighting Markers Source: https://docs.scroll.io/en/article-components Examples of using syntax highlighting features like line highlighting, inserted/deleted markers, and diff formatting. ```js function demo() { console.log('These are inserted and deleted marker types'); return true; } ``` ```diff function thisIsJavaScript() { - console.log('Old code to be removed') + console.log('New and shiny code!') } ``` -------------------------------- ### Install Hashicorp Vault using Helm Source: https://docs.scroll.io/en/sdk/guides/digital-ocean-alt-gas-token Installs a local development instance of Hashicorp Vault using Helm. This is a prerequisite for pushing secrets to a Vault instance within the cluster for the demo. Ensure Helm is installed and configured. ```bash helm repo add hashicorp https://helm.releases.hashicorp.com helm repo update helm install vault hashicorp/vault --set "server.dev.enabled=true" ``` -------------------------------- ### Testnet ETH Faucet Guide Source: https://docs.scroll.io/en/developers Instructions on how to obtain testnet ETH on Scroll. ```APIDOC ## Testnet ETH ### Description This section provides guidance on how to acquire testnet ETH for use on the Scroll network. Please refer to the linked guide for detailed instructions. ### Method N/A (Informational) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A #### Response Example Refer to the [Testnet ETH Faucet guide](/en/developers/faucet/) for instructions. ``` -------------------------------- ### Automate Prover Deployment with Makefile Source: https://docs.scroll.io/en/sdk/guides/digital-ocean-alt-gas-token Provides Makefile targets to install or delete the prover services using Helm. This simplifies the deployment process by wrapping multiple Helm upgrade and delete commands. ```makefile install-provers: helm upgrade -i prover-chunk oci://ghcr.io/scroll-tech/scroll-sdk/helm/scroll-proving-sdk -n $(NAMESPACE) \ --version=0.0.5 \ --values values/prover-chunk-production.yaml helm upgrade -i prover-batch oci://ghcr.io/scroll-tech/scroll-sdk/helm/scroll-proving-sdk -n $(NAMESPACE) \ --version=0.0.5 \ --values values/prover-batch-production.yaml helm upgrade -i prover-bundle oci://ghcr.io/scroll-tech/scroll-sdk/helm/scroll-proving-sdk -n $(NAMESPACE) \ --version=0.0.5 \ --values values/prover-bundle-production.yaml delete-provers: helm delete -n $(NAMESPACE) prover-chunk helm delete -n $(NAMESPACE) prover-batch helm delete -n $(NAMESPACE) prover-bundle ``` -------------------------------- ### Clone Scroll SDK and Bootstrap Development Environment Source: https://docs.scroll.io/en/sdk/guides/devnet-deployment This process involves cloning the scroll-sdk repository, navigating to the devnet directory, and running the bootstrap command to install Helm chart dependencies, generate configurations, and create the genesis.yaml file. ```bash git clone git@github.com:scroll-tech/scroll-sdk.git cd scroll-sdk/devnet make bootstrap ``` -------------------------------- ### Configure Gas Token Details with Scroll SDK Source: https://docs.scroll.io/en/sdk/guides/digital-ocean-alt-gas-token Sets up details for the gas token. If no token address is specified, a new ERC20 token will be deployed on L1. The example decimal is used for this deployed contract. The CLI tool has limitations for advanced configuration, requiring manual updates to config.toml. ```toml [gas-token] ALTERNATIVE_GAS_TOKEN_ENABLED = true L1_GAS_TOKEN = "0xFF34B3d4Aee8ddCd6F9AFFFB6Fe49bD371b8a357" ``` -------------------------------- ### Configure Genesis JSON for Feynman Upgrade Source: https://docs.scroll.io/en/technology/overview/scroll-upgrades/feynman-upgrade Example of the genesis.json configuration showing the addition of the feynmanTime timestamp and updated state roots required for the network upgrade. ```json { "config": { "chainId": 534352, "euclidTime": 1744815600, "euclidV2Time": 1745305200, "feynmanTime": 1755576000 }, "scroll": { "genesisStateRoot": "0x08d535cc60f40af5dd3b31e0998d7567c2d568b224bed2ba26070aeb078d1339", "missingHeaderFieldsSHA256": "0xfa2746026ec9590e37e495cb20046e20a38fd0e7099abd2012640dddf6c88b25" } } ``` -------------------------------- ### Prepare Helm Charts with Scroll SDK Source: https://docs.scroll.io/en/sdk/guides/digital-ocean-alt-gas-token Prepares Helm charts by checking access, reviewing the Makefile, and verifying values files. The CLI tool attempts to auto-fill the production.yaml file for each chart and prompts for updates, flagging any empty values. It's crucial to sanity-check these values and re-run 'setup configs' if earlier steps need correction. ```bash scrollsdk setup prep-charts ``` -------------------------------- ### Setup and Run Scroll L2geth Node via Docker Source: https://docs.scroll.io/en/developers/guides/running-a-scroll-node Commands to pull the L2geth image, download and extract the network snapshot, and execute the node using Docker Compose. This process requires an L1 Ethereum RPC endpoint for synchronization. ```bash docker pull scrolltech/l2geth:latest wget https://scroll-geth-snapshot.s3.us-west-2.amazonaws.com/mpt/latest.tar tar -xf latest.tar cd l2geth docker compose up -d ``` ```yaml services: l2geth: image: scrolltech/l2geth:latest container_name: l2geth-docker stop_signal: SIGINT stop_grace_period: 60s restart: "unless-stopped" environment: - CHAIN_ID=534352 - RUST_LOG="info" volumes: - 'l2geth/data:/volume/l2geth/data' ports: - 8545:8545 - 8546:8546 - 6060:6060 - 30303:30303 - 30303:30303/udp command: --scroll --scroll-mpt --snapshot=false --metrics --pprof.addr 0.0.0.0 --pprof.port 6060 --datadir /volume/l2geth/data --gcmode archive --http --http.addr 0.0.0.0 --http.port 8545 --http.api eth,net,web3,debug,scroll --cache.noprefetch --l1.endpoint "${Your l1 endpoint}" --da.blob.blobscan "${Your blobscan endpoint}" --da.blob.beaconnode "${Your beaconnode endpoint}" --da.blob.awss3 "${Your aws s3 endpoint}" --cache.snapshot=0 logging: driver: "json-file" options: max-size: "100m" max-file: "1" ``` -------------------------------- ### Fund Scroll SDK Accounts using CLI Source: https://docs.scroll.io/en/sdk/guides/devnet-deployment This command helps in funding the necessary accounts for the Scroll SDK. It requires navigating to the scroll-sdk directory and executing the helper command with the --dev flag. Ensure all prerequisites are installed before running. ```bash cd scroll-sdk scrollsdk helper fund-accounts --dev ``` -------------------------------- ### Update Service Configuration using Make Source: https://docs.scroll.io/en/sdk/guides/devnet-deployment This sequence of commands is used to update the configuration of a running service. It involves making changes to configuration files or Helm charts, running `make install` to apply them, and then deleting the specific pod to trigger a restart with the new configuration. Kubernetes will automatically recreate the pod. ```bash make install kubectl delete pod [pod-name] ``` -------------------------------- ### Apply L2 Sequencer Configuration with Helm (Bash) Source: https://docs.scroll.io/en/sdk/guides/digital-ocean-alt-gas-token This bash command upgrades or installs the 'l2-sequencer' Helm chart with a specified version and custom values file. It's used to apply the optimized machine configuration, including node affinity and resource settings, to the 'l2-sequencer' service in a Kubernetes environment. ```bash helm upgrade -i l2-sequencer-0 oci://ghcr.io/scroll-tech/scroll-sdk/helm/l2-sequencer \ --version=0.0.11 \ --values values/l2-sequencer-production-0.yaml ``` -------------------------------- ### Get Claimable Messages Source: https://docs.scroll.io/en/developers/guides/scroll-messenger-cross-chain-interaction This endpoint allows you to retrieve claimable messages for a given L2 address. It's used in conjunction with relaying transactions from L2 to L1. ```APIDOC ## GET /api/claimable ### Description Retrieves a list of claimable messages for a specified L2 address. This is a crucial step when relaying transactions from Layer 2 to Layer 1 using the Scroll Bridge. ### Method GET ### Endpoint `https://sepolia-api-bridge.scroll.io/api/claimable` ### Parameters #### Query Parameters - **page_size** (integer) - Optional - The number of results to return per page. Defaults to 10. - **page** (integer) - Optional - The page number to retrieve. Defaults to 1. - **address** (string) - Required - The GreeterOperator contract address on L2 for which to fetch claimable messages. ### Request Example ```bash curl "https://sepolia-api-bridge.scroll.io/api/claimable?page_size=10&page=1&address=GREETER_OPERATOR_ADDRESS_ON_L2" ``` ### Response #### Success Response (200) - **messages** (array) - A list of claimable message objects. - **message_id** (string) - The unique identifier for the message. - **from** (string) - The sender address on L2. - **to** (string) - The recipient address on L1. - **data** (string) - The message payload. - **block_number** (integer) - The L2 block number in which the message was sent. #### Response Example ```json { "messages": [ { "message_id": "0x123abc...", "from": "0xL2SenderAddress...", "to": "0xL1RecipientAddress...", "data": "0x...", "block_number": 123456 } ] } ``` ### Notes - This API is experimental and subject to change. It is primarily used by the Bridge UI and may not be finalized. - The `GREETER_OPERATOR_ADDRESS_ON_L2` should be replaced with your actual contract address deployed on L2. ``` -------------------------------- ### Initialize Local Project Directory Source: https://docs.scroll.io/en/sdk/guides/digital-ocean-alt-gas-token Creates a new directory for the project and initializes a local git repository. ```bash mkdir do-alt-gas-demo && cd do-alt-gas-demo && git init ``` -------------------------------- ### Transaction Journey Event JSON Structures Source: https://docs.scroll.io/en/developers/guides/checking-transaction-journey Example JSON objects representing different transaction states (Queued, Pending, Executed, Dropped) returned by the API to describe state transitions. ```json { "event_type": "queued", "timestamp": "2025-06-19T17:22:23.27Z", "node_type": "l2geth-bootnode-0", "event_detail": "Transaction added to future queue" } ``` ```json { "event_type": "pending", "timestamp": "2025-06-19T17:22:23.27Z", "node_type": "l2geth-bootnode-0", "event_detail": "Transaction promoted from future queue to pending pool" } ``` ```json { "event_type": "executed", "timestamp": "2025-06-19T17:22:23.299Z", "node_type": "l2geth-mpt-signer-1", "event_detail": "Transaction successfully included in a block and executed on-chain" } ``` ```json { "event_type": "dropped", "timestamp": "2025-06-19T17:22:23.352Z", "node_type": "l2geth-bootnode-2", "event_detail": "Transaction rejected (validation failed)" } ``` -------------------------------- ### Rollup Node Finalize Timeout Batch Error Log Source: https://docs.scroll.io/en/sdk/operation/troubleshooting Example log for a rollup node failing to finalize a timeout batch. This error, 'failed to get batch status, errCode: 40001', typically arises when insufficient L2 blocks have been generated. ```text ERROR[09-18|07:52:21.515|scroll-tech/rollup/internal/controller/relayer/l2_relayer.go:489] Failed to finalize timeout batch without proof index=1 hash=0x43b0e21561d60b052c14eeb53f04c4f797b6c1532fae207fcb03f7da3ea819dd err="failed to get batch status, errCode: 40001, errMsg: " ``` -------------------------------- ### Rollup Node Batch Finalization Error Log Source: https://docs.scroll.io/en/sdk/operation/troubleshooting Example log output for a 'Failed to finalize timeout batch without proof' error. This often indicates an issue with the chain monitor's Layer 2 'start block' being too low relative to the batch block. ```text ERROR[08-29|18:40:37.366|scroll-tech/rollup/internal/controller/relayer/l2_relayer.go:465] Failed to finalize timeout batch without proof ││ index=6 hash=0x05bc419ecb59e9566554ddb716ee4b69fbe3b103a84e1c714656190c5af5028c err="failed to get batch status, errCode: 40001, errMsg: " ││ WARN [08-29|18:40:52.273|scroll-tech/rollup/internal/controller/relayer/l2_relayer.go:506] failed to get batch status, please check chain_ ││ monitor api server batch_index=6 err="failed to get batch status, errCode: 40001, errMsg: " ``` -------------------------------- ### Install External Secrets Operator via Helm Source: https://docs.scroll.io/en/sdk/guides/digital-ocean-alt-gas-token Adds the External Secrets repository and installs the operator into the cluster to manage sensitive information securely. ```bash helm repo add external-secrets https://charts.external-secrets.io helm repo update helm install external-secrets external-secrets/external-secrets -n external-secrets --create-namespace ``` -------------------------------- ### Fund SDK Accounts via CLI Source: https://docs.scroll.io/en/sdk/guides/digital-ocean-alt-gas-token Commands to fund the Deployer and L1/L2 accounts with Sepolia ETH using the Scroll SDK helper tool. ```bash scrollsdk helper fund-accounts -i -f 2 scrollsdk helper fund-accounts -f 0.2 -l 1 scrollsdk helper fund-accounts -f 0.2 -l 2 ``` -------------------------------- ### Deploy Blockscout Explorer Source: https://docs.scroll.io/en/sdk/guides/digital-ocean-alt-gas-token Upgrades the Helm release for Blockscout using specific production values. Requires prior database initialization. ```bash helm upgrade -i blockscout blockscout --values blockscout/values/production.yaml ``` -------------------------------- ### Implement Steps Component in MDX Source: https://docs.scroll.io/en/article-components Demonstrates how to import and use the Steps component to create ordered, step-by-step instructions in MDX files. ```js import { Steps } from '@astrojs/starlight/components'; 1. Import the component into your MDX file 2. Wrap around your ordered list items ``` -------------------------------- ### GET /l2/unclaimed/withdrawals Source: https://docs.scroll.io/en/developers/l1-and-l2-bridging/the-scroll-messenger Retrieves unclaimed withdrawal information for a given address, which is necessary for relaying transactions from L2 to L1. ```APIDOC ## GET /l2/unclaimed/withdrawals ### Description Retrieves unclaimed withdrawal information for a given address. This data is required to finalize L2 to L1 transactions using the `relayMessageWithProof` function on the Scroll Messenger contract. ### Method GET ### Endpoint `/l2/unclaimed/withdrawals` ### Parameters #### Query Parameters - **address** (string) - Required - The EOA or contract address initiating the original transaction on L2, in EIP-55 checksum format. - **page** (integer) - Optional - The page number for pagination. Defaults to 1. - **page_size** (integer) - Optional - The number of results per page. Defaults to 10. ### Request Example ```bash https://sepolia-api-bridge-v2.scroll.io/api/l2/unclaimed/withdrawals?address=0x031407eaaffFB4f1EC2c999bE4477E52C81de3c5&page=1&page_size=10 ``` ### Response #### Success Response (200) - **errcode** (integer) - Error code, 0 indicates success. - **errmsg** (string) - Error message, empty if successful. - **data** (object) - Contains the withdrawal results. - **results** (array) - An array of withdrawal objects. - **hash** (string) - Transaction hash on L2. - **replay_tx_hash** (string) - Hash of the replay transaction, if any. - **refund_tx_hash** (string) - Hash of the refund transaction, if any. - **message_hash** (string) - Hash of the message. - **token_type** (integer) - Type of the token. - **token_ids** (array) - Array of token IDs (for ERC721). - **token_amounts** (array) - Array of token amounts (for ERC20). - **message_type** (integer) - Type of the message. - **l1_token_address** (string) - Address of the token on L1. - **l2_token_address** (string) - Address of the token on L2. - **block_number** (integer) - Block number on L2 where the transaction was included. - **tx_status** (integer) - Status of the transaction. - **counterpart_chain_tx** (object) - Information about the corresponding transaction on the counterpart chain. - **hash** (string) - Transaction hash. - **block_number** (integer) - Block number. - **claim_info** (object) - Information needed to claim the transaction on L1. - **from** (string) - Sender address on L2. - **to** (string) - Recipient address on L2. - **value** (string) - Value transferred. - **nonce** (string) - Nonce of the message. - **message** (string) - The message payload. - **proof** (object) - Merkle proof details. - **batch_index** (string) - The index of the batch containing the transaction. - **merkle_proof** (string) - The Merkle inclusion proof. - **claimable** (boolean) - Indicates if the transaction is claimable on L1. - **block_timestamp** (integer) - Timestamp of the block on L2. - **batch_deposit_fee** (string) - The deposit fee for the batch. - **total** (integer) - Total number of unclaimed withdrawals. #### Response Example ```json { "errcode": 0, "errmsg": "", "data": { "results": [ { "hash": "0xd56f873c953e798521020d8b6885e7509069fcf0e12bdb1227b840c2d29c6645", "replay_tx_hash": "", "refund_tx_hash": "", "message_hash": "0x65f7d787ff0a3fe7f42b603650afc9c0906f44cd913d52a9e37d1defbe526b6e", "token_type": 1, "token_ids": [], "token_amounts": [ "0" ], "message_type": 2, "l1_token_address": "", "l2_token_address": "", "block_number": 11517097, "tx_status": 0, "counterpart_chain_tx": { "hash": "", "block_number": 0 }, "claim_info": { "from": "0x707e55a12557E89915D121932F83dEeEf09E5d70", "to": "0xC96dde523FB7aB544DCe99F78C10272502452Ae7", "value": "0", "nonce": "388896", "message": "0x32e43a11", "proof": { "batch_index": "113627", "merkle_proof": "0x595e51b1e616792354ed5337d73ab55e8cb62fec3d5b9254e0c5549a6359e07cad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5b4c11951957c6f8f642c4af61cd6b24640fec6dc7fc607ee8206a99e92410d3021ddb9a356815c3fac1026b6dec5df3124afbadb485c9ba5a3e3398a04b7ba85e58769b32a1beaf1ea27375a44095a0d1fb664ce2dd358e7fcbfb78c26a19344572901eb2c02c80041fe5b5524ab76baafbca7c7bcad9fcbd8a8f492f14ccfeb887c22bd8750d34016ac3c66b5ff102dacdd73f6b014e710b51e8022af9a1968ffd70157e48063fc33c97a050f7f640233bf646cc98d9524c6b92bcf3ab56f83936fdf2b4de30e14ed4e80b8ad6789e4da1c12dc0da39b471117d24f5be50dd072551f0d41ffe8137346039d94d98dc6e569c87f338c68fa23139bafe238eb1308610d4a9b148fc1955128d4ce7874b09783cef2e7750f7ea24f6090c9ce47f33cf25ca5e16a1207b4a50fda2be1d3b5c807b281e4683cc6d6315cf95b9ade8641defcb32372f1c126e398ef7a1ef973d30ca636d922d10ae577c73bc4fe92699225f30c0c2e9d6727bceb256d", "claimable": true }, "block_timestamp": 1755015985, "batch_deposit_fee": "" } } ], "total": 1 } } ``` ``` -------------------------------- ### Implement Tip Callout Source: https://docs.scroll.io/en/article-components Shows the syntax for creating a tip callout block using the native MDX syntax. ```markdown :::tip[Did you know?] Astro helps you build faster websites with “Islands Architecture”. ::: ``` -------------------------------- ### Configure Scroll Devnet for Faster Finalization Source: https://docs.scroll.io/en/sdk/guides/devnet-deployment This snippet shows how to modify the config.toml file to speed up L1 finalization on the devnet. After changing these values, 'make config' must be run again before installing. ```bash # In config.toml [rollup] section: # MAX_BLOCK_IN_CHUNK: 3 # MAX_BATCH_IN_BUNDLE: 3 # TEST_ENV_MOCK_FINALIZE_TIMEOUT_SEC: 10 make config ``` -------------------------------- ### Generate Configuration Files with Scroll SDK Source: https://docs.scroll.io/en/sdk/guides/digital-ocean-alt-gas-token Generates configuration files for each service based on the values in config.toml. This step involves prompts for L1 height at contract deployment and a unique deployment salt. It simulates contract deployment to obtain contract addresses and creates config and secrets files in ./values and ./secrets directories respectively. ```bash scrollsdk setup configs ``` -------------------------------- ### Generate Keystore Files with Scroll SDK Source: https://docs.scroll.io/en/sdk/guides/digital-ocean-alt-gas-token Generates private keys for sequencer signers and SDK accounts. It can also set up backup sequencers and pre-defined bootnodes. Requires the owner wallet address of a multi-sig or generates a new one for testing. Ensure the private key is saved securely and not in config.toml. ```bash scrollsdk setup gen-keystore ``` -------------------------------- ### Query Transaction Journey via API Source: https://docs.scroll.io/en/developers/guides/checking-transaction-journey Uses a cURL request to query the status and lifecycle events of specific transaction hashes from the Scroll monitoring service. ```bash curl -X POST "https://venus.scroll.io/v1/tx/journeys" \ -H "Content-Type: application/json" \ -d '{ "tx_hashes": [ "0xf8a92194cb21dcfaa2efe3230c5d5c80f7e71361575eff33cafa6ebc9eb34357" ] }' | jq ``` -------------------------------- ### Deploy Greeter Contract (Solidity) Source: https://docs.scroll.io/en/developers/guides/scroll-messenger-cross-chain-interaction The Greeter contract is a simple Solidity contract with a greeting string that can be updated. This contract serves as the target for cross-chain function calls. ```solidity // SPDX-License-Identifier: MIT pragma solidity ^0.8.16; // This Greeter contract will be interacted with through the ScrollMessenger across the bridge contract Greeter { string public greeting = "Hello World!"; // This function will be called by executeFunctionCrosschain on the Operator Smart Contract function setGreeting(string memory greeting_) public { greeting = greeting_; } } ```