### Linera Server Output Example (Bash) Source: https://linera.dev/operators/testnets/manual-installation This example shows the output of the `linera-server generate` command, including the successful writing of the server configuration and the generated public and account keys. ```bash $ linera-server generate --validators /path/to/validator/configuration.toml 2024-07-01T16:51:32.881519Z INFO linera_server: Wrote server config server.json 02a580bbda90f0ab10f015422d450b3e873166703af05abd77d8880852a3504e4d,009b2ecc5d39645e81ff01cfe4ceeca5ec207d822762f43b35ef77b2367666a7f8 ``` -------------------------------- ### Install Node.js on Ubuntu Source: https://linera.dev/developers/frontend/setup This command installs Node.js on an Ubuntu system, which is a prerequisite for using tools like `http-server` for serving web content. ```bash sudo apt install nodejs ``` -------------------------------- ### Linera Devnet Wallet and Storage Configuration Source: https://linera.dev/operators/devnets/kind Example environment variables provided after launching the devnet, which are used to configure the Linera wallet and storage for interacting with the local network. ```Shell export LINERA_WALLET="/tmp/.tmpIOelqk/wallet_0.json" export LINERA_STORAGE="rocksdb:/tmp/.tmpIOelqk/client_0.db" ``` -------------------------------- ### Clone Linera Protocol Repository Source: https://linera.dev/developers/getting_started/installation Clones the official Linera Protocol repository from GitHub and checks out the specified release branch (`testnet_conway`). ```Shell git clone https://github.com/linera-io/linera-protocol.git cd linera-protocol git checkout -t origin/testnet_conway # Current release branch ``` -------------------------------- ### Start Local Development Network with Faucet Source: https://linera.dev/developers/getting_started/hello_linera Starts a local Linera validator network with a default number of shards and a faucet service running on port 8080. This command is used to set up a private testing environment. ```bash linera net up --with-faucet --faucet-port 8080 ``` -------------------------------- ### Install Linera Toolchain from Source using Cargo Source: https://linera.dev/developers/getting_started/installation Installs the Linera toolchain locally from source code using Cargo. This method is useful for development and debugging purposes. ```Shell cargo install --locked --path linera-storage-service cargo install --locked --path linera-service ``` -------------------------------- ### Start Linera Service Mode Source: https://linera.dev/developers/getting_started/hello_linera Starts the Linera client in service mode, exposing a GraphQL API on port 8080. This allows interaction with deployed applications and network state. ```bash linera service --port 8080 ``` -------------------------------- ### Install Linera Binaries using Cargo Source: https://linera.dev/developers/getting_started/installation Installs the `linera-storage-service` and `linera-service` binaries using Cargo, the Rust package manager. These binaries are essential for operating Linera. ```Shell cargo install --locked linera-storage-service@0.15.0 cargo install --locked linera-service@0.15.0 ``` -------------------------------- ### Install Linera Client via npm Source: https://linera.dev/developers/frontend/setup This command installs a specific version of the Linera client library from the Node package repository into the project's `node_modules` directory. ```bash npm install @linera/client@0.14.0 ``` -------------------------------- ### Install Protobuf Compiler (Protoc) on Linux Source: https://linera.dev/developers/getting_started/installation Downloads and installs the Protocol Buffers compiler (protoc) for Linux x86_64. Protoc is used for compiling .proto files into code for various languages. ```Shell curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v21.11/protoc-21.11-linux-x86_64.zip unzip protoc-21.11-linux-x86_64.zip -d $HOME/.local export PATH="$HOME/.local/bin:$PATH" ``` -------------------------------- ### Launch Linera Devnet with Kind Source: https://linera.dev/operators/devnets/kind Starts a local Linera development network using Kind and Kubernetes. This command builds Docker images from the Linera source and sets up the cluster. ```Shell linera net up --kubernetes ``` -------------------------------- ### Install Protobuf Compiler (Protoc) Source: https://linera.dev/operators/devnets/kind Downloads and installs the Protocol Buffers compiler (protoc) for Linux x86_64, which is required for handling Protocol Buffers definitions used by Linera. ```Shell curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v21.11/protoc-21.11-linux-x86_64.zip unzip protoc-21.11-linux-x86_64.zip -d $HOME/.local export PATH="$PATH:$HOME/.local/bin" ``` -------------------------------- ### Install Linera from Source Source: https://linera.dev/print Installs the Linera storage service and Linera service locally from the cloned source code using Cargo. This is an alternative to installing pre-compiled binaries. ```bash cargo install --locked --path linera-storage-service cargo install --locked --path linera-service ``` -------------------------------- ### Install Rust and Wasm Source: https://linera.dev/operators/devnets/kind Installs the Rust programming language toolchain and the WebAssembly target, which are prerequisites for building and running Linera components. ```Shell curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh rustup target add wasm32-unknown-unknown ``` -------------------------------- ### Linera Devnet Wallet and Storage Configuration Source: https://linera.dev/print Example environment variables provided after starting the devnet, which configure the Linera wallet and storage backend for interacting with the local network. ```Shell export LINERA_WALLET="/tmp/.tmpIOelqk/wallet_0.json" export LINERA_STORAGE="rocksdb:/tmp/.tmpIOelqk/client_0.db" ``` -------------------------------- ### Interact with Linera Devnet (Sync Balance) Source: https://linera.dev/operators/devnets/kind Demonstrates interacting with the local Linera devnet by synchronizing chain information and querying the balance. It also notes a deprecated command and suggests an alternative. ```Shell $linera sync-balance 2024-05-21T22:30:12.061199Z INFO linera: Synchronizing chain information and querying the local balance 2024-05-21T22:30:12.061218Z WARN linera: This command is deprecated. Use `linera sync && linera query-balance` instead. 2024-05-21T22:30:12.065787Z INFO linera::client_context: Saved user chain states 2024-05-21T22:30:12.065792Z INFO linera: Operation confirmed after 4 ms 1000000. ``` -------------------------------- ### Initialize Wallet and Request Chain from Testnet Source: https://linera.dev/developers/getting_started/hello_linera Initializes a Linera developer wallet and requests a new microchain from the specified Testnet faucet. Ensure your Linera toolchain is compatible with the Testnet. ```bash linera wallet init --faucet https://faucet.testnet-conway.linera.net linera wallet request-chain --faucet https://faucet.testnet-conway.linera.net ``` -------------------------------- ### Configure Rust Toolchain for Linera Source: https://linera.dev/developers/getting_started/installation Specifies the Rust toolchain version, components (clippy, rustfmt, rust-src), and targets (wasm32-unknown-unknown) required for Linera development. ```TOML [toolchain] channel = "1.86.0" components = [ "clippy", "rustfmt", "rust-src" ] targets = [ "wasm32-unknown-unknown" ] profile = "minimal" ``` -------------------------------- ### Start Linera Validator with Docker Compose (Bash) Source: https://linera.dev/operators/testnets/manual-installation This command starts the Linera validator deployment using Docker Compose in detached mode. It assumes the genesis and server configurations are available in the `docker` directory. ```bash cd docker && docker compose up -d ``` -------------------------------- ### Install Linera Service with Kubernetes Feature Source: https://linera.dev/operators/devnets/kind Installs the Linera service using Cargo, enabling the 'kubernetes' feature, which is necessary for running Linera with Kind. ```Shell cargo install --locked --path linera-service --features kubernetes ``` -------------------------------- ### Start Local Linera Development Network Source: https://linera.dev/print Starts a local Linera development network with a validator, default shards, and a faucet service running on port 8080. ```bash linera net up --with-faucet --faucet-port 8080 ``` -------------------------------- ### Add Linera SDK as a Library using Cargo Source: https://linera.dev/developers/getting_started/installation Adds the `linera-sdk` crate as a dependency to your Rust project using Cargo. This allows you to use the Linera SDK for building applications. ```Shell cargo add linera-sdk@0.15.0 ``` -------------------------------- ### Build Counter Application Source: https://linera.dev/print Compiles the 'counter' application example from the Linera protocol repository using Cargo in release mode, targeting the Wasm 32-unknown-unknown platform. ```bash cd examples/counter && cargo build --release --target wasm32-unknown-unknown ``` -------------------------------- ### Start Local Devnet with Kind Source: https://linera.dev/print Launches a local development network using 'kind' and Kubernetes. This command builds Docker images from the Linera source and sets up the cluster. ```Shell linera net up --kubernetes ``` -------------------------------- ### Interact with Linera Devnet (Query Balance) Source: https://linera.dev/print Demonstrates querying the balance of an account on a local Linera devnet using the `linera` binary. It includes example output showing the synchronization and balance retrieval process. ```Bash linera --wallet wallet.json --storage rocksdb:linera.db query-balance ``` -------------------------------- ### Query Deployed Applications (GraphQL) Source: https://linera.dev/developers/getting_started/hello_linera Uses GraphQL to query the list of applications deployed on a specific chain ID. Replace '...' with your actual chain ID obtained from `linera wallet show`. ```graphql query { applications(chainId: "...") { id description link } } ``` -------------------------------- ### Install Linera Binaries Source: https://linera.dev/print Installs the Linera storage service and Linera service binaries from crates.io using Cargo. It specifies version 0.15.0 for compatibility with the current Testnet. ```bash cargo install --locked linera-storage-service@0.15.0 cargo install --locked linera-service@0.15.0 ``` -------------------------------- ### Request a New Chain from Faucet Source: https://linera.dev/print Initializes a wallet and requests a new chain directly from the faucet, simplifying the setup process on test networks. ```bash linera --wallet wallet2.json --storage rocksdb:linera2.db wallet init --faucet $FAUCET_URL linera --wallet wallet2.json --storage rocksdb:linera2.db wallet request-chain --faucet $FAUCET_URL ``` -------------------------------- ### Query Counter Application Value (GraphQL) Source: https://linera.dev/developers/getting_started/hello_linera Queries the current value of the counter application. This assumes the application has been deployed and initialized with a value, typically '42' in this example. ```graphql query { value } ``` -------------------------------- ### Set PATH for Debug Binaries Source: https://linera.dev/developers/getting_started/installation Configures the system's PATH environment variable to include the directory containing locally compiled debug binaries for Linera. ```Shell export PATH="$PWD/target/debug:$PATH" ``` -------------------------------- ### Install Protoc on Linux Source: https://linera.dev/print Steps to download and install the Protobuf compiler (protoc) on a Linux system, a required dependency for the Linera toolchain. ```Shell curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v21.11/protoc-21.11-linux-x86_64.zip unzip protoc-21.11-linux-x86_64.zip -d $HOME/.local export PATH="$HOME/.local/bin:$PATH" ``` -------------------------------- ### Clone Linera Repository and Checkout Branch Source: https://linera.dev/operators/devnets/kind Clones the Linera protocol repository from GitHub and checks out a specific release branch ('testnet_conway') for development. ```Shell git clone https://github.com/linera-io/linera-protocol.git cd linera-protocol git checkout -t origin/testnet_conway # Current release branch ``` -------------------------------- ### Start Linera Node Service Source: https://linera.dev/print Starts the Linera node service, which executes blocks, exposes a GraphQL API and IDE, and listens for validator notifications. ```bash linera service ``` -------------------------------- ### Install Node.js on Ubuntu Source: https://linera.dev/print This command installs Node.js on an Ubuntu system, which is a prerequisite for using tools like `http-server` for serving web applications. ```bash sudo apt install nodejs ``` -------------------------------- ### Install Linera Toolchain with Kubernetes Feature Source: https://linera.dev/print Installs the Linera toolchain using Cargo, enabling the 'kubernetes' feature. This command should be run from the root of the cloned linera-protocol repository. ```Shell cargo install --locked --path linera-service --features kubernetes ``` -------------------------------- ### Verify Linera Validator Installation Source: https://linera.dev/print Verifies the Linera validator installation by initializing a wallet, requesting a chain from the faucet, and querying the validator's RPC API. It checks the API hashes and the genesis configuration hash. ```shell $ linera wallet init --faucet https://faucet.testnet-conway.linera.net $ linera wallet request-chain --faucet https://faucet.testnet-conway.linera.net $ linera query-validator grpcs:my-domain.com:443 ``` -------------------------------- ### Initialize Linera Wallet and Request Chain Source: https://linera.dev/operators/testnets/verify-installation Initializes a Linera wallet and requests a chain from a specified faucet. This is a prerequisite for interacting with the Linera network. ```bash $ linera wallet init --faucet https://faucet.testnet-conway.linera.net $ linera wallet request-chain --faucet https://faucet.testnet-conway.linera.net ``` -------------------------------- ### Synchronize Chain and Query Balance Source: https://linera.dev/developers/getting_started/hello_linera Synchronizes the local chain with the network and displays the current balance of the default chain. A positive balance indicates successful synchronization. ```bash linera sync linera query-balance ``` -------------------------------- ### Download Genesis Configuration (Bash) Source: https://linera.dev/operators/testnets/manual-installation This command downloads the genesis configuration file required for validators to function. The genesis file defines the initial network state, including the committee of validators and chains. ```bash wget "https://storage.googleapis.com/linera-io-dev-public/testnet-conway/genesis.json" ``` -------------------------------- ### Initialize Linera Wallet and Request Chain Source: https://linera.dev/developers/core_concepts/wallets Initializes a Linera wallet and requests a new chain from a specified faucet URL. This is the first step for developers to start interacting with the Linera network. ```bash linera wallet init --faucet $FAUCET_URL linera wallet request-chain --faucet $FAUCET_URL ``` -------------------------------- ### Install Rust and Wasm Source: https://linera.dev/developers/getting_started/installation Installs the Rust programming language and the WebAssembly target for cross-compilation. This is a prerequisite for developing Linera applications. ```Shell curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh rustup target add wasm32-unknown-unknown ``` -------------------------------- ### Initialize Linera Client Source: https://linera.dev/print This snippet shows the initialization of the Linera client, which involves downloading the WebAssembly binary, creating memory, and initializing it. ```javascript await linera.default(); ``` -------------------------------- ### Vite Configuration for Linera Client and Web Workers Source: https://linera.dev/print This Vite configuration example demonstrates how to set up a project that uses the Linera client library. It specifies multiple entry points for the build (`index.html` and `@linera/client`), preserves entry point signatures for correct Web Worker referencing, and excludes the Linera client from dependency optimization. ```typescript export default defineConfig({ build: { rollupOptions: { input: { index: 'index.html', linera: '@linera/client', }, preserveEntrySignatures: 'strict', }, }, optimizeDeps: { exclude: [ '@linera/client', ], }, }) ``` -------------------------------- ### Initialize a New Linera Wallet Source: https://linera.dev/print Initializes a new Linera wallet using a specified JSON file and storage backend, optionally connecting to a faucet. ```bash linera --wallet wallet2.json --storage rocksdb:linera2.db wallet init --faucet $FAUCET_URL ``` -------------------------------- ### Create Wallet and Request Chain from Faucet (Linera CLI) Source: https://linera.dev/developers/core_concepts/wallets A shortcut for test networks to create a new wallet and request a chain directly from the faucet. ```bash linera --wallet wallet2.json --storage rocksdb:linera2.db wallet init --faucet $FAUCET_URL linera --wallet wallet2.json --storage rocksdb:linera2.db wallet request-chain --faucet $FAUCET_URL ``` -------------------------------- ### Create New Linera Project Source: https://linera.dev/print Initializes a new Linera project with the necessary scaffolding and files for building a Web3 application. This command sets up the project structure, including configuration files and source code directories. ```Shell linera project new my-counter ``` -------------------------------- ### Vite Configuration for Linera Client Source: https://linera.dev/developers/frontend/setup This JavaScript configuration is for Vite, a build tool. It defines multiple entry points for the build (`index.html` and `@linera/client`), ensures entry point signatures are preserved, and excludes the Linera client from dependency optimization to correctly handle its integration. ```javascript export default defineConfig({ build: { rollupOptions: { input: { index: 'index.html', linera: '@linera/client', }, preserveEntrySignatures: 'strict', }, }, optimizeDeps: { exclude: [ '@linera/client', ], }, }) ``` -------------------------------- ### Linera Service Trait Implementation - Parameters Source: https://linera.dev/developers/backend/service Implements the `Service` trait for `CounterService`, specifying the `Parameters` associated type. In this example, the unit type `()` is used as the parameters are not utilized. ```rust impl Service for CounterService { type Parameters = (); // ... } ``` -------------------------------- ### Publish and Create Counter Application Source: https://linera.dev/developers/getting_started/hello_linera Publishes the compiled Wasm bytecode for the counter application's contract and service, and creates an instance of the application on the network. It takes the bytecode locations and JSON-encoded initialization arguments. ```bash linera publish-and-create \ ../target/wasm32-unknown-unknown/release/counter_{contract,service}.wasm \ --json-argument "42" ``` -------------------------------- ### Configure Linera Validator (TOML) Source: https://linera.dev/operators/testnets/manual-installation This TOML file configures a Linera validator, specifying server details, ports, and shard configurations. It serves as the primary input for validator setup. ```toml server_config_path = "server.json" host = "" # e.g. my-subdomain.my-domain.net port = 19100 metrics_host = "proxy" metrics_port = 21100 internal_host = "proxy" internal_port = 20100 [external_protocol] Grpc = "ClearText" # Depending on your load balancer you may need "Tls" here. [internal_protocol] Grpc = "ClearText" # Adjust depending on the number of shards you have [[shards]] host = "docker-shard-1" port = 19100 metrics_port = 21100 [[shards]] host = "docker-shard-2" port = 19100 metrics_port = 21100 [[shards]] host = "docker-shard-3" port = 19100 metrics_port = 21100 [[shards]] host = "docker-shard-4" port = 19100 metrics_port = 21100 ``` -------------------------------- ### Create Linera Project Source: https://linera.dev/developers/backend/creating_a_project Initializes a new Linera project with the specified name. This command generates the project's directory structure and essential configuration files, including the manifest, application ABI, state, contract, and service definitions. ```bash linera project new my-counter ``` -------------------------------- ### Caddy Configuration for Linera Validator Source: https://linera.dev/operators/testnets/requirements This Caddy configuration forwards requests to a Linera validator running on localhost:19100. It utilizes HTTP/2 for communication and sets appropriate timeouts for read and write operations. The configuration also includes the 'Access-Control-Allow-Origin' header to enable cross-origin requests. ```caddy example.com { reverse_proxy localhost:19100 { transport http { versions h2c read_timeout 10m write_timeout 10m } header Access-Control-Allow-Origin * } } ``` -------------------------------- ### ScyllaDB Kernel Parameter Tuning Source: https://linera.dev/operators/testnets/requirements These commands adjust the maximum number of asynchronous I/O events allowed in kernel contexts, a requirement for optimal ScyllaDB performance. The first command applies the setting temporarily, while the second makes it persistent across reboots by modifying sysctl configuration. ```bash echo 1048576 > /proc/sys/fs/aio-max-nr ``` ```bash sudo sysctl -p /etc/sysctl.conf ``` -------------------------------- ### Nginx Configuration for Linera Validator Source: https://linera.dev/operators/testnets/requirements This Nginx configuration is designed to proxy gRPC traffic to a Linera validator running on port 19100. It supports HTTP/2, TLS termination, and includes necessary headers for web client compatibility, including CORS. The configuration also sets timeouts for gRPC and client connections. ```nginx server { listen 80 http2; location / { grpc_pass grpc://127.0.0.1:19100; } } server { listen 443 ssl http2; server_name ; # e.g. my-subdomain.my-domain.net # SSL certificates ssl_certificate ; # e.g. /etc/letsencrypt/live/my-subdomain.my-domain.net/fullchain.pem ssl_certificate_key ; # e.g. /etc/letsencrypt/live/my-subdomain.my-domain.net/privkey.pem; # Proxy traffic to the service running on port 19100. location / { grpc_pass grpc://127.0.0.1:19100; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Access-Control-Allow-Origin *; } keepalive_timeout 10m 60s; grpc_read_timeout 10m; grpc_send_timeout 10m; client_header_timeout 10m; client_body_timeout 10m; } ``` -------------------------------- ### Start Linera Validator with Docker Compose Source: https://linera.dev/print Starts the Linera validator deployment using Docker Compose. This command should be run from the `docker` directory and starts the services in detached mode. ```shell cd docker && docker compose up -d ``` -------------------------------- ### Switch Linera Wallets and Storage Source: https://linera.dev/print Demonstrates how to switch between different Linera wallets and storage configurations using command-line options or environment variables. This allows managing multiple wallet states and database backends. ```bash linera --wallet wallet2.json --storage rocksdb:linera2.db export LINERA_STORAGE=$PWD/wallet2.json export LINERA_WALLET=$PWD/wallet2.json linera --with-wallet $I ``` -------------------------------- ### Install Rust and Wasm Source: https://linera.dev/print Commands to install the Rust programming language and the WebAssembly target, which are prerequisites for the Linera toolchain. ```Shell curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh rustup target add wasm32-unknown-unknown ``` -------------------------------- ### Install Protoc on Linux Source: https://linera.dev/print Downloads and installs the Protobuf compiler (protoc) for Linux x86_64. This is required for protocol buffer compilation. ```Shell curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v21.11/protoc-21.11-linux-x86_64.zip unzip protoc-21.11-linux-x86_64.zip -d $HOME/.local export PATH="$PATH:$HOME/.local/bin" ``` -------------------------------- ### Install Rust and Wasm Source: https://linera.dev/print Installs Rust and the WebAssembly target using the official Rustup script. This is a prerequisite for the Linera toolchain. ```Shell curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh rustup target add wasm32-unknown-unknown ``` -------------------------------- ### Initialize Developer Wallet and Request Chain (Testnet) Source: https://linera.dev/print Initializes a Linera developer wallet and requests a new microchain with tokens from the Testnet's faucet service. Requires a compatible Linera toolchain. ```bash linera wallet init --faucet https://faucet.testnet-conway.linera.net linera wallet request-chain --faucet https://faucet.testnet-conway.linera.net ``` -------------------------------- ### Basic HTML UI for Linera Counter Source: https://linera.dev/developers/frontend/setup This HTML file sets up the basic user interface for the Linera counter application, including elements to display the chain ID, the click count, and a button to increment the count. ```html Counter

Chain: requesting chain…

Clicks: 0

``` -------------------------------- ### Initialize Linera Wallet and Request Chain Source: https://linera.dev/print This snippet shows the basic commands to initialize a Linera wallet and request a new chain using the `linera` CLI. It requires a faucet URL to be set as an environment variable. ```bash linera wallet init --faucet $FAUCET_URL linera wallet request-chain --faucet $FAUCET_URL ``` -------------------------------- ### Interact with Linera Devnet (Sync) Source: https://linera.dev/print Shows how to synchronize chain information with a local Linera devnet using the `linera` binary. It specifies the wallet and storage configuration. ```Bash linera --wallet wallet.json --storage rocksdb:linera.db sync ``` -------------------------------- ### Initialize Wallet for Local Network Source: https://linera.dev/developers/getting_started/hello_linera Initializes a Linera developer wallet and requests a new microchain from the local faucet service running at http://localhost:8080. Note that wallets are network-specific and may need re-creation upon restarting the local network. ```bash linera wallet init --faucet http://localhost:8080 linera wallet request-chain --faucet http://localhost:8080 ``` -------------------------------- ### Start Linera Service Source: https://linera.dev/print Starts the Linera client service on port 8080 to expose local APIs for interacting with applications on the network. This is a prerequisite for querying application state. ```bash linera service --port 8080 ``` -------------------------------- ### Bash Initialize Linera Wallet for Testnet Source: https://linera.dev/print Commands to initialize a Linera wallet for a testnet and request a new chain from the faucet. ```bash linera wallet init --faucet https://faucet.testnet-conway.linera.net linera wallet request-chain --faucet https://faucet.testnet-conway.linera.net ``` -------------------------------- ### Install Linera Client Package Source: https://linera.dev/print This command installs a specific version of the Linera client library from the Node Package Repository (npm). This library provides the JavaScript API to interact with Linera applications. ```bash npm install @linera/client@0.14.0 ``` -------------------------------- ### Initialize Linera Client Source: https://linera.dev/developers/frontend/interactivity This code initializes the Linera client by downloading the WebAssembly binary, creating memory, and initializing it. This is a prerequisite for interacting with the Linera network. ```javascript await linera.default(); ``` -------------------------------- ### Pledge Mutation in GraphQL Source: https://linera.dev/developers/backend/composition An example GraphQL mutation to pledge tokens to a crowd-funding application. It specifies the owner and the amount to be pledged. ```graphql mutation { pledge(owner: "User:841…6c0", amount: "10") } ``` -------------------------------- ### Get Application Backend Source: https://linera.dev/print This snippet shows how to obtain an object representing the application backend by calling the `client.frontend().application()` method with the application ID. ```javascript const backend = await client.frontend().application(COUNTER_APP_ID); ``` -------------------------------- ### Create Wallet and Claim Chain Source: https://linera.dev/developers/frontend/interactivity This snippet demonstrates how to create a new Linera wallet using the testnet faucet, claim a new chain, and initialize a client with this wallet. It also updates a UI element with the new chain ID. ```javascript const faucet = await new linera.Faucet( 'https://faucet.testnet-conway.linera.net', ); const wallet = await faucet.createWallet(); const client = await new linera.Client(wallet); document.getElementById('chain-id').innerText = await faucet.claimChain(client); ```