# Table of Contents - [Unknown](#unknown) - [Surf's up | Surfpool Docs](#surf-s-up-surfpool-docs) - [Getting Started | Surfpool Docs](#getting-started-surfpool-docs) - [Terminal UI | Surfpool Docs](#terminal-ui-surfpool-docs) - [CLI Commands | Surfpool Docs](#cli-commands-surfpool-docs) - [Getting Started with IaC | Surfpool Docs](#getting-started-with-iac-surfpool-docs) - [Video Tutorials | Surfpool Docs](#video-tutorials-surfpool-docs) - [WebSocket RPC Methods | Surfpool Docs](#websocket-rpc-methods-surfpool-docs) - [Introducing Surfnet | Surfpool Docs](#introducing-surfnet-surfpool-docs) - [Cheatcodes | Surfpool Docs](#cheatcodes-surfpool-docs) - [SVM Addon Overview | Surfpool Docs](#svm-addon-overview-surfpool-docs) - [Language & Syntax | Surfpool Docs](#language-syntax-surfpool-docs) - [Network | Surfpool Docs](#network-surfpool-docs) - [SVM Signers | Surfpool Docs](#svm-signers-surfpool-docs) - [Accounts | Surfpool Docs](#accounts-surfpool-docs) - [Node Health | Surfpool Docs](#node-health-surfpool-docs) - [SVM Functions | Surfpool Docs](#svm-functions-surfpool-docs) - [Transactions | Surfpool Docs](#transactions-surfpool-docs) - [Admin | Surfpool Docs](#admin-surfpool-docs) - [SVM Actions | Surfpool Docs](#svm-actions-surfpool-docs) - [Standard Actions | Surfpool Docs](#standard-actions-surfpool-docs) - [Standard Library Overview | Surfpool Docs](#standard-library-overview-surfpool-docs) - [Standard Functions | Surfpool Docs](#standard-functions-surfpool-docs) - [Vercel Security Checkpoint](#vercel-security-checkpoint) - [Vercel Security Checkpoint](#vercel-security-checkpoint) --- # Unknown \# Surfpool - From Localnet to Mainnet > Drop-in replacement for solana-test-validator. Simulate programs locally using Mainnet accounts. Surfpool is a local Solana node that fetches accounts just-in-time as transactions are sent to the RPC endpoint. ## Quick Start \`\`\`bash # Install CLI curl -sL https://run.surfpool.run/ | bash # Start local network surfpool \`\`\` Dashboard: http://localhost:18488 ## Key Features - \*\*Mainnet Forking\*\*: Clone accounts, programs, and token balances from Mainnet - \*\*Cheatcodes\*\*: Powerful testing utilities for state manipulation - \*\*Infrastructure as Code\*\*: Define deployments using txtx DSL - \*\*Terminal UI\*\*: Real-time visibility into your local network - \*\*Full RPC Compatibility\*\*: Drop-in replacement for solana-test-validator ## CLI Commands \`\`\`bash surfpool start # Start Surfnet with TUI dashboard surfpool --help # Show all options \`\`\` Running \`surfpool\` from an Anchor or Solana program directory automatically spins up a network and scaffolds infrastructure-as-code to deploy the program(s). --- # Resources - Website: https://surfpool.run - Docs: https://docs.surfpool.run - GitHub: https://github.com/txtx/surfpool - Discord: https://discord.gg/rqXmWsn2ja --- # Surf's up | Surfpool Docs Surf's up ========= Surfpool is a drop-in replacement for solana-test-validator, purpose-built to offer the best possible experience for developers building on Solana. Surfpool is a drop-in replacement for `solana-test-validator`, purpose-built to offer the best possible experience for developers building on **Solana**. Its core feature is letting developers simulate their programs locally using Mainnet accounts fetched just in time. Surfpool also seamlessly introduces Infrastructure as Code into Anchor- or Pinocchio-based projects, enabling reproducible, auditable, and secure deployments to any Solana network—private or public. [Getting Started](https://docs.surfpool.run/#getting-started) -------------------------------------------------------------- [### Installation\ \ Get started by installing Surfpool on your system](https://docs.surfpool.run/toolchain/getting-started) [### Command Line\ \ Learn how to use the Surfpool CLI](https://docs.surfpool.run/toolchain/cli) [### Terminal UI\ \ Explore the interactive Terminal UI dashboard](https://docs.surfpool.run/toolchain/tui) [Surfnet RPC](https://docs.surfpool.run/#surfnet-rpc) ------------------------------------------------------ [### Introducing Surfnet\ \ Learn about Surfpool's local Solana network simulator](https://docs.surfpool.run/rpc/overview) [### Cheatcodes\ \ Powerful testing utilities for state manipulation](https://docs.surfpool.run/rpc/cheatcodes) [### WebSocket RPC\ \ Real-time subscriptions for blockchain state changes](https://docs.surfpool.run/rpc/websockets) [Infrastructure as Code](https://docs.surfpool.run/#infrastructure-as-code) ---------------------------------------------------------------------------- [### Getting Started with IaC\ \ Introduction to Infrastructure as Code in Surfpool](https://docs.surfpool.run/iac/getting-started) [### Language & Syntax\ \ Learn the txtx DSL for describing deployments](https://docs.surfpool.run/iac/language) [### SVM Addon\ \ Solana-specific functions, actions, and signers](https://docs.surfpool.run/iac/svm/overview) [Resources](https://docs.surfpool.run/#resources) -------------------------------------------------- * [Video Tutorials](https://docs.surfpool.run/resources/video-tutorials) - Surfpool 101 Series * [Discord](https://discord.gg/rqXmWsn2ja) - Join our community * [GitHub](https://github.com/txtx/surfpool) - View the source code [Getting Started\ \ This guide will get you all set up and ready to install Surfpool.](https://docs.surfpool.run/toolchain/getting-started) ### On this page [Getting Started](https://docs.surfpool.run/#getting-started) [Surfnet RPC](https://docs.surfpool.run/#surfnet-rpc) [Infrastructure as Code](https://docs.surfpool.run/#infrastructure-as-code) [Resources](https://docs.surfpool.run/#resources) --- # Getting Started | Surfpool Docs Toolchain Getting Started =============== This guide will get you all set up and ready to install Surfpool. The surfpool CLI can be installed using the install script or built from source. [Install Script](https://docs.surfpool.run/toolchain/getting-started#install-script) ------------------------------------------------------------------------------------- To install surfpool, open a terminal and run: curl -sL https://run.surfpool.run/ | bash [Install from Source](https://docs.surfpool.run/toolchain/getting-started#install-from-source) ----------------------------------------------------------------------------------------------- To compile the Surfpool binary from source, clone the surfpool repository. git clone https://github.com/txtx/surfpool.git Navigate to the new directory. cd surfpool Then, compile the binary. This command will compile the binary and store it in `~/.cargo/bin/surfpool`. cargo surfpool-install Finally, make sure that the `surfpool` binary is available on your PATH. This process will differ depending on your operating system. [Surf's up\ \ Surfpool is a drop-in replacement for solana-test-validator, purpose-built to offer the best possible experience for developers building on Solana.](https://docs.surfpool.run/) [CLI Commands\ \ Using the surfpool Command Line Interface (CLI)](https://docs.surfpool.run/toolchain/cli) ### On this page [Install Script](https://docs.surfpool.run/toolchain/getting-started#install-script) [Install from Source](https://docs.surfpool.run/toolchain/getting-started#install-from-source) --- # Terminal UI | Surfpool Docs Toolchain Terminal UI =========== Explore the interactive Terminal UI dashboard for Surfpool Surfpool includes an interactive Terminal UI dashboard that provides real-time visibility into your local Solana network. ![Terminal UI](https://docs.surfpool.run/_next/static/media/terminal.0d00222d.svg) [Keyboard Shortcuts](https://docs.surfpool.run/toolchain/tui#keyboard-shortcuts) --------------------------------------------------------------------------------- ![Keyboard Shortcuts](https://docs.surfpool.run/_next/static/media/keyboard.c60e8623.svg) [Video Tutorials](https://docs.surfpool.run/toolchain/tui#video-tutorials) --------------------------------------------------------------------------- Check out our [Surfpool 101 Series](https://www.youtube.com/playlist?list=PL0FMgRjJMRzO1FdunpMS-aUS4GNkgyr3T) on YouTube to learn more about using the Terminal UI and other Surfpool features. [CLI Commands\ \ Using the surfpool Command Line Interface (CLI)](https://docs.surfpool.run/toolchain/cli) [Introducing Surfnet\ \ Learn about Surfnet, Surfpool's local Solana network simulator and RPC API](https://docs.surfpool.run/rpc/overview) ### On this page [Keyboard Shortcuts](https://docs.surfpool.run/toolchain/tui#keyboard-shortcuts) [Video Tutorials](https://docs.surfpool.run/toolchain/tui#video-tutorials) --- # CLI Commands | Surfpool Docs Toolchain CLI Commands ============ Using the surfpool Command Line Interface (CLI) The `surfpool` CLI is used to start local Surfnets (Solana simulation networks), execute Runbooks, and manage cloud deployments. [surfpool start](https://docs.surfpool.run/toolchain/cli#surfpool-start) ------------------------------------------------------------------------- Starts a local Surfnet. If run in a Solana program directory, Surfpool automatically generates Runbooks to deploy your programs. surfpool start [OPTIONS] ### [Network Options](https://docs.surfpool.run/toolchain/cli#network-options) | Flag | Short | Description | Default | | --- | --- | --- | --- | | `--port` | `-p` | Simnet RPC port | `8899` | | `--ws-port` | `-w` | Simnet WebSocket port | `8900` | | `--host` | `-o` | Simnet host address | `127.0.0.1` | | `--slot-time` | `-t` | Slot time in milliseconds | `400` | | `--block-production-mode` | `-b` | Block production mode: `clock`, `transaction`, or `manual` | `clock` | | `--rpc-url` | `-u` | Datasource RPC URL (conflicts with `--network`) | \- | | `--network` | `-n` | Predefined network: `mainnet`, `devnet`, or `testnet` (conflicts with `--rpc-url`) | \- | | `--offline` | \- | Start without remote RPC client | `false` | ### [Deployment Options](https://docs.surfpool.run/toolchain/cli#deployment-options) | Flag | Short | Description | Default | | --- | --- | --- | --- | | `--manifest-file-path` | `-m` | Path to the manifest | `./txtx.yml` | | `--no-deploy` | \- | Disable auto deployments | `false` | | `--runbook` | `-r` | Runbook IDs to execute (repeatable) | `deployment` | | `--runbook-input` | `-i` | Inputs for runbooks (repeatable) | \- | | `--yes` | `-y` | Skip prompts, assume "yes" for all | `false` | | `--watch` | \- | Watch `target/deploy` and re-deploy when `.so` files change | `false` | | `--snapshot` | \- | Path to JSON snapshot file(s) to preload accounts (repeatable) | \- | ### [Airdrop Options](https://docs.surfpool.run/toolchain/cli#airdrop-options) | Flag | Short | Description | Default | | --- | --- | --- | --- | | `--airdrop` | `-a` | Pubkeys to airdrop tokens to (repeatable) | \- | | `--airdrop-amount` | `-q` | Amount of lamports to airdrop | `10000000000000` | | `--airdrop-keypair-path` | `-k` | Keypair paths to airdrop (repeatable) | `~/.config/solana/id.json` | ### [UI Options](https://docs.surfpool.run/toolchain/cli#ui-options) | Flag | Short | Description | Default | | --- | --- | --- | --- | | `--no-tui` | \- | Display logs instead of terminal UI dashboard | `false` | | `--no-studio` | \- | Disable Studio | `false` | | `--studio-port` | `-s` | Studio port | `18488` | ### [Logging & Profiling](https://docs.surfpool.run/toolchain/cli#logging--profiling) | Flag | Short | Description | Default | | --- | --- | --- | --- | | `--log-level` | `-l` | Log level: `trace`, `debug`, `info`, `warn`, `error`, `none` | `info` | | `--log-path` | \- | Directory for simnet logs | `.surfpool/logs` | | `--disable-instruction-profiling` | \- | Disable instruction profiling | `false` | | `--max-profiles` | `-c` | Max transaction profiles held in memory | `200` | | `--log-bytes-limit` | \- | Max bytes allowed in transaction logs (0 = unlimited) | `10000` | ### [Database Options](https://docs.surfpool.run/toolchain/cli#database-options) | Flag | Short | Description | Default | | --- | --- | --- | --- | | `--db` | \- | Surfnet database URL for persistence (`:memory:`, `.sqlite` file, or postgres URL) | \- | | `--surfnet-id` | \- | Unique ID for this surfnet instance (isolates database storage) | `default` | | `--subgraph-db` | `-d` | Subgraph database URL (sqlite `:memory:` or postgres) | `:memory:` | ### [Plugin & Feature Options](https://docs.surfpool.run/toolchain/cli#plugin--feature-options) | Flag | Short | Description | Default | | --- | --- | --- | --- | | `--geyser-plugin-config` | `-g` | Geyser plugin config JSON files to load (repeatable) | \- | | `--feature` | `-f` | Enable specific SVM features (repeatable) | \- | | `--disable-feature` | \- | Disable specific SVM features (repeatable) | \- | | `--features-all` | \- | Enable all SVM features (overrides mainnet defaults) | `false` | ### [Compatibility & CI](https://docs.surfpool.run/toolchain/cli#compatibility--ci) | Flag | Short | Description | Default | | --- | --- | --- | --- | | `--ci` | \- | CI mode: disables profiling, studio, tui; sets log level to none | `false` | | `--daemon` | \- | Start as background process (Linux only) | `false` | | `--legacy-anchor-compatibility` | \- | Apply defaults for Anchor test suite compatibility | `false` | | `--anchor-test-config-path` | \- | Path to `Test.toml` test suite files (repeatable) | \- | ### [Examples](https://docs.surfpool.run/toolchain/cli#examples) Start with default settings: surfpool start Start with a specific datasource network and custom slot time: surfpool start --network mainnet --slot-time 200 Start in CI mode: surfpool start --ci Start with airdrops and watch mode: surfpool start -a MyPubkey123 --watch * * * [surfpool run](https://docs.surfpool.run/toolchain/cli#surfpool-run) --------------------------------------------------------------------- Executes a Runbook. Can run a `.tx` file directly or reference a runbook declared in a `txtx.yml` manifest. surfpool run [OPTIONS] ### [Arguments](https://docs.surfpool.run/toolchain/cli#arguments) | Argument | Description | | --- | --- | | `RUNBOOK` | Name of the runbook as indexed in `txtx.yml`, or path to a `.tx` file | ### [Execution Mode](https://docs.surfpool.run/toolchain/cli#execution-mode) These flags are mutually exclusive. If none is specified, `--browser` is the default. | Flag | Short | Description | | --- | --- | --- | | `--unsupervised` | `-u` | Execute without supervision | | `--browser` | `-b` | Execute with browser UI supervision (default) | | `--terminal` | `-t` | Execute with terminal supervision (coming soon) | ### [Options](https://docs.surfpool.run/toolchain/cli#options) | Flag | Short | Description | Default | | --- | --- | --- | --- | | `--manifest-file-path` | `-m` | Path to the manifest | `./txtx.yml` | | `--output-json` | \- | Output in JSON format; optionally provide a directory to write to file | \- | | `--output` | \- | Pick specific output to stdout (conflicts with `--output-json`) | \- | | `--explain` | \- | Explain how the runbook will be executed | `false` | | `--port` | `-p` | Web UI port | `8488` | | `--ip` | `-i` | Web UI IP address | `127.0.0.1` | | `--env` | \- | Environment to use from `txtx.yml` config | \- | | `--input` | \- | Inputs for batch processing (repeatable) | \- | | `--force` | `-f` | Execute even if cached state shows already executed | `false` | | `--log-level` | `-l` | Log level: `trace`, `debug`, `info`, `warn`, `error` | `info` | | `--log-path` | \- | Directory for runbook logs | `.surfpool/logs` | ### [Supervised Mode](https://docs.surfpool.run/toolchain/cli#supervised-mode) By default, `surfpool run` starts a web server for manual interaction with your Runbook execution steps. Each step can be validated, and runtime data can be input during execution. surfpool run my-runbook → Processing manifest './txtx.yml' ✓ Runbook 'My Runbook' successfully checked and loaded → Running Web console http://127.0.0.1:8488 ### [Unsupervised Mode](https://docs.surfpool.run/toolchain/cli#unsupervised-mode) In unsupervised mode, each Runbook step executes automatically in order. This is what Surfpool uses by default when deploying programs to your Surfnet. surfpool run my-runbook -u → Processing manifest './txtx.yml' ✓ Runbook 'My Runbook' successfully checked and loaded → Starting runbook 'My Runbook' execution in unsupervised mode ┌───────┬───┐ │ ouput │ 1 │ └───────┴───┘ * * * [surfpool ls](https://docs.surfpool.run/toolchain/cli#surfpool-ls) ------------------------------------------------------------------- Lists all runbooks declared in the manifest in the current directory. surfpool ls [OPTIONS] | Flag | Short | Description | Default | | --- | --- | --- | --- | | `--manifest-file-path` | `-m` | Path to the manifest | `./txtx.yml` | * * * [surfpool cloud](https://docs.surfpool.run/toolchain/cli#surfpool-cloud) ------------------------------------------------------------------------- Commands for interacting with the Txtx Cloud platform. ### [surfpool cloud login](https://docs.surfpool.run/toolchain/cli#surfpool-cloud-login) Authenticate with Txtx Cloud. surfpool cloud login ### [surfpool cloud start](https://docs.surfpool.run/toolchain/cli#surfpool-cloud-start) Start a new Cloud Surfnet instance. surfpool cloud start [OPTIONS] | Flag | Short | Description | Default | | --- | --- | --- | --- | | `--workspace` | `-w` | Workspace name | \- | | `--name` | `-n` | Name of the surfnet to create | \- | | `--description` | `-d` | Description for the surfnet | \- | | `--rpc-url` | `-u` | Datasource RPC URL | `https://api.mainnet-beta.solana.com` | | `--block-production` | `-b` | Block production mode: `clock`, `transaction`, or `manual` | \- | | `--profile-transactions` | \- | Enable transaction profiling | `false` | * * * [surfpool completions](https://docs.surfpool.run/toolchain/cli#surfpool-completions) ------------------------------------------------------------------------------------- Generate shell completion scripts. surfpool completions | Argument | Description | | --- | --- | | `SHELL` | Target shell (e.g., `bash`, `zsh`, `fish`) | * * * [surfpool mcp](https://docs.surfpool.run/toolchain/cli#surfpool-mcp) --------------------------------------------------------------------- Start an MCP (Model Context Protocol) server for AI tool integration. surfpool mcp [Getting Started\ \ This guide will get you all set up and ready to install Surfpool.](https://docs.surfpool.run/toolchain/getting-started) [Terminal UI\ \ Explore the interactive Terminal UI dashboard for Surfpool](https://docs.surfpool.run/toolchain/tui) ### On this page [surfpool start](https://docs.surfpool.run/toolchain/cli#surfpool-start) [Network Options](https://docs.surfpool.run/toolchain/cli#network-options) [Deployment Options](https://docs.surfpool.run/toolchain/cli#deployment-options) [Airdrop Options](https://docs.surfpool.run/toolchain/cli#airdrop-options) [UI Options](https://docs.surfpool.run/toolchain/cli#ui-options) [Logging & Profiling](https://docs.surfpool.run/toolchain/cli#logging--profiling) [Database Options](https://docs.surfpool.run/toolchain/cli#database-options) [Plugin & Feature Options](https://docs.surfpool.run/toolchain/cli#plugin--feature-options) [Compatibility & CI](https://docs.surfpool.run/toolchain/cli#compatibility--ci) [Examples](https://docs.surfpool.run/toolchain/cli#examples) [surfpool run](https://docs.surfpool.run/toolchain/cli#surfpool-run) [Arguments](https://docs.surfpool.run/toolchain/cli#arguments) [Execution Mode](https://docs.surfpool.run/toolchain/cli#execution-mode) [Options](https://docs.surfpool.run/toolchain/cli#options) [Supervised Mode](https://docs.surfpool.run/toolchain/cli#supervised-mode) [Unsupervised Mode](https://docs.surfpool.run/toolchain/cli#unsupervised-mode) [surfpool ls](https://docs.surfpool.run/toolchain/cli#surfpool-ls) [surfpool cloud](https://docs.surfpool.run/toolchain/cli#surfpool-cloud) [surfpool cloud login](https://docs.surfpool.run/toolchain/cli#surfpool-cloud-login) [surfpool cloud start](https://docs.surfpool.run/toolchain/cli#surfpool-cloud-start) [surfpool completions](https://docs.surfpool.run/toolchain/cli#surfpool-completions) [surfpool mcp](https://docs.surfpool.run/toolchain/cli#surfpool-mcp) --- # Getting Started with IaC | Surfpool Docs Infrastructure as Code Getting Started with IaC ======================== Use the txtx DSL to describe the deployments that surfpool manages. Surfpool introduces Infrastructure as Code (IaC) to the Solana ecosystem, enabling developers to achieve reproducible, secure, and automated deployments with minimal overhead. While simulation is a core feature of Surfpool, the underlying IaC system is equally critical in supporting modern Solana development workflows. [Overview](https://docs.surfpool.run/iac/getting-started#overview) ------------------------------------------------------------------- The concept of Crypto Infrastructure as Code (Crypto IaC) brings the same advantages familiar to traditional DevOps—automation, auditability, modularity—to the Web3 space. This model is designed to ensure consistent and scalable deployment practices across complex crypto environments. Surfpool's approach to Crypto IaC has been informed by years of hands-on work with advanced protocols including Pyth, Wormhole Core, Circle CCTP, Bitcoin Ordinals, and others. A robust Crypto IaC system typically encompasses three categories of components: Onchain Infrastructure, Signing Infrastructure, and Offchain Infrastructure. [Onchain Infrastructure](https://docs.surfpool.run/iac/getting-started#onchain-infrastructure) ----------------------------------------------------------------------------------------------- This category includes: * Solana Programs deployments * Upgrades * State migrations A well-structured IaC implementation ensures these actions are reproducible, version-controlled, and auditable. Developers can trace every deployment and understand its impact before execution. [Signing Infrastructure](https://docs.surfpool.run/iac/getting-started#signing-infrastructure) ----------------------------------------------------------------------------------------------- Secure transaction signing is fundamental in production environments. Instead of relying on local keypairs (which pose significant security risks), a modern IaC system supports: * Hardware wallets * Threshold cryptography * Multisig wallets Signing modules in Surfpool IaC are modular and configurable. Transitioning from a hardcoded private key to a sophisticated signing scheme (e.g. Squads multisig) can be done by updating configuration—no code rewrites required. [Offchain Infrastructure](https://docs.surfpool.run/iac/getting-started#offchain-infrastructure) ------------------------------------------------------------------------------------------------- This includes: * Indexers * State watchers * Wallet sentinels * Automation scripts These components often react to onchain events and should be treated as part of the deployment pipeline—testable, portable, and versioned like any other code artifact. > **Note:** Surfpool's IaC deliberately excludes RPC and node provisioning. These lower-level concerns are already well-supported by tools like Terraform, Ansible, and cloud-native services, and are out of scope for application-level infrastructure management. [Language Design Principles](https://docs.surfpool.run/iac/getting-started#language-design-principles) ------------------------------------------------------------------------------------------------------- A critical design goal is static analysis. Developers should be able to produce an execution plan—including involved programs, expected signers, touched accounts, and estimated costs—without running the code. Key principles: * Declarative syntax (no JS DSLs, no imperative shell scripts) * Composable structure * Minimal learning curve * Separation of concerns between infrastructure and logic This enables seamless progression from local development to mainnet deployment by simply swapping out components like signing providers or network endpoints. [Web3 Runbooks](https://docs.surfpool.run/iac/getting-started#web3-runbooks) ----------------------------------------------------------------------------- Surfpool's IaC engine is powered by Web3 Runbooks, a domain-specific framework purpose-built for blockchain deployments. The system has been developed over several months to ensure: * Simplicity of use * Composability of routines * Secure runtime execution It supports both Solana and Ethereum-compatible chains. In Ethereum environments, Runbooks are already in use by high-performance teams—such as the Infura team at Consensys—for complex protocol deployments involving Eigenlayer and multiple Layer 2 networks. [Surfpool Integration](https://docs.surfpool.run/iac/getting-started#surfpool-integration) ------------------------------------------------------------------------------------------- With Surfpool, we've taken Runbooks a step further—refining the developer experience and tailoring it for Solana use cases. The goal is to make Solana development modular, testable, and production-ready from day one. By combining Surfnets and Crypto IaC, Surfpool offers: * A local-first developer stack * Smooth transition to mainnet through simple config updates * Fully defined and reproducible network environments [WebSocket RPC Methods\ \ Real-time WebSocket subscriptions for monitoring blockchain state changes](https://docs.surfpool.run/rpc/websockets) [Language & Syntax\ \ Use the txtx DSL to describe the deployments that surfpool manages.](https://docs.surfpool.run/iac/language) ### On this page [Overview](https://docs.surfpool.run/iac/getting-started#overview) [Onchain Infrastructure](https://docs.surfpool.run/iac/getting-started#onchain-infrastructure) [Signing Infrastructure](https://docs.surfpool.run/iac/getting-started#signing-infrastructure) [Offchain Infrastructure](https://docs.surfpool.run/iac/getting-started#offchain-infrastructure) [Language Design Principles](https://docs.surfpool.run/iac/getting-started#language-design-principles) [Web3 Runbooks](https://docs.surfpool.run/iac/getting-started#web3-runbooks) [Surfpool Integration](https://docs.surfpool.run/iac/getting-started#surfpool-integration) --- # Video Tutorials | Surfpool Docs Resources Video Tutorials =============== Learn Surfpool through our video tutorial series Learn Surfpool through our comprehensive video tutorial series on YouTube. [Surfpool 101 Series](https://docs.surfpool.run/resources/video-tutorials#surfpool-101-series) ----------------------------------------------------------------------------------------------- Check out our [Surfpool 101 Series](https://www.youtube.com/playlist?list=PL0FMgRjJMRzO1FdunpMS-aUS4GNkgyr3T) on YouTube to learn about: * Getting started with Surfpool * Using the Terminal UI * Running Runbooks * Working with Cheatcodes * Deploying to Surfnet [Featured Videos](https://docs.surfpool.run/resources/video-tutorials#featured-videos) --------------------------------------------------------------------------------------- ### [Getting Started with Surfpool](https://docs.surfpool.run/resources/video-tutorials#getting-started-with-surfpool) [Community Content](https://docs.surfpool.run/resources/video-tutorials#community-content) ------------------------------------------------------------------------------------------- Have you created content about Surfpool? Join our [Discord](https://discord.gg/rqXmWsn2ja) and share it with the community! [SVM Signers\ \ Signers for Solana and SVM Compatible Blockchains](https://docs.surfpool.run/iac/svm/signers) [Discord\ \ Next Page](https://discord.gg/rqXmWsn2ja) ### On this page [Surfpool 101 Series](https://docs.surfpool.run/resources/video-tutorials#surfpool-101-series) [Featured Videos](https://docs.surfpool.run/resources/video-tutorials#featured-videos) [Getting Started with Surfpool](https://docs.surfpool.run/resources/video-tutorials#getting-started-with-surfpool) [Community Content](https://docs.surfpool.run/resources/video-tutorials#community-content) --- # WebSocket RPC Methods | Surfpool Docs RPC WebSocket RPC Methods ===================== Real-time WebSocket subscriptions for monitoring blockchain state changes Real-time WebSocket subscriptions for monitoring blockchain state changes. Connect to `ws://localhost:8900` when running Surfnet. ### accountSubscribe Account subscribe endpoint specification Parameters | Name | Type | Description | | --- | --- | --- | | `pubkey`\* | `string` | Account public key to monitor (base-58 encoded) | | `config` | `RpcAccountSubscribeConfig` | Optional subscription configuration | Example SubscribeResponseNotificationUnsubscribe { "jsonrpc": "2.0", "id": 1, "method": "accountSubscribe", "params": [ { "commitment": "Processed", "encoding": "Base58" }, "string" ]} ### blockSubscribe blockSubscribe - Subscribe to block updates Example SubscribeResponseNotificationUnsubscribe { "jsonrpc": "2.0", "id": 1, "method": "blockSubscribe", "params": []} ### logsSubscribe logsSubscribe - Subscribe to transaction logs Example SubscribeResponseNotificationUnsubscribe { "jsonrpc": "2.0", "id": 1, "method": "logsSubscribe", "params": []} ### programSubscribe programSubscribe - Subscribe to program account changes Example SubscribeResponseNotificationUnsubscribe { "jsonrpc": "2.0", "id": 1, "method": "programSubscribe", "params": []} ### signatureSubscribe Signature subscribe endpoint specification Parameters | Name | Type | Description | | --- | --- | --- | | `signature`\* | `string` | Transaction signature to monitor (base-58 encoded) | | `config` | `RpcSignatureSubscribeConfig` | Optional subscription configuration | Example SubscribeResponseNotificationUnsubscribe { "jsonrpc": "2.0", "id": 1, "method": "signatureSubscribe", "params": [ { "commitment": "Processed", "enableReceivedNotification": true }, "string" ]} ### slotSubscribe Slot subscribe endpoint specification Example SubscribeResponseNotificationUnsubscribe { "jsonrpc": "2.0", "id": 1, "method": "slotSubscribe", "params": []} ### slotUpdatesSubscribe slotUpdatesSubscribe - Subscribe to slot updates Example SubscribeResponseNotificationUnsubscribe { "jsonrpc": "2.0", "id": 1, "method": "slotUpdatesSubscribe", "params": []} [Admin\ \ Administrative controls for managing the Surfnet instance](https://docs.surfpool.run/rpc/admin) [Getting Started with IaC\ \ Use the txtx DSL to describe the deployments that surfpool manages.](https://docs.surfpool.run/iac/getting-started) ### On this page [accountSubscribe](https://docs.surfpool.run/rpc/websockets#accountSubscribe) [blockSubscribe](https://docs.surfpool.run/rpc/websockets#blockSubscribe) [logsSubscribe](https://docs.surfpool.run/rpc/websockets#logsSubscribe) [programSubscribe](https://docs.surfpool.run/rpc/websockets#programSubscribe) [signatureSubscribe](https://docs.surfpool.run/rpc/websockets#signatureSubscribe) [slotSubscribe](https://docs.surfpool.run/rpc/websockets#slotSubscribe) [slotUpdatesSubscribe](https://docs.surfpool.run/rpc/websockets#slotUpdatesSubscribe) { "jsonrpc": "2.0", "id": 1, "method": "accountSubscribe", "params": [\ {\ "commitment": "Processed",\ "encoding": "Base58"\ },\ "string"\ ] } { "jsonrpc": "2.0", "id": 1, "method": "blockSubscribe", "params": [] } { "jsonrpc": "2.0", "id": 1, "method": "logsSubscribe", "params": [] } { "jsonrpc": "2.0", "id": 1, "method": "programSubscribe", "params": [] } { "jsonrpc": "2.0", "id": 1, "method": "signatureSubscribe", "params": [\ {\ "commitment": "Processed",\ "enableReceivedNotification": true\ },\ "string"\ ] } { "jsonrpc": "2.0", "id": 1, "method": "slotSubscribe", "params": [] } { "jsonrpc": "2.0", "id": 1, "method": "slotUpdatesSubscribe", "params": [] } --- # Introducing Surfnet | Surfpool Docs RPC Introducing Surfnet =================== Learn about Surfnet, Surfpool's local Solana network simulator and RPC API Surfnet is Surfpool's local Solana network simulator, designed to provide developers with a powerful testing environment that mimics the behavior of the Solana blockchain without the overhead of a full validator node. [Getting Started](https://docs.surfpool.run/rpc/overview#getting-started) -------------------------------------------------------------------------- Start a Surfnet instance using the Surfpool CLI: surfpool start This will start a local Surfnet instance on `http://localhost:8899` with all RPC endpoints available. [Key Features](https://docs.surfpool.run/rpc/overview#key-features) -------------------------------------------------------------------- * **Full RPC Compatibility**: Supports the complete Solana RPC API * **Fast Iteration**: No need to wait for block confirmations * **State Manipulation**: Cheatcodes for directly modifying blockchain state * **Mainnet Fork**: Fork from mainnet to test with real accounts and programs * **Geyser Plugin Support**: Connect your Geyser plugins for real-time data streaming [Terminal UI\ \ Explore the interactive Terminal UI dashboard for Surfpool](https://docs.surfpool.run/toolchain/tui) [Transactions\ \ Send, simulate, and inspect transaction data on Surfnet](https://docs.surfpool.run/rpc/transactions) ### On this page [Getting Started](https://docs.surfpool.run/rpc/overview#getting-started) [Key Features](https://docs.surfpool.run/rpc/overview#key-features) --- # Cheatcodes | Surfpool Docs RPC Cheatcodes ========== Powerful testing utilities unique to Surfpool for state manipulation Powerful testing utilities unique to Surfpool that allow you to directly modify account and token states. These methods are only available on Surfnet. ### surfnet\_setAccount Sets or updates an account's properties including lamports, data, owner, and executable status. Parameters | Name | Type | Description | | --- | --- | --- | | `pubkey`\* | `string` | The public key of the account to update, as a base-58 encoded string. This identifies which account will be modified. | | `update`\* | `object` | The account data to update. Contains the new values for lamports, owner, executable status, rent epoch, and data. | | └`data` | `string` | The new account data, as a hex encoded string. This contains the actual data stored in the account. | | └`executable` | `boolean` | Whether the account should be executable (true for program accounts, false for data accounts). | | └`lamports` | `integer` | The new balance in lamports (1 SOL = 1,000,000,000 lamports). | | └`owner` | `string` | The new owner program ID, as a base-58 encoded string. | | └`rentEpoch` | `integer` | The new rent epoch in which this account will next owe rent. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `null` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "surfnet_setAccount", "params": { "pubkey": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri", "update": { "data": "0x3b9aca00", "executable": true, "lamports": 1000000000, "owner": "11111111111111111111111111111111", "rentEpoch": 100 } }} ### surfnet\_setTokenAccount Sets or updates a token account's properties including balance, delegate, state, and authorities. Parameters | Name | Type | Description | | --- | --- | --- | | `owner`\* | `string` | The public key of the token account owner, as a base-58 encoded string. This is the wallet that owns the token account. | | `mint`\* | `string` | The public key of the token mint, as a base-58 encoded string. This identifies the specific token type (e.g., USDC, SOL). | | `tokenProgram` | `string` | The token program ID, as a base-58 encoded string. Defaults to SPL Token program if not specified. | | `update`\* | `object` | The token account data to update. Contains new values for balance, delegate, state, and authorities. | | └`amount` | `integer` | The new token balance amount in the smallest unit (e.g., lamports for SOL, or the smallest token unit). | | └`closeAuthority` | `string` | The new close authority that can close the account and recover rent. | | └`delegate` | `string` | The new delegate account that can spend tokens on behalf of the owner. | | └`delegatedAmount` | `integer` | The new delegated amount that the delegate is authorized to spend. | | └`state` | `string` | The new account state (e.g., 'initialized', 'frozen', 'closed'). | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `null` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "surfnet_setTokenAccount", "params": { "owner": "11111111111111111111111111111111", "mint": "", "update": { "amount": 1000000000, "closeAuthority": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri", "delegate": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri", "delegatedAmount": 1000000000, "state": "" }, "tokenProgram": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" }} ### surfnet\_cloneProgramAccount Clones a program account from one program ID to another, including its associated program data. Parameters | Name | Type | Description | | --- | --- | --- | | `sourceProgramId`\* | `string` | The public key of the source program to clone, as a base-58 encoded string. | | `destinationProgramId`\* | `string` | The public key of the destination program, as a base-58 encoded string. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `null` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "surfnet_cloneProgramAccount", "params": { "sourceProgramId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", "destinationProgramId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" }} ### surfnet\_profileTransaction Profiles a transaction to analyze compute units, account changes, and execution details. Parameters | Name | Type | Description | | --- | --- | --- | | `transactionData`\* | `string` | The transaction data to profile, as a base-64 encoded string. This should be a serialized VersionedTransaction. | | `tag` | `string` | An optional tag to identify the profiling results. Useful for grouping related transaction profiles. | | `config` | `object` | Configuration for the profile result, including encoding format and profiling depth. | | └`depth` | `string` | The depth of profiling - 'transaction' for overall transaction profile, 'instruction' for per-instruction breakdown. | | └`encoding` | `string` | The encoding format for returned account data (e.g., 'base64', 'base58', 'jsonParsed'). | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `object` | | | └`computeUnits` | `object` | Compute units estimation result | | └`computeUnitsConsumed` | `integer` | Number of compute units consumed | | └`errorMessage` | `string` | Error message if estimation failed | | └`logMessages` | `array` | Log messages from the transaction | | └`success` | `boolean` | Indicates if the estimation was successful | | └`state` | `object` | Profile state containing pre and post execution states | | └`postExecution` | `object` | Account states after execution | | └`preExecution` | `object` | Account states before execution | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "surfnet_profileTransaction", "params": { "transactionData": "0x3b9aca00", "tag": "", "config": { "depth": "instruction", "encoding": "base64" } }} ### surfnet\_getProfileResultsByTag Retrieves all profiling results for transactions tagged with a specific identifier. Parameters | Name | Type | Description | | --- | --- | --- | | `tag`\* | `string` | The tag to retrieve profiling results for. Returns all transaction profiles that were tagged with this identifier. | | `config` | `object` | Configuration for the profile result, including encoding format and profiling depth. | | └`depth` | `string` | The depth of profiling - 'transaction' for overall transaction profile, 'instruction' for per-instruction breakdown. | | └`encoding` | `string` | The encoding format for returned account data (e.g., 'base64', 'base58', 'jsonParsed'). | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `array` | | | └`[]` | `object` | Array item | | └`computeUnits` | `object` | Compute units estimation result | | └`computeUnitsConsumed` | `integer` | Number of compute units consumed | | └`errorMessage` | `string` | Error message if estimation failed | | └`logMessages` | `array` | Log messages from the transaction | | └`success` | `boolean` | Indicates if the estimation was successful | | └`state` | `object` | Profile state containing pre and post execution states | | └`postExecution` | `object` | Account states after execution | | └`preExecution` | `object` | Account states before execution | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "surfnet_getProfileResultsByTag", "params": { "tag": "", "config": { "depth": "instruction", "encoding": "base64" } }} ### surfnet\_setSupply Configures the network supply information including total, circulating, and non-circulating amounts. Parameters | Name | Type | Description | | --- | --- | --- | | `update`\* | `object` | The supply data to update. Contains new values for total, circulating, and non-circulating SOL amounts. | | └`circulating` | `integer` | The new circulating supply of SOL in lamports (total supply minus non-circulating). | | └`nonCirculating` | `integer` | The new non-circulating supply of SOL in lamports (locked in non-circulating accounts). | | └`nonCirculatingAccounts` | `array` | The new list of non-circulating account addresses that hold locked SOL. | | └`total` | `integer` | The new total supply of SOL in lamports across the entire network. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `null` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "surfnet_setSupply", "params": { "update": { "circulating": 0, "nonCirculating": 0, "nonCirculatingAccounts": [], "total": 0 } }} ### surfnet\_setProgramAuthority Sets or removes the upgrade authority for a program's ProgramData account. Parameters | Name | Type | Description | | --- | --- | --- | | `programId`\* | `string` | The public key of the program, as a base-58 encoded string. This is the program whose upgrade authority will be modified. | | `newAuthority` | `string` | The public key of the new authority, as a base-58 encoded string. If omitted, the program will have no upgrade authority (immutable). | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `null` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "surfnet_setProgramAuthority", "params": { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", "newAuthority": "" }} ### surfnet\_getTransactionProfile Retrieves the detailed profile of a specific transaction by signature or UUID. Parameters | Name | Type | Description | | --- | --- | --- | | `signatureOrUuid`\* | `object \| object` | The transaction signature (as a base-58 string) or a UUID (as a string) for which to retrieve the profile. This identifies the specific transaction to analyze. | | `config` | `object` | Configuration for the profile result, including encoding format and profiling depth. | | └`depth` | `string` | The depth of profiling - 'transaction' for overall transaction profile, 'instruction' for per-instruction breakdown. | | └`encoding` | `string` | The encoding format for returned account data (e.g., 'base64', 'base58', 'jsonParsed'). | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `object` | | | └`instructionProfiles` | `array` | | | └`key` | `UuidOrSignature` | | | └`readonlyAccountStates` | `object` | | | └`slot` | `integer` | | | └`transactionProfile` | `object` | | | └`accountStates` | `object` | | | └`computeUnitsConsumed` | `integer` | | | └`errorMessage` | `string` | | | └`logMessages` | `array` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "surfnet_getTransactionProfile", "params": { "signatureOrUuid": { "uuid": "" }, "config": { "depth": "instruction", "encoding": "base64" } }} ### surfnet\_registerIdl Registers an IDL (Interface Definition Language) for a program to enable account data parsing. Parameters | Name | Type | Description | | --- | --- | --- | | `slot` | `integer` | The slot at which to register the IDL. If omitted, uses the latest slot. This determines when the IDL becomes active for account parsing. | | `idl`\* | `object` | The full IDL object to be registered in memory. The \`address\` field should match the program's public key. This enables account data parsing for the program. | | └`accounts`\* | `array` | The IDL accounts array defining all account types that the program can create or interact with. | | └`address`\* | `string` | The program address that this IDL describes, as a base-58 encoded string. | | └`constants`\* | `array` | The IDL constants array defining constant values used by the program. | | └`errors`\* | `array` | The IDL errors array defining custom error types that the program can return. | | └`events`\* | `array` | The IDL events array defining events that the program can emit. | | └`instructions`\* | `array` | The IDL instructions array defining all available program instructions and their parameters. | | └`metadata`\* | `string` | The IDL metadata containing program name, version, and description information. | | └`state` | `string` | The IDL state object defining the program's state account structure (if applicable). | | └`types`\* | `array` | The IDL types array defining custom data types used by the program. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `null` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "surfnet_registerIdl", "params": { "idl": { "accounts": [], "address": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri", "constants": [], "errors": [], "events": [], "instructions": [], "metadata": null, "state": null, "types": [] }, "slot": 123456789 }} ### surfnet\_getActiveIdl Retrieves the registered IDL for a specific program ID at a given slot. Parameters | Name | Type | Description | | --- | --- | --- | | `programId`\* | `string` | The public key of the program whose IDL is being requested, as a base-58 encoded string. This identifies which program's IDL to retrieve. | | `slot` | `integer` | The slot at which to query the IDL. If omitted, the latest slot will be used. This determines which version of the IDL to return. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `object` | | | └`accounts` | `array` | The IDL accounts array defining all account types that the program can create or interact with. | | └`address` | `string` | The program address that this IDL describes, as a base-58 encoded string. | | └`constants` | `array` | The IDL constants array defining constant values used by the program. | | └`errors` | `array` | The IDL errors array defining custom error types that the program can return. | | └`events` | `array` | The IDL events array defining events that the program can emit. | | └`instructions` | `array` | The IDL instructions array defining all available program instructions and their parameters. | | └`metadata` | `any` | The IDL metadata containing program name, version, and description information. | | └`state` | `any` | The IDL state object defining the program's state account structure (if applicable). | | └`types` | `array` | The IDL types array defining custom data types used by the program. | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "surfnet_getActiveIdl", "params": { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", "slot": 123456789 }} ### surfnet\_getLocalSignatures Retrieves the most recent transaction signatures from the local network. Parameters | Name | Type | Description | | --- | --- | --- | | `limit` | `integer` | The maximum number of signatures to return. Defaults to 50 if not specified. Returns the most recent signatures first. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `array` | | | └`[]` | `object` | Array item | | └`err` | `object` | | | └`errorType` | `string` | Error type | | └`message` | `string` | Error message | | └`logs` | `array` | | | └`signature` | `string` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "surfnet_getLocalSignatures", "params": { "limit": 0 }} ### surfnet\_timeTravel Sets the network's current epoch info to a future time based on the supplied epoch, slot, or time. Parameters | Name | Type | Description | | --- | --- | --- | | `config` | `string` | Configuration specifying how to modify the clock. Can move to a specific epoch, slot, or timestamp. | Result | Field | Type | Description | | --- | --- | --- | | `absoluteSlot` | `integer` | Absolute root slot | | `blockHeight` | `integer` | Block height | | `epoch` | `integer` | Current epoch | | `slotIndex` | `integer` | Current slot index within the epoch | | `slotsInEpoch` | `integer` | Total number of slots in the epoch | | `transactionCount` | `integer` | Current transaction count | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "surfnet_timeTravel", "params": { "config": { "absoluteEpoch": 100 } }} ### surfnet\_pauseClock Pauses the local network's clock progression, halting block production. Result | Field | Type | Description | | --- | --- | --- | | `absoluteSlot` | `integer` | Absolute root slot | | `blockHeight` | `integer` | Block height | | `epoch` | `integer` | Current epoch | | `slotIndex` | `integer` | Current slot index within the epoch | | `slotsInEpoch` | `integer` | Total number of slots in the epoch | | `transactionCount` | `integer` | Current transaction count | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "surfnet_pauseClock", "params": {}} ### surfnet\_resumeClock Resumes the network's block production if paused. Result | Field | Type | Description | | --- | --- | --- | | `absoluteSlot` | `integer` | Absolute root slot | | `blockHeight` | `integer` | Block height | | `epoch` | `integer` | Current epoch | | `slotIndex` | `integer` | Current slot index within the epoch | | `slotsInEpoch` | `integer` | Total number of slots in the epoch | | `transactionCount` | `integer` | Current transaction count | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "surfnet_resumeClock", "params": {}} ### surfnet\_resetAccount Resets an account on the local network to its original state from the remote datasource. Parameters | Name | Type | Description | | --- | --- | --- | | `pubkey`\* | `string` | The base-58 encoded public key of the account to reset. | | `config` | `object` | Configuration for the reset operation. | | └`includeOwnedAccounts` | `boolean` | If true, also resets accounts owned by the specified account. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `null` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "surfnet_resetAccount", "params": { "pubkey": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri", "config": { "includeOwnedAccounts": true } }} ### surfnet\_exportSnapshot Exports a snapshot of all accounts in the Surfnet SVM. Parameters | Name | Type | Description | | --- | --- | --- | | `config` | `object` | Configuration for the export operation. | | └`includeParsedAccounts` | `boolean` | If true, includes parsed account data in the snapshot. | | └`filter` | `object` | Filter configuration to limit which accounts are included. | | └`includeProgramAccounts` | `boolean` | Whether to include program accounts in the snapshot. | | └`includeAccounts` | `array` | List of specific account public keys to include. | | └`excludeAccounts` | `array` | List of specific account public keys to exclude. | | └`scope` | `string \| object` | Scope to limit the accounts included. Options are 'network' (all accounts) or 'preTransaction' (accounts touched by a transaction). | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `object` | Map of account public keys to their snapshots | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "surfnet_exportSnapshot", "params": { "config": { "includeParsedAccounts": true, "filter": { "includeProgramAccounts": true, "includeAccounts": [], "excludeAccounts": [] }, "scope": "network" } }} ### surfnet\_streamAccount Registers an account for streaming, downloading it from the datasource every time rather than caching it in the SVM. Parameters | Name | Type | Description | | --- | --- | --- | | `pubkey`\* | `string` | The base-58 encoded public key of the account to stream. | | `config` | `object` | Configuration for the stream operation. | | └`includeOwnedAccounts` | `boolean` | If true, also streams accounts owned by the specified account. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `null` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "surfnet_streamAccount", "params": { "pubkey": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri", "config": { "includeOwnedAccounts": true } }} ### surfnet\_writeProgram Writes program data at a specified offset, allowing deployment of large programs by sending data in chunks. Parameters | Name | Type | Description | | --- | --- | --- | | `programId`\* | `string` | The public key of the program account, as a base-58 encoded string. | | `data`\* | `string` | Hex-encoded program data chunk to write. | | `offset`\* | `integer` | The byte offset at which to write this data chunk. | | `authority` | `string` | The base-58 encoded public key of the authority allowed to write to the program. Defaults to the system program if omitted. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `null` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "surfnet_writeProgram", "params": { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", "data": "0x3b9aca00", "offset": 0, "authority": "" }} ### surfnet\_registerScenario Registers a scenario with account overrides for testing different network states. Parameters | Name | Type | Description | | --- | --- | --- | | `slot` | `integer` | The base slot from which relative slot offsets are calculated. If omitted, uses the current slot. | | `scenario`\* | `object` | The scenario object containing overrides. | | └`id`\* | `string` | Unique identifier for the scenario. | | └`name`\* | `string` | Human-readable name. | | └`description`\* | `string` | Description of this scenario. | | └`overrides`\* | `array[OverrideInstance]` | List of override instances in this scenario. | | └`tags`\* | `array[string]` | Tags for categorization. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `null` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "surfnet_registerScenario", "params": { "scenario": { "id": "", "name": "", "description": "", "overrides": [ { "id": "", "templateId": "", "values": {}, "scenarioRelativeSlot": 123456789, "label": "", "enabled": true, "fetchBeforeUse": true, "account": { "pubkey": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri" } } ], "tags": [ "" ] }, "slot": 123456789 }} ### surfnet\_resetNetwork Resets the entire network to its initial state Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `null` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "surfnet_resetNetwork", "params": []} ### surfnet\_getStreamedAccounts Retrieves the list of accounts registered for streaming Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `object` | | | └`accounts` | `array` | | | └`[]` | `object` | Array item | | └`pubkey` | `string` | Account public key as base-58 string | | └`includeOwnedAccounts` | `boolean` | Whether owned accounts are also streamed | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "surfnet_getStreamedAccounts", "params": []} ### surfnet\_getSurfnetInfo Retrieves Surfnet network information Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `object` | | | └`runbookExecutions` | `array` | | | └`[]` | `object` | Array item | | └`startedAt` | `integer` | Unix timestamp when execution started | | └`completedAt` | `integer` | Unix timestamp when execution completed (null if still running) | | └`runbookId` | `string` | Identifier of the runbook | | └`errors` | `array` | List of errors encountered during execution | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "surfnet_getSurfnetInfo", "params": []} [Accounts\ \ Query account states, balances, and token holdings on Surfnet](https://docs.surfpool.run/rpc/accounts) [Node Health\ \ Monitor node status, health checks, and cluster information](https://docs.surfpool.run/rpc/node) ### On this page [surfnet\_setAccount](https://docs.surfpool.run/rpc/cheatcodes#surfnet_setAccount) [surfnet\_setTokenAccount](https://docs.surfpool.run/rpc/cheatcodes#surfnet_setTokenAccount) [surfnet\_cloneProgramAccount](https://docs.surfpool.run/rpc/cheatcodes#surfnet_cloneProgramAccount) [surfnet\_profileTransaction](https://docs.surfpool.run/rpc/cheatcodes#surfnet_profileTransaction) [surfnet\_getProfileResultsByTag](https://docs.surfpool.run/rpc/cheatcodes#surfnet_getProfileResultsByTag) [surfnet\_setSupply](https://docs.surfpool.run/rpc/cheatcodes#surfnet_setSupply) [surfnet\_setProgramAuthority](https://docs.surfpool.run/rpc/cheatcodes#surfnet_setProgramAuthority) [surfnet\_getTransactionProfile](https://docs.surfpool.run/rpc/cheatcodes#surfnet_getTransactionProfile) [surfnet\_registerIdl](https://docs.surfpool.run/rpc/cheatcodes#surfnet_registerIdl) [surfnet\_getActiveIdl](https://docs.surfpool.run/rpc/cheatcodes#surfnet_getActiveIdl) [surfnet\_getLocalSignatures](https://docs.surfpool.run/rpc/cheatcodes#surfnet_getLocalSignatures) [surfnet\_timeTravel](https://docs.surfpool.run/rpc/cheatcodes#surfnet_timeTravel) [surfnet\_pauseClock](https://docs.surfpool.run/rpc/cheatcodes#surfnet_pauseClock) [surfnet\_resumeClock](https://docs.surfpool.run/rpc/cheatcodes#surfnet_resumeClock) [surfnet\_resetAccount](https://docs.surfpool.run/rpc/cheatcodes#surfnet_resetAccount) [surfnet\_exportSnapshot](https://docs.surfpool.run/rpc/cheatcodes#surfnet_exportSnapshot) [surfnet\_streamAccount](https://docs.surfpool.run/rpc/cheatcodes#surfnet_streamAccount) [surfnet\_writeProgram](https://docs.surfpool.run/rpc/cheatcodes#surfnet_writeProgram) [surfnet\_registerScenario](https://docs.surfpool.run/rpc/cheatcodes#surfnet_registerScenario) [surfnet\_resetNetwork](https://docs.surfpool.run/rpc/cheatcodes#surfnet_resetNetwork) [surfnet\_getStreamedAccounts](https://docs.surfpool.run/rpc/cheatcodes#surfnet_getStreamedAccounts) [surfnet\_getSurfnetInfo](https://docs.surfpool.run/rpc/cheatcodes#surfnet_getSurfnetInfo) { "jsonrpc": "2.0", "id": 1, "method": "surfnet_setAccount", "params": { "pubkey": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri", "update": { "data": "0x3b9aca00", "executable": true, "lamports": 1000000000, "owner": "11111111111111111111111111111111", "rentEpoch": 100 } } } { "jsonrpc": "2.0", "id": 1, "method": "surfnet_setTokenAccount", "params": { "owner": "11111111111111111111111111111111", "mint": "", "update": { "amount": 1000000000, "closeAuthority": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri", "delegate": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri", "delegatedAmount": 1000000000, "state": "" }, "tokenProgram": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" } } { "jsonrpc": "2.0", "id": 1, "method": "surfnet_cloneProgramAccount", "params": { "sourceProgramId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", "destinationProgramId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" } } { "jsonrpc": "2.0", "id": 1, "method": "surfnet_profileTransaction", "params": { "transactionData": "0x3b9aca00", "tag": "", "config": { "depth": "instruction", "encoding": "base64" } } } { "jsonrpc": "2.0", "id": 1, "method": "surfnet_getProfileResultsByTag", "params": { "tag": "", "config": { "depth": "instruction", "encoding": "base64" } } } { "jsonrpc": "2.0", "id": 1, "method": "surfnet_setSupply", "params": { "update": { "circulating": 0, "nonCirculating": 0, "nonCirculatingAccounts": [], "total": 0 } } } { "jsonrpc": "2.0", "id": 1, "method": "surfnet_setProgramAuthority", "params": { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", "newAuthority": "" } } { "jsonrpc": "2.0", "id": 1, "method": "surfnet_getTransactionProfile", "params": { "signatureOrUuid": { "uuid": "" }, "config": { "depth": "instruction", "encoding": "base64" } } } { "jsonrpc": "2.0", "id": 1, "method": "surfnet_registerIdl", "params": { "idl": { "accounts": [], "address": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri", "constants": [], "errors": [], "events": [], "instructions": [], "metadata": null, "state": null, "types": [] }, "slot": 123456789 } } { "jsonrpc": "2.0", "id": 1, "method": "surfnet_getActiveIdl", "params": { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", "slot": 123456789 } } { "jsonrpc": "2.0", "id": 1, "method": "surfnet_getLocalSignatures", "params": { "limit": 0 } } { "jsonrpc": "2.0", "id": 1, "method": "surfnet_timeTravel", "params": { "config": { "absoluteEpoch": 100 } } } { "jsonrpc": "2.0", "id": 1, "method": "surfnet_pauseClock", "params": {} } { "jsonrpc": "2.0", "id": 1, "method": "surfnet_resumeClock", "params": {} } { "jsonrpc": "2.0", "id": 1, "method": "surfnet_resetAccount", "params": { "pubkey": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri", "config": { "includeOwnedAccounts": true } } } { "jsonrpc": "2.0", "id": 1, "method": "surfnet_exportSnapshot", "params": { "config": { "includeParsedAccounts": true, "filter": { "includeProgramAccounts": true, "includeAccounts": [], "excludeAccounts": [] }, "scope": "network" } } } { "jsonrpc": "2.0", "id": 1, "method": "surfnet_streamAccount", "params": { "pubkey": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri", "config": { "includeOwnedAccounts": true } } } { "jsonrpc": "2.0", "id": 1, "method": "surfnet_writeProgram", "params": { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", "data": "0x3b9aca00", "offset": 0, "authority": "" } } { "jsonrpc": "2.0", "id": 1, "method": "surfnet_registerScenario", "params": { "scenario": { "id": "", "name": "", "description": "", "overrides": [\ {\ "id": "",\ "templateId": "",\ "values": {},\ "scenarioRelativeSlot": 123456789,\ "label": "",\ "enabled": true,\ "fetchBeforeUse": true,\ "account": {\ "pubkey": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri"\ }\ }\ ], "tags": [\ ""\ ] }, "slot": 123456789 } } { "jsonrpc": "2.0", "id": 1, "method": "surfnet_resetNetwork", "params": [] } { "jsonrpc": "2.0", "id": 1, "method": "surfnet_getStreamedAccounts", "params": [] } { "jsonrpc": "2.0", "id": 1, "method": "surfnet_getSurfnetInfo", "params": [] } --- # SVM Addon Overview | Surfpool Docs Infrastructure as CodeSVM Addon SVM Addon Overview ================== Add-on for Solana and SVM Compatible Blockchains (beta) The SVM `txtx` plugin enables building Runbooks that interact with Solana and SVM compatible blockchains. The plugin provides utility functions that allow you to deploy anchor programs and encode instruction calls according to program IDLs. The actions can be used to create valid transfer, program call, and program deployment transactions that can be signed via a mnemonic phrase, secret key, or via your browser signer. [Quick Start](https://docs.surfpool.run/iac/svm/overview#quick-start) ---------------------------------------------------------------------- To use the SVM addon, declare it in your Runbook: addon "svm" { network_id = "devnet" rpc_api_url = "https://api.devnet.solana.com" } [Features](https://docs.surfpool.run/iac/svm/overview#features) ---------------------------------------------------------------- * **Program Deployment**: Deploy Anchor and native Solana programs * **Instruction Building**: Encode instruction calls using program IDLs * **Transaction Signing**: Support for mnemonics, secret keys, and web wallets * **Account Management**: Query and manage Solana accounts [Navigation](https://docs.surfpool.run/iac/svm/overview#navigation) -------------------------------------------------------------------- [### Functions\ \ Utility functions for Solana development](https://docs.surfpool.run/iac/svm/functions) [### Actions\ \ Transaction and deployment actions](https://docs.surfpool.run/iac/svm/actions) [### Signers\ \ Different signing methods](https://docs.surfpool.run/iac/svm/signers) [Standard Actions\ \ Actions available in the standard library](https://docs.surfpool.run/iac/std/actions) [SVM Functions\ \ Functions for Solana and SVM Compatible Blockchains](https://docs.surfpool.run/iac/svm/functions) ### On this page [Quick Start](https://docs.surfpool.run/iac/svm/overview#quick-start) [Features](https://docs.surfpool.run/iac/svm/overview#features) [Navigation](https://docs.surfpool.run/iac/svm/overview#navigation) --- # Language & Syntax | Surfpool Docs Infrastructure as Code Language & Syntax ================= Use the txtx DSL to describe the deployments that surfpool manages. This is the documentation for the txtx language. Runbook files that you write describe which blockchains and networks to use, what data to retrieve, and what transactions to broadcast. The txtx language also lets you define dependencies between resources and create multiple similar constructs from a single block. [Syntax](https://docs.surfpool.run/iac/language#syntax) -------------------------------------------------------- Runbooks contain a series of code blocks that look something like this: variable "query_path" { description = "An input that can be edited in the web UI!" value = "details" editable = true } action "http_query" "std::send_http_request" { description = "This action will make a GET request to the specified URL!" url = "https://example.com/${variable.my_var.query_path}" } output "status_code" { description = "This output will be displayed in the Outputs section of the web UI!" value = action.http_query.status_code } Each block has a command type (in this example `variable`, `action`, and `output`), a reference name (`"query_path"`, `"http_query"`, and `"status_code"`), and the inner data of the block (everything between the `{ ... }`). Some command types also require that a command is specified (`"std::send_http_request"`). The inner data of the block is dictated by the command type and command that are specified. ### [Command References](https://docs.surfpool.run/iac/language#command-references) One command can reference the outputs of another command to build a chain of dependent commands. When you execute a Runbook, surfpool creates a graph of all the commands to ensure they are always executed in the correct order. This does mean that dependency cycles need to be avoided when creating a Runbook. Another command's output can be referenced in a block using `command_type.ref_name.output_name`. Here are some examples: variable "my_var" { description = variable.another_var.value // references the `value` output of a `variable` named `another_var` value = action.my_action.data // references the `data` output of an `action` named `my_action` } ### [Functions](https://docs.surfpool.run/iac/language#functions) The [standard library](https://docs.surfpool.run/iac/std/functions/overview) provides some functions that can be written in-line, as opposed to writing full command blocks with named arguments. These functions can be extended via addons. These functions can look like explicit function calls (e.g. `add_uint(1, 3)`), or they can look like in-line arithmetic operations (e.g. `1 + 3`). Functions can reference other command outputs, or they can be stored in new command outputs. Here's an example using a few functions: variable "one" { value = 1 } variable "two" { value = 2 } variable "addem_up" { value = variable.one + variable.two } output "add_some_more" { value = add_uint(variable.addem_up + variable.one, variable.two) } [Manifest & CLI Inputs](https://docs.surfpool.run/iac/language#manifest--cli-inputs) ------------------------------------------------------------------------------------- Inputs can be provided to the Runbook by passing them in as a CLI input, or by specifying them in a `txtx.yml` manifest file. If the same input is provided both in the CLI and in a manifest, the CLI input will take precedence. To see information on how to use the CLI, check out the [CLI documentation](https://docs.surfpool.run/cli) . In the manifest, these inputs can be grouped by an environment key, making it easy to use the same Runbook across multiple environments. Here is an example config with environment variables: --- name: protocol-deployment runbooks: - name: Deploy Protocol description: This runbook deploys the protocol. location: ./deployment environments: development: network_id: localnet rpc_api_url: http://localhost:8899 devnet: network_id: devnet rpc_api_url: https://api.devnet.solana.com mainnet: network_id: mainnet rpc_api_url: https://api.mainnet-beta.solana.com In any of the `.tx` files loaded by this runbook, the inputs `input.network_id` and `input.rpc_api_url` will be available in the global scope. When the Web UI loads this runbook, the first action item will allow you to select which environment to load. Selecting a new environment will reload the current runbook with the new environment variables being injected into the execution. ### [State Management](https://docs.surfpool.run/iac/language#state-management) Surfpool can manage state across Runbook executions. When running contract deployments, the state management can be used to detect any changes to the contract code and Runbook inputs to determine if the Runbook needs to be re-executed. Surfpool will prevent a re-execution of a Runbook if there aren't any changes to the contract code or Runbook inputs. To enable state management, provide the `state` value and a `location` to store the state file in the `txtx.yml`: runbooks: - name: Deploy Protocol location: ./deployment state: location: states [Variables](https://docs.surfpool.run/iac/language#variables) -------------------------------------------------------------- Variables can be used to store values that can be used by other constructs and that can be edited by users in the Web UI. If the variables's `editable` field is unspecified or set to `false`, the variable will appear on the Web UI in the `Variables Review` section as a readonly value that can be verified. If the `editable` field is set to `true`, however, the variable will appear as an editable field in the Web UI. The optional `description` field can be provided to add additional context to the variable. Here is an example variable: variable "my_var" { description = "Enter your birthday" value = "MM/DD/YYYY" editable = true } [Addons & Defaults](https://docs.surfpool.run/iac/language#addons--defaults) ----------------------------------------------------------------------------- Addon blocks allow you to specify what addons will be used by the Runbook. Any fields declared inside the addon block can be referenced by any actions that are part of that addon. This will allow you to omit fields when using custom actions from that addon. The following example declares the `svm` addon and sets the `network_id` and `rpc_api_url` fields as defaults: addon "svm" { network_id = input.network_id rpc_api_url = input.rpc_api_url } With this default added to a `.tx` file, any actions from the SVM addon can omit both the `network_id` and `rpc_api_url` fields. [Flows](https://docs.surfpool.run/iac/language#flows) ------------------------------------------------------ Flows allow you to execute a Runbook multiple times with different inputs for each execution. Any fields specified in the flow block can be referenced by any actions that are part of that flow via `flow.field_name`. This can be used in conjunction with the `addon` block in helpful ways: // declare some flows flow "solana" { rpc_api_url "https://api.mainnet-beta.solana.com" } flow "eclipse" { rpc_api_url "https://mainnetbeta-rpc.eclipse.xyz" } // declare the evm addon with addon "svm" { network_id = "mainnet" rpc_api_url = flow.rpc_api_url } // the rest of the runbook can now use the svm addon without specifying chain_id or rpc_api_url, // and will be executed once for each flow [Signers](https://docs.surfpool.run/iac/language#signers) ---------------------------------------------------------- Addons can define signers that provide various ways to sign transactions when using surfpool. These signers can be used to sign transactions via a mnemonic or secret key, to prompt users to connect their web wallet and sign in the Surfpool Web UI, to sign transactions asynchronously via secure enclave, to define multisig wallets, and more. Each addon signer implementation will have its own use cases and documentation. Here is an example of a signer in use: signer "alice" "svm::web_wallet" { expected_address = input.expected_address } action "my_tx" "svm::process_instructions" { ... instruction data signers = [signer.alice] } This example defines a signer named `alice`, which uses the `svm::web_wallet` signer. This signer definition will generate a prompt in the Web UI to connect a wallet, provide a public key via message signature, and to sign all transactions using this wallet as a signer. [Actions](https://docs.surfpool.run/iac/language#actions) ---------------------------------------------------------- Actions are multi-purpose constructs that are defined by addons and by the [standard library](https://docs.surfpool.run/iac/std/actions/overview) . Each action defines its own set of inputs (some optional and some required) that can be supplied to the action, what happens during each call to the action, and what outputs are created by the action, which can be referenced by subsequent commands. Some examples of types of actions include making http requests and outputting the result, encoding transaction data to match a given chain's codec, signing a transaction with a wallet and outputting the signed transaction bytes, or broadcasting a transaction to a network. Here is an example action: action "deploy_hello_world" "svm::deploy_program" { description = "Deploy the hello_world program" program = svm::get_program_from_anchor_project("hello_world") authority = signer.authority payer = signer.payer } output "signature" { value = action.deploy_hello_world.signature } [Modules](https://docs.surfpool.run/iac/language#modules) ---------------------------------------------------------- Coming soon. [Outputs](https://docs.surfpool.run/iac/language#outputs) ---------------------------------------------------------- The output command can be used to display data at the end of the runbook execution. Here is an example of the output command: output "my_output" { description = "An example output. I hope it equals 8." value = 4 + 4 } [Getting Started with IaC\ \ Use the txtx DSL to describe the deployments that surfpool manages.](https://docs.surfpool.run/iac/getting-started) [Standard Library Overview\ \ The standard library provides core functions and actions available to all Runbooks.](https://docs.surfpool.run/iac/std/overview) ### On this page [Syntax](https://docs.surfpool.run/iac/language#syntax) [Command References](https://docs.surfpool.run/iac/language#command-references) [Functions](https://docs.surfpool.run/iac/language#functions) [Manifest & CLI Inputs](https://docs.surfpool.run/iac/language#manifest--cli-inputs) [State Management](https://docs.surfpool.run/iac/language#state-management) [Variables](https://docs.surfpool.run/iac/language#variables) [Addons & Defaults](https://docs.surfpool.run/iac/language#addons--defaults) [Flows](https://docs.surfpool.run/iac/language#flows) [Signers](https://docs.surfpool.run/iac/language#signers) [Actions](https://docs.surfpool.run/iac/language#actions) [Modules](https://docs.surfpool.run/iac/language#modules) [Outputs](https://docs.surfpool.run/iac/language#outputs) --- # Network | Surfpool Docs RPC Network ======= Access network-wide information like epoch data and performance metrics Access network-wide information like epoch data, inflation rates, and performance metrics. ### getMinimumBalanceForRentExemption Returns the minimum balance required for rent exemption. Parameters | Name | Type | Description | | --- | --- | --- | | `dataLen`\* | `integer` | The account data length in bytes. | | `commitment` | `object` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized'. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | Result | Field | Type | Description | | --- | --- | --- | | `result` | `integer` | getMinimumBalanceForRentExemption - Returns minimum balance for rent exemption | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getMinimumBalanceForRentExemption", "params": { "dataLen": 0, "commitment": { "commitment": "Processed" } }} ### getInflationGovernor Retrieves the inflation governor settings. Parameters | Name | Type | Description | | --- | --- | --- | | `commitment` | `object` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized'. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | Result | Field | Type | Description | | --- | --- | --- | | `foundation` | `number` | | | `foundationTerm` | `number` | | | `initial` | `number` | | | `taper` | `number` | | | `terminal` | `number` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getInflationGovernor", "params": { "commitment": { "commitment": "Processed" } }} ### getInflationRate Retrieves the current inflation rate. Result | Field | Type | Description | | --- | --- | --- | | `epoch` | `integer` | | | `foundation` | `number` | | | `total` | `number` | | | `validator` | `number` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getInflationRate", "params": []} ### getEpochSchedule Retrieves the epoch schedule. Result | Field | Type | Description | | --- | --- | --- | | `firstNormalEpoch` | `integer` | First normal-length epoch, if any | | `firstNormalSlot` | `integer` | First normal-length slot | | `leaderScheduleSlotOffset` | `integer` | Duration of leader schedule slot in each epoch | | `slotsPerEpoch` | `integer` | Number of slots in each epoch | | `warmup` | `boolean` | Whether epochs start short and grow | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getEpochSchedule", "params": []} ### getSlotLeader Retrieves the leader of the current slot. Parameters | Name | Type | Description | | --- | --- | --- | | `config` | `object` | Configuration object for the query. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | | └`minContextSlot` | `integer` | The minimum context slot for the context. | Result | Field | Type | Description | | --- | --- | --- | | `result` | `string` | getSlotLeader - Returns the leader of the current slot | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getSlotLeader", "params": { "config": { "commitment": "Processed", "minContextSlot": 123456789 } }} ### getSlotLeaders Retrieves the leaders for a specified range of slots. Parameters | Name | Type | Description | | --- | --- | --- | | `startSlot`\* | `integer` | The starting slot to query for leaders. | | `limit`\* | `integer` | The maximum number of leaders to return. | Result | Field | Type | Description | | --- | --- | --- | | `result` | `array` | getSlotLeaders - Returns leaders for a specified range of slots | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getSlotLeaders", "params": { "startSlot": 123456789, "limit": 0 }} ### getBlockProduction Retrieves block production information. Parameters | Name | Type | Description | | --- | --- | --- | | `config` | `object` | Configuration object for the query. | | └`commitment` | `object` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized'. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | | └`identity` | `string` | Filter by validator identity, as a base-58 encoded string. | | └`range` | `object` | Slot range to query. | | └`firstSlot` | `integer` | The first slot to include in the range. | | └`lastSlot` | `integer` | The last slot to include in the range. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `object` | | | └`byIdentity` | `object` | | | └`range` | `object` | | | └`firstSlot` | `integer` | | | └`lastSlot` | `integer` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getBlockProduction", "params": { "config": { "commitment": { "commitment": "Processed" }, "identity": "", "range": { "firstSlot": 123456789, "lastSlot": 123456789 } } }} ### getInflationReward Returns the inflation reward for a given address. Parameters | Name | Type | Description | | --- | --- | --- | | `addresses`\* | `array[string]` | An array of public keys to query, as base-58 encoded strings. | | `config` | `object` | Configuration object for the query. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | | └`epoch` | `integer` | The epoch number to query. | | └`minContextSlot` | `integer` | The minimum context slot for the epoch. | Result | Field | Type | Description | | --- | --- | --- | | `result` | `array` | getInflationReward - Returns inflation rewards for given addresses | | └`[]` | `object` | Array item | | └`amount` | `integer` | | | └`commission` | `integer` | | | └`effectiveSlot` | `integer` | | | └`epoch` | `integer` | | | └`postBalance` | `integer` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getInflationReward", "params": { "addresses": [ "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri" ], "config": { "commitment": "Processed", "epoch": 100, "minContextSlot": 123456789 } }} ### getRecentPerformanceSamples Returns the recent performance samples. Parameters | Name | Type | Description | | --- | --- | --- | | `limit` | `integer` | The maximum number of samples to return. | Result | Field | Type | Description | | --- | --- | --- | | `result` | `array` | getRecentPerformanceSamples - Returns recent performance samples | | └`[]` | `object` | Array item | | └`numNonVoteTransactions` | `integer` | | | └`numSlots` | `integer` | | | └`numTransactions` | `integer` | | | └`samplePeriodSecs` | `integer` | | | └`slot` | `integer` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getRecentPerformanceSamples", "params": { "limit": 0 }} ### getMaxRetransmitSlot Returns the maximum retransmit slot. Result | Field | Type | Description | | --- | --- | --- | | `result` | `integer` | getMaxRetransmitSlot - Returns maximum retransmit slot | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getMaxRetransmitSlot", "params": []} ### getMaxShredInsertSlot Returns the maximum shred insert slot. Result | Field | Type | Description | | --- | --- | --- | | `result` | `integer` | getMaxShredInsertSlot - Returns maximum shred insert slot | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getMaxShredInsertSlot", "params": []} ### minimumLedgerSlot Returns the minimum ledger slot. Result | Field | Type | Description | | --- | --- | --- | | `result` | `integer` | minimumLedgerSlot - Returns minimum ledger slot | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "minimumLedgerSlot", "params": []} ### getBlock Returns the block for a given slot. Parameters | Name | Type | Description | | --- | --- | --- | | `slot`\* | `integer` | The slot to query for the block. | | `config` | `object` | Configuration object for the query. | | └`commitment` | `object` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized'. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | | └`encoding` | `string` | Encoding for transaction data. | | └`maxSupportedTransactionVersion` | `integer` | The maximum transaction version to support. | | └`rewards` | `boolean` | Whether to return rewards. | | └`transactionDetails` | `string` | Level of transaction detail to return. | Result | Field | Type | Description | | --- | --- | --- | | `blockHeight` | `integer` | Block height | | `blockTime` | `integer` | Block time | | `blockhash` | `string` | Block hash | | `parentSlot` | `integer` | Parent slot | | `previousBlockhash` | `string` | Previous block hash | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getBlock", "params": { "slot": 123456789, "config": { "commitment": { "commitment": "Processed" }, "encoding": "binary", "maxSupportedTransactionVersion": 0, "rewards": true, "transactionDetails": "full" } }} ### getBlockTime Returns the block time for a given slot. Parameters | Name | Type | Description | | --- | --- | --- | | `slot`\* | `integer` | The slot to query for the block time. | Result | Field | Type | Description | | --- | --- | --- | | `result` | `integer` | getBlockTime - Returns block time for a given slot | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getBlockTime", "params": { "slot": 123456789 }} ### getBlocks Returns the blocks for a given range of slots. Parameters | Name | Type | Description | | --- | --- | --- | | `startSlot`\* | `integer` | The starting slot to query for blocks. | | `wrapper` | `string` | Wrapper for end slot or context configuration. | | `config` | `object` | Configuration object for the query. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | | └`minContextSlot` | `integer` | The minimum context slot for the context. | Result | Field | Type | Description | | --- | --- | --- | | `result` | `array` | getBlocks - Returns blocks for a range of slots | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getBlocks", "params": { "startSlot": 123456789, "wrapper": 0, "config": { "commitment": "Processed", "minContextSlot": 123456789 } }} ### getBlocksWithLimit Returns the blocks for a given range of slots with a limit. Parameters | Name | Type | Description | | --- | --- | --- | | `startSlot`\* | `integer` | The starting slot to query for blocks. | | `limit`\* | `integer` | The maximum number of blocks to return. | | `config` | `object` | Configuration object for the query. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | | └`minContextSlot` | `integer` | The minimum context slot for the context. | Result | Field | Type | Description | | --- | --- | --- | | `result` | `array` | getBlocksWithLimit - Returns blocks with limit | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getBlocksWithLimit", "params": { "startSlot": 123456789, "limit": 0, "config": { "commitment": "Processed", "minContextSlot": 123456789 } }} ### getFirstAvailableBlock Returns the first available block. Result | Field | Type | Description | | --- | --- | --- | | `result` | `integer` | getFirstAvailableBlock - Returns first available block | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getFirstAvailableBlock", "params": []} ### getLatestBlockhash Returns the latest blockhash. Parameters | Name | Type | Description | | --- | --- | --- | | `config` | `object` | Configuration object for the query. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | | └`minContextSlot` | `integer` | The minimum context slot for the context. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `object` | | | └`blockhash` | `string` | | | └`lastValidBlockHeight` | `integer` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getLatestBlockhash", "params": { "config": { "commitment": "Processed", "minContextSlot": 123456789 } }} ### isBlockhashValid Returns the blockhash validity. Parameters | Name | Type | Description | | --- | --- | --- | | `blockhash`\* | `string` | The blockhash to check, as a base-58 encoded string. | | `config` | `object` | Configuration object for the query. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | | └`minContextSlot` | `integer` | The minimum context slot for the context. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `boolean` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "isBlockhashValid", "params": { "blockhash": "EkSnNWid2cvwEVnVx9aBqawnmiCNiDgp3gUdkDPTKN1N", "config": { "commitment": "Processed", "minContextSlot": 123456789 } }} ### getRecentPrioritizationFees Returns the recent prioritization fees. Parameters | Name | Type | Description | | --- | --- | --- | | `pubkeys` | `array` | An array of account public keys to query for prioritization fees, as base-58 encoded strings. | Result | Field | Type | Description | | --- | --- | --- | | `result` | `array` | getRecentPrioritizationFees - Returns recent prioritization fees | | └`[]` | `object` | Array item | | └`prioritizationFee` | `integer` | | | └`slot` | `integer` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getRecentPrioritizationFees", "params": { "pubkeys": [] }} ### getEpochInfo Returns the epoch info. Parameters | Name | Type | Description | | --- | --- | --- | | `config` | `object` | Configuration object for the query. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | | └`minContextSlot` | `integer` | The minimum context slot for the context. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `object` | | | └`absoluteSlot` | `integer` | Absolute root slot | | └`blockHeight` | `integer` | Block height | | └`epoch` | `integer` | Current epoch | | └`slotIndex` | `integer` | Current slot index within the epoch | | └`slotsInEpoch` | `integer` | Total number of slots in the epoch | | └`transactionCount` | `integer` | Current transaction count | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getEpochInfo", "params": { "config": { "commitment": "Processed", "minContextSlot": 123456789 } }} ### getGenesisHash Returns the genesis hash. Result | Field | Type | Description | | --- | --- | --- | | `result` | `string` | getGenesisHash - Returns the genesis hash | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getGenesisHash", "params": []} ### getSlot Returns the current slot. Parameters | Name | Type | Description | | --- | --- | --- | | `config` | `object` | Configuration object for the query. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | | └`minContextSlot` | `integer` | The minimum context slot for the context. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `integer` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getSlot", "params": { "config": { "commitment": "Processed", "minContextSlot": 123456789 } }} ### getBlockHeight Returns the block height. Parameters | Name | Type | Description | | --- | --- | --- | | `config` | `object` | Configuration object for the query. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | | └`minContextSlot` | `integer` | The minimum context slot for the context. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `integer` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getBlockHeight", "params": { "config": { "commitment": "Processed", "minContextSlot": 123456789 } }} ### getHighestSnapshotSlot Returns the highest snapshot slot. Result | Field | Type | Description | | --- | --- | --- | | `full` | `integer` | | | `incremental` | `integer` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getHighestSnapshotSlot", "params": []} ### getTransactionCount Returns the transaction count. Parameters | Name | Type | Description | | --- | --- | --- | | `config` | `object` | Configuration object for the query. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | | └`minContextSlot` | `integer` | The minimum context slot for the context. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `integer` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getTransactionCount", "params": { "config": { "commitment": "Processed", "minContextSlot": 123456789 } }} ### getVersion Returns the version of the cluster. Result | Field | Type | Description | | --- | --- | --- | | `feature-set` | `integer` | | | `solana-core` | `string` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getVersion", "params": []} ### getLeaderSchedule Returns the leader schedule. Parameters | Name | Type | Description | | --- | --- | --- | | `options` | `string` | Wrapper for slot or configuration. | | `config` | `object` | Configuration object for the query. | | └`commitment` | `object` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized'. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | | └`identity` | `string` | Filter by validator identity. | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getLeaderSchedule", "params": { "options": 0, "config": { "commitment": { "commitment": "Processed" }, "identity": "" } }} [Node Health\ \ Monitor node status, health checks, and cluster information](https://docs.surfpool.run/rpc/node) [Admin\ \ Administrative controls for managing the Surfnet instance](https://docs.surfpool.run/rpc/admin) ### On this page [getMinimumBalanceForRentExemption](https://docs.surfpool.run/rpc/network#getMinimumBalanceForRentExemption) [getInflationGovernor](https://docs.surfpool.run/rpc/network#getInflationGovernor) [getInflationRate](https://docs.surfpool.run/rpc/network#getInflationRate) [getEpochSchedule](https://docs.surfpool.run/rpc/network#getEpochSchedule) [getSlotLeader](https://docs.surfpool.run/rpc/network#getSlotLeader) [getSlotLeaders](https://docs.surfpool.run/rpc/network#getSlotLeaders) [getBlockProduction](https://docs.surfpool.run/rpc/network#getBlockProduction) [getInflationReward](https://docs.surfpool.run/rpc/network#getInflationReward) [getRecentPerformanceSamples](https://docs.surfpool.run/rpc/network#getRecentPerformanceSamples) [getMaxRetransmitSlot](https://docs.surfpool.run/rpc/network#getMaxRetransmitSlot) [getMaxShredInsertSlot](https://docs.surfpool.run/rpc/network#getMaxShredInsertSlot) [minimumLedgerSlot](https://docs.surfpool.run/rpc/network#minimumLedgerSlot) [getBlock](https://docs.surfpool.run/rpc/network#getBlock) [getBlockTime](https://docs.surfpool.run/rpc/network#getBlockTime) [getBlocks](https://docs.surfpool.run/rpc/network#getBlocks) [getBlocksWithLimit](https://docs.surfpool.run/rpc/network#getBlocksWithLimit) [getFirstAvailableBlock](https://docs.surfpool.run/rpc/network#getFirstAvailableBlock) [getLatestBlockhash](https://docs.surfpool.run/rpc/network#getLatestBlockhash) [isBlockhashValid](https://docs.surfpool.run/rpc/network#isBlockhashValid) [getRecentPrioritizationFees](https://docs.surfpool.run/rpc/network#getRecentPrioritizationFees) [getEpochInfo](https://docs.surfpool.run/rpc/network#getEpochInfo) [getGenesisHash](https://docs.surfpool.run/rpc/network#getGenesisHash) [getSlot](https://docs.surfpool.run/rpc/network#getSlot) [getBlockHeight](https://docs.surfpool.run/rpc/network#getBlockHeight) [getHighestSnapshotSlot](https://docs.surfpool.run/rpc/network#getHighestSnapshotSlot) [getTransactionCount](https://docs.surfpool.run/rpc/network#getTransactionCount) [getVersion](https://docs.surfpool.run/rpc/network#getVersion) [getLeaderSchedule](https://docs.surfpool.run/rpc/network#getLeaderSchedule) { "jsonrpc": "2.0", "id": 1, "method": "getMinimumBalanceForRentExemption", "params": { "dataLen": 0, "commitment": { "commitment": "Processed" } } } { "jsonrpc": "2.0", "id": 1, "method": "getInflationGovernor", "params": { "commitment": { "commitment": "Processed" } } } { "jsonrpc": "2.0", "id": 1, "method": "getInflationRate", "params": [] } { "jsonrpc": "2.0", "id": 1, "method": "getEpochSchedule", "params": [] } { "jsonrpc": "2.0", "id": 1, "method": "getSlotLeader", "params": { "config": { "commitment": "Processed", "minContextSlot": 123456789 } } } { "jsonrpc": "2.0", "id": 1, "method": "getSlotLeaders", "params": { "startSlot": 123456789, "limit": 0 } } { "jsonrpc": "2.0", "id": 1, "method": "getBlockProduction", "params": { "config": { "commitment": { "commitment": "Processed" }, "identity": "", "range": { "firstSlot": 123456789, "lastSlot": 123456789 } } } } { "jsonrpc": "2.0", "id": 1, "method": "getInflationReward", "params": { "addresses": [\ "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri"\ ], "config": { "commitment": "Processed", "epoch": 100, "minContextSlot": 123456789 } } } { "jsonrpc": "2.0", "id": 1, "method": "getRecentPerformanceSamples", "params": { "limit": 0 } } { "jsonrpc": "2.0", "id": 1, "method": "getMaxRetransmitSlot", "params": [] } { "jsonrpc": "2.0", "id": 1, "method": "getMaxShredInsertSlot", "params": [] } { "jsonrpc": "2.0", "id": 1, "method": "minimumLedgerSlot", "params": [] } { "jsonrpc": "2.0", "id": 1, "method": "getBlock", "params": { "slot": 123456789, "config": { "commitment": { "commitment": "Processed" }, "encoding": "binary", "maxSupportedTransactionVersion": 0, "rewards": true, "transactionDetails": "full" } } } { "jsonrpc": "2.0", "id": 1, "method": "getBlockTime", "params": { "slot": 123456789 } } { "jsonrpc": "2.0", "id": 1, "method": "getBlocks", "params": { "startSlot": 123456789, "wrapper": 0, "config": { "commitment": "Processed", "minContextSlot": 123456789 } } } { "jsonrpc": "2.0", "id": 1, "method": "getBlocksWithLimit", "params": { "startSlot": 123456789, "limit": 0, "config": { "commitment": "Processed", "minContextSlot": 123456789 } } } { "jsonrpc": "2.0", "id": 1, "method": "getFirstAvailableBlock", "params": [] } { "jsonrpc": "2.0", "id": 1, "method": "getLatestBlockhash", "params": { "config": { "commitment": "Processed", "minContextSlot": 123456789 } } } { "jsonrpc": "2.0", "id": 1, "method": "isBlockhashValid", "params": { "blockhash": "EkSnNWid2cvwEVnVx9aBqawnmiCNiDgp3gUdkDPTKN1N", "config": { "commitment": "Processed", "minContextSlot": 123456789 } } } { "jsonrpc": "2.0", "id": 1, "method": "getRecentPrioritizationFees", "params": { "pubkeys": [] } } { "jsonrpc": "2.0", "id": 1, "method": "getEpochInfo", "params": { "config": { "commitment": "Processed", "minContextSlot": 123456789 } } } { "jsonrpc": "2.0", "id": 1, "method": "getGenesisHash", "params": [] } { "jsonrpc": "2.0", "id": 1, "method": "getSlot", "params": { "config": { "commitment": "Processed", "minContextSlot": 123456789 } } } { "jsonrpc": "2.0", "id": 1, "method": "getBlockHeight", "params": { "config": { "commitment": "Processed", "minContextSlot": 123456789 } } } { "jsonrpc": "2.0", "id": 1, "method": "getHighestSnapshotSlot", "params": [] } { "jsonrpc": "2.0", "id": 1, "method": "getTransactionCount", "params": { "config": { "commitment": "Processed", "minContextSlot": 123456789 } } } { "jsonrpc": "2.0", "id": 1, "method": "getVersion", "params": [] } { "jsonrpc": "2.0", "id": 1, "method": "getLeaderSchedule", "params": { "options": 0, "config": { "commitment": { "commitment": "Processed" }, "identity": "" } } } --- # SVM Signers | Surfpool Docs Infrastructure as CodeSVM Addon SVM Signers =========== Signers for Solana and SVM Compatible Blockchains These signers are available when using the SVM addon for transaction signing. [secret\_key](https://docs.surfpool.run/iac/svm/signers#secret_key) -------------------------------------------------------------------- The `svm::secret_key` signer can be used to synchronously sign a transaction using a secret key, mnemonic, or keypair file. ### [Inputs](https://docs.surfpool.run/iac/svm/signers#inputs) | Name | Required | Type | Description | | --- | --- | --- | --- | | `secret_key` | optional | string | The secret key used to sign messages and transactions | | `mnemonic` | optional | string | The mnemonic phrase used to generate the secret key | | `derivation_path` | optional | string | The derivation path used to generate the secret key | | `keypair_json` | optional | string | A path to a keypair.json file containing the secret key | ### [Outputs](https://docs.surfpool.run/iac/svm/signers#outputs) | Name | Type | Description | | --- | --- | --- | | `public_key` | string | The public key of the account | | `address` | string | The SVM address (alias for public\_key) | signer "deployer" "svm::secret_key" { secret_key = input.secret_key } You can also use a mnemonic: signer "deployer" "svm::secret_key" { mnemonic = input.mnemonic derivation_path = "m/44'/501'/0'/0'" } Or a keypair file: signer "deployer" "svm::secret_key" { keypair_json = "~/.config/solana/id.json" } * * * [web\_wallet](https://docs.surfpool.run/iac/svm/signers#web_wallet) -------------------------------------------------------------------- The `svm::web_wallet` signer will allow a Runbook operator to sign the transaction with the browser signer of their choice. ### [Inputs](https://docs.surfpool.run/iac/svm/signers#inputs-1) | Name | Required | Type | Description | | --- | --- | --- | --- | | `expected_address` | optional | string | The SVM address expected to connect (omit to allow any) | ### [Outputs](https://docs.surfpool.run/iac/svm/signers#outputs-1) | Name | Type | Description | | --- | --- | --- | | `address` | string | The address of the connected account | | `public_key` | string | The public key of the connected account | signer "alice" "svm::web_wallet" { expected_address = "zbBjhHwuqyKMmz8ber5oUtJJ3ZV4B6ePmANfGyKzVGV" } This signer will prompt the user in the Web UI to: 1. Connect their wallet 2. Provide a public key via message signature 3. Sign all transactions requiring this signer * * * [squads](https://docs.surfpool.run/iac/svm/signers#squads) ----------------------------------------------------------- The `svm::squads` signer can be used to sign transactions with a Squads multisig vault. ### [Inputs](https://docs.surfpool.run/iac/svm/signers#inputs-2) | Name | Required | Type | Description | | --- | --- | --- | --- | | `address` | optional | string | The squad vault address | ### [Outputs](https://docs.surfpool.run/iac/svm/signers#outputs-2) | Name | Type | Description | | --- | --- | --- | | `public_key` | string | The public key of the squad vault | | `address` | string | The SVM address (alias for public\_key) | signer "deployer" "svm::squads" { address = input.address } Using Squads multisig allows for secure, multi-party transaction signing without exposing individual private keys. [SVM Actions\ \ Actions for Solana and SVM Compatible Blockchains](https://docs.surfpool.run/iac/svm/actions) [Video Tutorials\ \ Learn Surfpool through our video tutorial series](https://docs.surfpool.run/resources/video-tutorials) ### On this page [secret\_key](https://docs.surfpool.run/iac/svm/signers#secret_key) [Inputs](https://docs.surfpool.run/iac/svm/signers#inputs) [Outputs](https://docs.surfpool.run/iac/svm/signers#outputs) [web\_wallet](https://docs.surfpool.run/iac/svm/signers#web_wallet) [Inputs](https://docs.surfpool.run/iac/svm/signers#inputs-1) [Outputs](https://docs.surfpool.run/iac/svm/signers#outputs-1) [squads](https://docs.surfpool.run/iac/svm/signers#squads) [Inputs](https://docs.surfpool.run/iac/svm/signers#inputs-2) [Outputs](https://docs.surfpool.run/iac/svm/signers#outputs-2) --- # Accounts | Surfpool Docs RPC Accounts ======== Query account states, balances, and token holdings on Surfnet Query account states, balances, token holdings, and program-specific storage data. ### getProgramAccounts Get program accounts owned by a specific program ID. Parameters | Name | Type | Description | | --- | --- | --- | | `programId`\* | `string` | The public key of the program, as a base-58 encoded string. | | `config` | `object` | Configuration object for the query. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | | └`dataSlice` | `object` | The data slice configuration. | | └`length` | `integer` | The length of the data slice. | | └`offset` | `integer` | The offset of the data slice. | | └`encoding` | `string` | The encoding for the account data. | | └`filters` | `array` | Filters to apply to the program accounts. Each filter is a base58-encoded string representing an address or a specific filter type. | | └`minContextSlot` | `integer` | The minimum context slot for the account info. | | └`sortResults` | `boolean` | Whether to sort the results. | | └`withContext` | `boolean` | Whether to include the context in the response. | Result | Field | Type | Description | | --- | --- | --- | | `result` | `array` | getProgramAccounts - Returns program-owned accounts | | └`[]` | `object` | Array item | | └`account` | `object` | | | └`data` | `array` | Account data | | └`executable` | `boolean` | Whether this account contains executable code | | └`lamports` | `integer` | Account balance in lamports | | └`owner` | `string` | Program that owns this account | | └`rentEpoch` | `integer` | Epoch at which this account will next owe rent | | └`pubkey` | `string` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getProgramAccounts", "params": { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", "config": { "commitment": "Processed", "dataSlice": { "length": 0, "offset": 0 }, "encoding": "binary", "filters": [], "minContextSlot": 123456789, "sortResults": true, "withContext": true } }} ### getLargestAccounts Returns the 20 largest accounts by lamport balance. Parameters | Name | Type | Description | | --- | --- | --- | | `config` | `object` | Configuration object for the query. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | | └`filter` | `string` | The filter to apply to the largest accounts. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `array` | | | └`[]` | `object` | Array item | | └`address` | `string` | | | └`lamports` | `integer` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getLargestAccounts", "params": { "config": { "commitment": "Processed", "filter": "circulating" } }} ### getSupply Returns information about the current token supply. Parameters | Name | Type | Description | | --- | --- | --- | | `config` | `object` | Configuration object for the query. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | | └`excludeNonCirculatingAccountsList` | `boolean` | Whether to exclude non-circulating accounts. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `object` | | | └`circulating` | `integer` | | | └`nonCirculating` | `integer` | | | └`nonCirculatingAccounts` | `array` | | | └`total` | `integer` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getSupply", "params": { "config": { "commitment": "Processed", "excludeNonCirculatingAccountsList": true } }} ### getTokenLargestAccounts Returns the largest accounts for a given token mint. Parameters | Name | Type | Description | | --- | --- | --- | | `mint`\* | `string` | The public key of the token mint, as a base-58 encoded string. | | `commitment` | `object` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized'. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `array` | | | └`[]` | `object` | Array item | | └`address` | `string` | | | └`amount` | `string` | Token amount as string | | └`decimals` | `integer` | Number of decimals | | └`uiAmount` | `number` | Human readable amount as float | | └`uiAmountString` | `string` | Human readable amount as string | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getTokenLargestAccounts", "params": { "mint": "", "commitment": { "commitment": "Processed" } }} ### getTokenAccountsByOwner Returns all SPL Token accounts by owner. Parameters | Name | Type | Description | | --- | --- | --- | | `owner`\* | `string` | The public key of the account owner, as a base-58 encoded string. | | `config` | `object` | Configuration object for the query. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | | └`dataSlice` | `object` | The data slice configuration. | | └`length` | `integer` | The length of the data slice. | | └`offset` | `integer` | The offset of the data slice. | | └`encoding` | `string` | The encoding for the account data. | | └`minContextSlot` | `integer` | The minimum context slot for the account info. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `array` | | | └`[]` | `object` | Array item | | └`account` | `object` | | | └`data` | `array` | Account data | | └`executable` | `boolean` | Whether this account contains executable code | | └`lamports` | `integer` | Account balance in lamports | | └`owner` | `string` | Program that owns this account | | └`rentEpoch` | `integer` | Epoch at which this account will next owe rent | | └`pubkey` | `string` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getTokenAccountsByOwner", "params": { "mint": "" }} ### getTokenAccountsByDelegate Returns all SPL Token accounts by delegate. Parameters | Name | Type | Description | | --- | --- | --- | | `delegate`\* | `string` | The public key of the delegate, as a base-58 encoded string. | | `config` | `object` | Configuration object for the query. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | | └`dataSlice` | `object` | The data slice configuration. | | └`length` | `integer` | The length of the data slice. | | └`offset` | `integer` | The offset of the data slice. | | └`encoding` | `string` | The encoding for the account data. | | └`minContextSlot` | `integer` | The minimum context slot for the account info. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `array` | | | └`[]` | `object` | Array item | | └`account` | `object` | | | └`data` | `array` | Account data | | └`executable` | `boolean` | Whether this account contains executable code | | └`lamports` | `integer` | Account balance in lamports | | └`owner` | `string` | Program that owns this account | | └`rentEpoch` | `integer` | Epoch at which this account will next owe rent | | └`pubkey` | `string` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getTokenAccountsByDelegate", "params": { "mint": "" }} ### getAccountInfo Returns detailed information about an account given its public key. Parameters | Name | Type | Description | | --- | --- | --- | | `pubkey`\* | `string` | The public key of the account to query, as a base-58 encoded string. | | `config` | `object` | Configuration object for the query. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | | └`dataSlice` | `object` | The data slice configuration. | | └`length` | `integer` | The length of the data slice. | | └`offset` | `integer` | The offset of the data slice. | | └`encoding` | `string` | The encoding for the account data. | | └`minContextSlot` | `integer` | The minimum context slot for the account info. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `object` | | | └`data` | `array` | Account data | | └`executable` | `boolean` | Whether this account contains executable code | | └`lamports` | `integer` | Account balance in lamports | | └`owner` | `string` | Program that owns this account | | └`rentEpoch` | `integer` | Epoch at which this account will next owe rent | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getAccountInfo", "params": { "pubkey": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri", "config": { "commitment": "Processed", "dataSlice": { "length": 0, "offset": 0 }, "encoding": "binary", "minContextSlot": 123456789 } }} ### getBlockCommitment Returns commitment levels for a given block (slot). Parameters | Name | Type | Description | | --- | --- | --- | | `block`\* | `integer` | The slot to query for block commitment. | Result | Field | Type | Description | | --- | --- | --- | | `commitment` | `array` | | | `totalStake` | `integer` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getBlockCommitment", "params": { "block": 0 }} ### getMultipleAccounts Returns account information for multiple public keys in a single call. Parameters | Name | Type | Description | | --- | --- | --- | | `pubkeys`\* | `array[string]` | An array of public keys to query, as base-58 encoded strings. | | `config` | `object` | Configuration object for the query. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | | └`dataSlice` | `object` | The data slice configuration. | | └`length` | `integer` | The length of the data slice. | | └`offset` | `integer` | The offset of the data slice. | | └`encoding` | `string` | The encoding for the account data. | | └`minContextSlot` | `integer` | The minimum context slot for the account info. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `array` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getMultipleAccounts", "params": { "pubkeys": [ "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri" ], "config": { "commitment": "Processed", "dataSlice": { "length": 0, "offset": 0 }, "encoding": "binary", "minContextSlot": 123456789 } }} ### getTokenAccountBalance Returns the balance of a token account, given its public key. Parameters | Name | Type | Description | | --- | --- | --- | | `pubkey`\* | `string` | The public key of the token account to query, as a base-58 encoded string. | | `commitment` | `object` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized'. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `object` | | | └`amount` | `string` | Token amount as string | | └`decimals` | `integer` | Number of decimals | | └`uiAmount` | `number` | Human readable amount as float | | └`uiAmountString` | `string` | Human readable amount as string | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getTokenAccountBalance", "params": { "pubkey": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri", "commitment": { "commitment": "Processed" } }} ### getTokenSupply Returns the total supply of a token, given its mint address. Parameters | Name | Type | Description | | --- | --- | --- | | `mint`\* | `string` | The public key of the token mint, as a base-58 encoded string. | | `commitment` | `object` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized'. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `object` | | | └`amount` | `string` | Token amount as string | | └`decimals` | `integer` | Number of decimals | | └`uiAmount` | `number` | Human readable amount as float | | └`uiAmountString` | `string` | Human readable amount as string | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getTokenSupply", "params": { "mint": "", "commitment": { "commitment": "Processed" } }} ### getBalance Returns the balance for a given address. Parameters | Name | Type | Description | | --- | --- | --- | | `pubkey`\* | `string` | The public key of the account to query, as a base-58 encoded string. | | `config` | `object` | Configuration object for the query. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | | └`minContextSlot` | `integer` | The minimum context slot for the context. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `integer` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getBalance", "params": { "pubkey": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri", "config": { "commitment": "Processed", "minContextSlot": 123456789 } }} [Transactions\ \ Send, simulate, and inspect transaction data on Surfnet](https://docs.surfpool.run/rpc/transactions) [Cheatcodes\ \ Powerful testing utilities unique to Surfpool for state manipulation](https://docs.surfpool.run/rpc/cheatcodes) ### On this page [getProgramAccounts](https://docs.surfpool.run/rpc/accounts#getProgramAccounts) [getLargestAccounts](https://docs.surfpool.run/rpc/accounts#getLargestAccounts) [getSupply](https://docs.surfpool.run/rpc/accounts#getSupply) [getTokenLargestAccounts](https://docs.surfpool.run/rpc/accounts#getTokenLargestAccounts) [getTokenAccountsByOwner](https://docs.surfpool.run/rpc/accounts#getTokenAccountsByOwner) [getTokenAccountsByDelegate](https://docs.surfpool.run/rpc/accounts#getTokenAccountsByDelegate) [getAccountInfo](https://docs.surfpool.run/rpc/accounts#getAccountInfo) [getBlockCommitment](https://docs.surfpool.run/rpc/accounts#getBlockCommitment) [getMultipleAccounts](https://docs.surfpool.run/rpc/accounts#getMultipleAccounts) [getTokenAccountBalance](https://docs.surfpool.run/rpc/accounts#getTokenAccountBalance) [getTokenSupply](https://docs.surfpool.run/rpc/accounts#getTokenSupply) [getBalance](https://docs.surfpool.run/rpc/accounts#getBalance) { "jsonrpc": "2.0", "id": 1, "method": "getProgramAccounts", "params": { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", "config": { "commitment": "Processed", "dataSlice": { "length": 0, "offset": 0 }, "encoding": "binary", "filters": [], "minContextSlot": 123456789, "sortResults": true, "withContext": true } } } { "jsonrpc": "2.0", "id": 1, "method": "getLargestAccounts", "params": { "config": { "commitment": "Processed", "filter": "circulating" } } } { "jsonrpc": "2.0", "id": 1, "method": "getSupply", "params": { "config": { "commitment": "Processed", "excludeNonCirculatingAccountsList": true } } } { "jsonrpc": "2.0", "id": 1, "method": "getTokenLargestAccounts", "params": { "mint": "", "commitment": { "commitment": "Processed" } } } { "jsonrpc": "2.0", "id": 1, "method": "getTokenAccountsByOwner", "params": { "mint": "" } } { "jsonrpc": "2.0", "id": 1, "method": "getTokenAccountsByDelegate", "params": { "mint": "" } } { "jsonrpc": "2.0", "id": 1, "method": "getAccountInfo", "params": { "pubkey": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri", "config": { "commitment": "Processed", "dataSlice": { "length": 0, "offset": 0 }, "encoding": "binary", "minContextSlot": 123456789 } } } { "jsonrpc": "2.0", "id": 1, "method": "getBlockCommitment", "params": { "block": 0 } } { "jsonrpc": "2.0", "id": 1, "method": "getMultipleAccounts", "params": { "pubkeys": [\ "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri"\ ], "config": { "commitment": "Processed", "dataSlice": { "length": 0, "offset": 0 }, "encoding": "binary", "minContextSlot": 123456789 } } } { "jsonrpc": "2.0", "id": 1, "method": "getTokenAccountBalance", "params": { "pubkey": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri", "commitment": { "commitment": "Processed" } } } { "jsonrpc": "2.0", "id": 1, "method": "getTokenSupply", "params": { "mint": "", "commitment": { "commitment": "Processed" } } } { "jsonrpc": "2.0", "id": 1, "method": "getBalance", "params": { "pubkey": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri", "config": { "commitment": "Processed", "minContextSlot": 123456789 } } } --- # Node Health | Surfpool Docs RPC Node Health =========== Monitor node status, health checks, and cluster information Monitor node status, health checks, cluster information, and validator details. ### getClusterNodes Returns the cluster nodes. Result | Field | Type | Description | | --- | --- | --- | | `result` | `array` | getClusterNodes - Returns cluster nodes information | | └`[]` | `object` | Array item | | └`featureSet` | `integer` | | | └`gossip` | `object` | | | └`ip` | `string` | | | └`port` | `integer` | | | └`pubkey` | `string` | | | └`pubsub` | `object` | | | └`ip` | `string` | | | └`port` | `integer` | | | └`rpc` | `object` | | | └`ip` | `string` | | | └`port` | `integer` | | | └`serveRepair` | `object` | | | └`ip` | `string` | | | └`port` | `integer` | | | └`shredVersion` | `integer` | | | └`tpu` | `object` | | | └`ip` | `string` | | | └`port` | `integer` | | | └`tpuForwards` | `object` | | | └`ip` | `string` | | | └`port` | `integer` | | | └`tpuForwardsQuic` | `object` | | | └`ip` | `string` | | | └`port` | `integer` | | | └`tpuQuic` | `object` | | | └`ip` | `string` | | | └`port` | `integer` | | | └`tpuVote` | `object` | | | └`ip` | `string` | | | └`port` | `integer` | | | └`tvu` | `object` | | | └`ip` | `string` | | | └`port` | `integer` | | | └`version` | `string` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getClusterNodes", "params": []} ### getHealth Returns the health of the cluster. Result | Field | Type | Description | | --- | --- | --- | | `result` | `string` | getHealth - Returns the health of the cluster | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getHealth", "params": []} ### getIdentity Returns the identity of the cluster. Result | Field | Type | Description | | --- | --- | --- | | `identity` | `string` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getIdentity", "params": {}} ### getVoteAccounts Returns the vote accounts. Parameters | Name | Type | Description | | --- | --- | --- | | `config` | `object` | Configuration object for the query. | | └`commitment` | `object` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized'. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | | └`delinquentSlotDistance` | `integer` | The distance in slots to consider a vote account delinquent. | | └`keepUnstakedDelinquents` | `boolean` | Whether to keep unstaked delinquent vote accounts. | | └`votePubkey` | `string` | Filter by vote account public key. | Result | Field | Type | Description | | --- | --- | --- | | `current` | `array` | | | └`[]` | `object` | Array item | | └`activatedStake` | `integer` | | | └`commission` | `integer` | | | └`epochCredits` | `array` | | | └`epochVoteAccount` | `boolean` | | | └`lastVote` | `integer` | | | └`nodePubkey` | `string` | | | └`rootSlot` | `integer` | | | └`votePubkey` | `string` | | | `delinquent` | `array` | | | └`[]` | `object` | Array item | | └`activatedStake` | `integer` | | | └`commission` | `integer` | | | └`epochCredits` | `array` | | | └`epochVoteAccount` | `boolean` | | | └`lastVote` | `integer` | | | └`nodePubkey` | `string` | | | └`rootSlot` | `integer` | | | └`votePubkey` | `string` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getVoteAccounts", "params": { "config": { "commitment": { "commitment": "Processed" }, "delinquentSlotDistance": 123456789, "keepUnstakedDelinquents": true, "votePubkey": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri" } }} [Cheatcodes\ \ Powerful testing utilities unique to Surfpool for state manipulation](https://docs.surfpool.run/rpc/cheatcodes) [Network\ \ Access network-wide information like epoch data and performance metrics](https://docs.surfpool.run/rpc/network) ### On this page [getClusterNodes](https://docs.surfpool.run/rpc/node#getClusterNodes) [getHealth](https://docs.surfpool.run/rpc/node#getHealth) [getIdentity](https://docs.surfpool.run/rpc/node#getIdentity) [getVoteAccounts](https://docs.surfpool.run/rpc/node#getVoteAccounts) { "jsonrpc": "2.0", "id": 1, "method": "getClusterNodes", "params": [] } { "jsonrpc": "2.0", "id": 1, "method": "getHealth", "params": [] } { "jsonrpc": "2.0", "id": 1, "method": "getIdentity", "params": {} } { "jsonrpc": "2.0", "id": 1, "method": "getVoteAccounts", "params": { "config": { "commitment": { "commitment": "Processed" }, "delinquentSlotDistance": 123456789, "keepUnstakedDelinquents": true, "votePubkey": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri" } } } --- # SVM Functions | Surfpool Docs Infrastructure as CodeSVM Addon SVM Functions ============= Functions for Solana and SVM Compatible Blockchains These functions are available when using the SVM addon for Solana and SVM-compatible blockchains. [system\_program\_id](https://docs.surfpool.run/iac/svm/functions#system_program_id) ------------------------------------------------------------------------------------- `svm::system_program_id` returns the id of the system program, `11111111111111111111111111111111`. output "system_program_id" { value = svm::system_program_id() } // > 11111111111111111111111111111111 * * * [default\_pubkey](https://docs.surfpool.run/iac/svm/functions#default_pubkey) ------------------------------------------------------------------------------ `svm::default_pubkey` returns a default public key, `11111111111111111111111111111111`. output "default_pubkey" { value = svm::default_pubkey() } // > 11111111111111111111111111111111 * * * [get\_instruction\_data\_from\_idl\_path](https://docs.surfpool.run/iac/svm/functions#get_instruction_data_from_idl_path) -------------------------------------------------------------------------------------------------------------------------- `svm::get_instruction_data_from_idl_path` creates encoded instruction data for a program invocation, providing type checking and serialization based on the provided IDL file. ### [Inputs](https://docs.surfpool.run/iac/svm/functions#inputs) | Name | Required | Type | Description | | --- | --- | --- | --- | | `idl_path` | required | string | The path, relative to the txtx.yml, to the IDL `.json` file | | `instruction_name` | required | string | The name of the instruction to generate data for | | `arguments` | optional | array\[string\] | The instruction arguments to generate data for | output "data" { value = svm::get_instruction_data_from_idl("/path/to/idl.json", "my_instruction", ["arg1", "arg2"]) } // > data: 0x95763bdcc47fa1b305000000776f726c64 * * * [get\_instruction\_data\_from\_idl](https://docs.surfpool.run/iac/svm/functions#get_instruction_data_from_idl) --------------------------------------------------------------------------------------------------------------- `svm::get_instruction_data_from_idl` creates encoded instruction data for a program invocation, providing type checking and serialization based on the provided IDL data. ### [Inputs](https://docs.surfpool.run/iac/svm/functions#inputs-1) | Name | Required | Type | Description | | --- | --- | --- | --- | | `idl` | required | string \| SVM\_IDL | The program IDL | | `instruction_name` | required | string | The name of the instruction to generate data for, as indexed by the IDL | | `arguments` | optional | array\[string\] | The instruction arguments to generate data for | output "data" { value = svm::get_instruction_data_from_idl(variable.contract.idl, "my_instruction", ["arg1", "arg2"]) } // > data: 0x95763bdcc47fa1b305000000776f726c64 * * * [get\_program\_from\_anchor\_project](https://docs.surfpool.run/iac/svm/functions#get_program_from_anchor_project) ------------------------------------------------------------------------------------------------------------------- `svm::get_program_from_anchor_project` retrieves the program deployment artifacts for a program in an Anchor project. ### [Inputs](https://docs.surfpool.run/iac/svm/functions#inputs-2) | Name | Required | Type | Description | | --- | --- | --- | --- | | `program_name` | required | string | The name of the program being deployed | | `keypair_path` | optional | string | The location of the program keypair file | | `idl_path` | optional | string | The location of the program IDL file | | `bin_path` | optional | string | The location of the program binary file | variable "contract" { value = svm::get_program_from_anchor_project("my_program") } output "idl" { value = variable.contract.idl } * * * [get\_program\_from\_native\_project](https://docs.surfpool.run/iac/svm/functions#get_program_from_native_project) ------------------------------------------------------------------------------------------------------------------- `svm::get_program_from_native_project` retrieves the program deployment artifacts for a non-Anchor program. ### [Inputs](https://docs.surfpool.run/iac/svm/functions#inputs-3) | Name | Required | Type | Description | | --- | --- | --- | --- | | `program_name` | required | string | The name of the program being deployed | | `keypair_path` | optional | string | The location of the program keypair file | | `idl_path` | optional | string | The location of the program IDL file | | `bin_path` | optional | string | The location of the program binary file | variable "contract" { value = svm::get_program_from_native_project("my_program") } output "idl" { value = variable.contract.idl } * * * [sol\_to\_lamports](https://docs.surfpool.run/iac/svm/functions#sol_to_lamports) --------------------------------------------------------------------------------- `svm::sol_to_lamports` converts the provided SOL amount to lamports. output "lamports" { value = svm::sol_to_lamports(1.1) } // lamports: 1100000000 * * * [lamports\_to\_sol](https://docs.surfpool.run/iac/svm/functions#lamports_to_sol) --------------------------------------------------------------------------------- `svm::lamports_to_sol` converts the provided number of lamports amount to SOL. output "sol" { value = svm::lamports_to_sol(1100000000) } // sol: 1.1 * * * [find\_pda](https://docs.surfpool.run/iac/svm/functions#find_pda) ------------------------------------------------------------------ `svm::find_pda` finds a valid PDA using the provided program id and seeds. ### [Inputs](https://docs.surfpool.run/iac/svm/functions#inputs-4) | Name | Required | Type | Description | | --- | --- | --- | --- | | `program_id` | required | string | The address of the program the PDA is derived from | | `seeds` | optional | array\[string\] | An optional array of seeds (max 16, 32 bytes each) | variable "pda" { value = svm::find_pda("3bv3j4GvMPjvvBX9QdoX27pVoWhDSXpwKZipFF1QiVr6", ["data"]) } output "pda" { value = std::encode_base58(variable.pda.pda) } output "bump" { value = variable.pda.bump_seed } // > pda: 4amHoWMBgLkPfM8Nq9ZP33Liq9FCuqrLoU1feejkdsUJ // > bump: 252 * * * [get\_associated\_token\_account](https://docs.surfpool.run/iac/svm/functions#get_associated_token_account) ------------------------------------------------------------------------------------------------------------ `svm::get_associated_token_account` computes the address of the associated token account for the provided wallet and token mint addresses. ### [Inputs](https://docs.surfpool.run/iac/svm/functions#inputs-5) | Name | Required | Type | Description | | --- | --- | --- | --- | | `wallet_address` | required | string | The address of the wallet | | `token_mint_address` | optional | string | The address of the token mint | variable "token_account" { value = svm::get_associated_token_account(signer.caller.address, "So11111111111111111111111111111111111111112") } * * * [create\_token\_account\_instruction](https://docs.surfpool.run/iac/svm/functions#create_token_account_instruction) -------------------------------------------------------------------------------------------------------------------- `svm::create_token_account_instruction` creates raw instruction bytes to create an associated token account. ### [Inputs](https://docs.surfpool.run/iac/svm/functions#inputs-6) | Name | Required | Type | Description | | --- | --- | --- | --- | | `funding_address` | required | string | The address of the funding account | | `wallet_address` | required | string | The address of the wallet | | `token_mint_address` | optional | string | The address of the token mint | | `token_program_id` | optional | string | The address of the token program | action "call" "svm::process_instructions" { signers = [signer.caller] instruction { raw_bytes = svm::create_token_account_instruction( signer.caller.address, // funding address signer.caller.address, // wallet address variable.token_mint, // token mint address variable.token_program // token program id ) } } * * * [u64](https://docs.surfpool.run/iac/svm/functions#u64) ------------------------------------------------------- `svm::u64` creates a byte array representation of a u64 integer, suitable for use as a seed in PDA derivation. ### [Inputs](https://docs.surfpool.run/iac/svm/functions#inputs-7) | Name | Required | Type | Description | | --- | --- | --- | --- | | `value` | required | integer | The u64 integer to convert to a byte array | variable "pda" { value = svm::find_pda("3bv3j4GvMPjvvBX9QdoX27pVoWhDSXpwKZipFF1QiVr6", [svm::u64(1000000000)]) } * * * [i64](https://docs.surfpool.run/iac/svm/functions#i64) ------------------------------------------------------- `svm::i64` creates a byte array representation of an i64 integer, suitable for use as a seed in PDA derivation. ### [Inputs](https://docs.surfpool.run/iac/svm/functions#inputs-8) | Name | Required | Type | Description | | --- | --- | --- | --- | | `value` | required | integer | The i64 integer to convert to a byte array | variable "pda" { value = svm::find_pda("3bv3j4GvMPjvvBX9QdoX27pVoWhDSXpwKZipFF1QiVr6", [svm::i64(-1000000000)]) } [SVM Addon Overview\ \ Add-on for Solana and SVM Compatible Blockchains (beta)](https://docs.surfpool.run/iac/svm/overview) [SVM Actions\ \ Actions for Solana and SVM Compatible Blockchains](https://docs.surfpool.run/iac/svm/actions) ### On this page [system\_program\_id](https://docs.surfpool.run/iac/svm/functions#system_program_id) [default\_pubkey](https://docs.surfpool.run/iac/svm/functions#default_pubkey) [get\_instruction\_data\_from\_idl\_path](https://docs.surfpool.run/iac/svm/functions#get_instruction_data_from_idl_path) [Inputs](https://docs.surfpool.run/iac/svm/functions#inputs) [get\_instruction\_data\_from\_idl](https://docs.surfpool.run/iac/svm/functions#get_instruction_data_from_idl) [Inputs](https://docs.surfpool.run/iac/svm/functions#inputs-1) [get\_program\_from\_anchor\_project](https://docs.surfpool.run/iac/svm/functions#get_program_from_anchor_project) [Inputs](https://docs.surfpool.run/iac/svm/functions#inputs-2) [get\_program\_from\_native\_project](https://docs.surfpool.run/iac/svm/functions#get_program_from_native_project) [Inputs](https://docs.surfpool.run/iac/svm/functions#inputs-3) [sol\_to\_lamports](https://docs.surfpool.run/iac/svm/functions#sol_to_lamports) [lamports\_to\_sol](https://docs.surfpool.run/iac/svm/functions#lamports_to_sol) [find\_pda](https://docs.surfpool.run/iac/svm/functions#find_pda) [Inputs](https://docs.surfpool.run/iac/svm/functions#inputs-4) [get\_associated\_token\_account](https://docs.surfpool.run/iac/svm/functions#get_associated_token_account) [Inputs](https://docs.surfpool.run/iac/svm/functions#inputs-5) [create\_token\_account\_instruction](https://docs.surfpool.run/iac/svm/functions#create_token_account_instruction) [Inputs](https://docs.surfpool.run/iac/svm/functions#inputs-6) [u64](https://docs.surfpool.run/iac/svm/functions#u64) [Inputs](https://docs.surfpool.run/iac/svm/functions#inputs-7) [i64](https://docs.surfpool.run/iac/svm/functions#i64) [Inputs](https://docs.surfpool.run/iac/svm/functions#inputs-8) --- # Transactions | Surfpool Docs RPC Transactions ============ Send, simulate, and inspect transaction data on Surfnet These methods handle the creation, simulation, and inspection of transactions on the blockchain. They are essential for executing state changes, estimating fees, checking transaction outcomes, and monitoring transaction lifecycles. ### getSignatureStatuses Returns the signature statuses for a given signature. Parameters | Name | Type | Description | | --- | --- | --- | | `signatures`\* | `array[string]` | An array of transaction signatures to query, as base-58 encoded strings. | | `config` | `object` | Configuration object for the query. | | └`searchTransactionHistory` | `boolean` | Whether to search the transaction history. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `array` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getSignatureStatuses", "params": { "signatures": [\ "5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW"\ ], "config": { "searchTransactionHistory": true } } } ### requestAirdrop Requests an airdrop to a given address. Parameters | Name | Type | Description | | --- | --- | --- | | `pubkey`\* | `string` | The public key of the account to receive the airdrop, as a base-58 encoded string. | | `lamports`\* | `integer` | The amount of lamports to airdrop. | | `config` | `object` | Configuration object for the query. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | Result | Field | Type | Description | | --- | --- | --- | | `result` | `string` | requestAirdrop - Requests an airdrop to a given address | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "requestAirdrop", "params": { "pubkey": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri", "lamports": 1000000000, "config": { "commitment": "Processed" } } } ### sendTransaction Sends a transaction to the cluster. Parameters | Name | Type | Description | | --- | --- | --- | | `transaction`\* | `string` | The signed transaction, as a base-64 encoded string. | | `config` | `object` | Configuration object for the query. | | └`encoding` | `string` | The encoding for the transaction. | | └`maxRetries` | `integer` | The maximum number of retries for the transaction. | | └`minContextSlot` | `integer` | The minimum context slot for the transaction. | | └`preflightCommitment` | `string` | The commitment level for the preflight check. | | └`skipPreflight` | `boolean` | Whether to skip the preflight check. | Result | Field | Type | Description | | --- | --- | --- | | `result` | `string` | sendTransaction - Sends a transaction to the cluster | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "sendTransaction", "params": { "transaction": "", "config": { "encoding": "binary", "maxRetries": 0, "minContextSlot": 123456789, "preflightCommitment": "Processed", "skipPreflight": true } } } ### simulateTransaction Simulates a transaction. Parameters | Name | Type | Description | | --- | --- | --- | | `transaction`\* | `string` | The transaction to simulate, as a base-64 encoded string. | | `config` | `object` | Configuration object for the query. | | └`accounts` | `object` | Accounts to return in the simulation result. | | └`addresses` | `array[string]` | An array of account addresses to return, as base-58 encoded strings. | | └`encoding` | `string` | Encoding for the account data. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | | └`encoding` | `string` | Encoding for the transaction data. | | └`innerInstructions` | `boolean` | Whether to include inner instructions in the simulation result. | | └`minContextSlot` | `integer` | Mincontextslot | | └`replaceRecentBlockhash` | `boolean` | Whether to replace the recent blockhash with a new one. | | └`sigVerify` | `boolean` | Whether to verify transaction signatures. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `object` | | | └`accounts` | `array` | | | └`err` | `object` | | | └`errorType` | `string` | Error type | | └`message` | `string` | Error message | | └`innerInstructions` | `array` | | | └`logs` | `array` | | | └`replacementBlockhash` | `object` | | | └`blockhash` | `string` | | | └`lastValidBlockHeight` | `integer` | | | └`returnData` | `object` | | | └`data` | `array` | Returned data | | └`programId` | `string` | Program ID that returned the data | | └`unitsConsumed` | `integer` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "simulateTransaction", "params": { "transaction": "", "config": { "accounts": { "addresses": [\ "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri"\ ], "encoding": "binary" }, "commitment": "Processed", "encoding": "binary", "innerInstructions": true, "minContextSlot": 123456789, "replaceRecentBlockhash": true, "sigVerify": true } } } ### getTransaction Returns the transaction for a given signature. Parameters | Name | Type | Description | | --- | --- | --- | | `signature`\* | `string` | The transaction signature to query, as a base-58 encoded string. | | `config` | `object` | Configuration object for the query. | | └`commitment` | `object` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized'. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | | └`maxSupportedTransactionVersion` | `integer` | The maximum transaction version to support. | Result | Field | Type | Description | | --- | --- | --- | | `blockTime` | `integer` | Block time | | `meta` | `object` | Transaction metadata | | └`computeUnitsConsumed` | `integer` | Compute units consumed | | └`err` | `object` | Transaction error | | └`errorType` | `string` | Error type | | └`message` | `string` | Error message | | └`fee` | `integer` | Transaction fee | | └`innerInstructions` | `array` | Inner instructions | | └`logMessages` | `array` | Log messages | | └`postBalances` | `array` | Account balances after transaction | | └`postTokenBalances` | `array` | Post token balances | | └`preBalances` | `array` | Account balances before transaction | | └`preTokenBalances` | `array` | Pre token balances | | └`returnData` | `object` | Return data | | └`data` | `array` | Returned data | | └`programId` | `string` | Program ID that returned the data | | `slot` | `integer` | The transaction slot | | `transaction` | `object` | The encoded transaction | | └`message` | `object` | Transaction message | | └`accountKeys` | `array` | List of account keys | | └`addressTableLookups` | `array` | List of address table lookups | | └`instructions` | `array` | List of instructions | | └`[]` | `object` | Array item | | └`accounts` | `array` | Account indices | | └`data` | `string` | Instruction data | | └`programIdIndex` | `integer` | Program ID index | | └`numReadonlySignedAccounts` | `integer` | Number of readonly signed accounts | | └`numReadonlyUnsignedAccounts` | `integer` | Number of readonly unsigned accounts | | └`numRequiredSignatures` | `integer` | Number of required signatures | | └`recentBlockhash` | `string` | Recent blockhash | | └`signatures` | `array` | List of signatures | | `version` | `integer` | Transaction version | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getTransaction", "params": { "signature": "5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW", "config": { "commitment": { "commitment": "Processed" }, "maxSupportedTransactionVersion": 0 } } } ### getSignaturesForAddress Returns the signatures for a given address. Parameters | Name | Type | Description | | --- | --- | --- | | `address`\* | `string` | The address to query for transaction signatures, as a base-58 encoded string. | | `before` | `string` | Start searching backwards from this transaction signature. | | `limit` | `integer` | The maximum number of signatures to return. | | `until` | `string` | Search until this transaction signature. | Result | Field | Type | Description | | --- | --- | --- | | `result` | `array` | getSignaturesForAddress - Returns signatures for an address | | └`[]` | `object` | Array item | | └`blockTime` | `integer` | | | └`confirmationStatus` | `object` | | | └`status` | `string` | Confirmation level | | └`err` | `object` | | | └`errorType` | `string` | Error type | | └`message` | `string` | Error message | | └`memo` | `string` | | | └`signature` | `string` | | | └`slot` | `integer` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getSignaturesForAddress", "params": { "address": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri", "before": "", "limit": 0, "until": "" } } ### getFeeForMessage Returns the fee for a given message. Parameters | Name | Type | Description | | --- | --- | --- | | `message`\* | `string` | The message to calculate the fee for, as a base-64 encoded string. | | `config` | `object` | Configuration object for the query. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | | └`minContextSlot` | `integer` | The minimum context slot for the context. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `integer` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getFeeForMessage", "params": { "message": "", "config": { "commitment": "Processed", "minContextSlot": 123456789 } } } ### getStakeMinimumDelegation Returns the stake minimum delegation. Parameters | Name | Type | Description | | --- | --- | --- | | `config` | `object` | Configuration object for the query. | | └`commitment` | `string \| string \| string` | The commitment describes how finalized a block is at that point in time. Options are 'processed', 'confirmed', or 'finalized' | | └`minContextSlot` | `integer` | The minimum context slot for the context. | Result | Field | Type | Description | | --- | --- | --- | | `context` | `object` | | | └`apiVersion` | `string` | The API version | | └`slot` | `integer` | The current slot | | `value` | `integer` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getStakeMinimumDelegation", "params": { "config": { "commitment": "Processed", "minContextSlot": 123456789 } } } [Introducing Surfnet\ \ Learn about Surfnet, Surfpool's local Solana network simulator and RPC API](https://docs.surfpool.run/rpc/overview) [Accounts\ \ Query account states, balances, and token holdings on Surfnet](https://docs.surfpool.run/rpc/accounts) ### On this page [getSignatureStatuses](https://docs.surfpool.run/rpc/transactions#getSignatureStatuses) [requestAirdrop](https://docs.surfpool.run/rpc/transactions#requestAirdrop) [sendTransaction](https://docs.surfpool.run/rpc/transactions#sendTransaction) [simulateTransaction](https://docs.surfpool.run/rpc/transactions#simulateTransaction) [getTransaction](https://docs.surfpool.run/rpc/transactions#getTransaction) [getSignaturesForAddress](https://docs.surfpool.run/rpc/transactions#getSignaturesForAddress) [getFeeForMessage](https://docs.surfpool.run/rpc/transactions#getFeeForMessage) [getStakeMinimumDelegation](https://docs.surfpool.run/rpc/transactions#getStakeMinimumDelegation) --- # Admin | Surfpool Docs RPC Admin ===== Administrative controls for managing the Surfnet instance Administrative controls for managing the Surfnet instance, plugins, and system configuration. ### exit Immediately shuts down the RPC server. Result | Field | Type | Description | | --- | --- | --- | | `result` | `null` | exit - Immediately shuts down the RPC server | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "exit", "params": [] } ### reloadPlugin Reloads a runtime plugin with new configuration. Parameters | Name | Type | Description | | --- | --- | --- | | `name`\* | `string` | The name of the plugin to reload. | | `configFile`\* | `string` | The path to the new configuration file for the plugin. | Result | Field | Type | Description | | --- | --- | --- | | `configFile` | `string` | | | `name` | `string` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "reloadPlugin", "params": { "name": "", "configFile": "" } } ### unloadPlugin Unloads a runtime plugin. Parameters | Name | Type | Description | | --- | --- | --- | | `name`\* | `string` | The name of the plugin to unload. | Result | Field | Type | Description | | --- | --- | --- | | `name` | `string` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "unloadPlugin", "params": { "name": "" } } ### loadPlugin Dynamically loads a new plugin into the runtime from a configuration file. Parameters | Name | Type | Description | | --- | --- | --- | | `configFile`\* | `string` | The path to the configuration file for the new plugin. | Result | Field | Type | Description | | --- | --- | --- | | `configFile` | `string` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "loadPlugin", "params": { "configFile": "" } } ### listPlugins Returns a list of all currently loaded plugin names. Result | Field | Type | Description | | --- | --- | --- | | `result` | `array` | listPlugins - Lists all loaded plugins | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "listPlugins", "params": [] } ### rpcAddress Returns the address of the RPC server. Result | Field | Type | Description | | --- | --- | --- | | `ip` | `string` | | | `port` | `integer` | | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "rpcAddress", "params": [] } ### setLogFilter Sets a filter for log messages in the system. Parameters | Name | Type | Description | | --- | --- | --- | | `filter`\* | `string` | The log filter string to apply. | Result | Field | Type | Description | | --- | --- | --- | | `result` | `null` | setLogFilter - Sets log filter | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "setLogFilter", "params": { "filter": "" } } ### startTime Returns the system start time. Result | Field | Type | Description | | --- | --- | --- | | `nanos` | `integer` | Nanoseconds | | `secsSinceEpoch` | `integer` | Seconds since Unix epoch | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "startTime", "params": [] } ### addAuthorizedVoter Adds an authorized voter to the system. Parameters | Name | Type | Description | | --- | --- | --- | | `keypairFile`\* | `string` | Path to the keypair file for the authorized voter. | Result | Field | Type | Description | | --- | --- | --- | | `result` | `null` | addAuthorizedVoter - Adds authorized voter | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "addAuthorizedVoter", "params": { "keypairFile": "" } } ### addAuthorizedVoterFromBytes Adds an authorized voter to the system using a byte-encoded keypair. Parameters | Name | Type | Description | | --- | --- | --- | | `keypair`\* | `array[integer]` | Byte array representing the keypair for the authorized voter. | Result | Field | Type | Description | | --- | --- | --- | | `result` | `null` | addAuthorizedVoterFromBytes - Adds voter from bytes | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "addAuthorizedVoterFromBytes", "params": { "keypair": [\ 0\ ] } } ### removeAllAuthorizedVoters Removes all authorized voters from the system. Result | Field | Type | Description | | --- | --- | --- | | `result` | `null` | removeAllAuthorizedVoters - Removes all voters | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "removeAllAuthorizedVoters", "params": [] } ### setIdentity Sets the identity for the system using the provided keypair. Parameters | Name | Type | Description | | --- | --- | --- | | `keypairFile`\* | `string` | Path to the keypair file to be used as the node's identity. | | `requireTower`\* | `boolean` | Boolean indicating if a tower is required for this identity. | Result | Field | Type | Description | | --- | --- | --- | | `result` | `null` | setIdentity - Sets cluster identity | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "setIdentity", "params": { "keypairFile": "", "requireTower": true } } ### setIdentityFromBytes Sets the identity for the system using a keypair provided as a byte array. Parameters | Name | Type | Description | | --- | --- | --- | | `identityKeypair`\* | `array[integer]` | Byte array representing the identity keypair. | | `requireTower`\* | `boolean` | Boolean indicating if a tower is required for this identity. | Result | Field | Type | Description | | --- | --- | --- | | `result` | `null` | setIdentityFromBytes - Sets identity from bytes | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "setIdentityFromBytes", "params": { "identityKeypair": [\ 0\ ], "requireTower": true } } ### setStakedNodesOverrides Sets the overrides for staked nodes using a specified path. Parameters | Name | Type | Description | | --- | --- | --- | | `path`\* | `string` | Path to the file containing staked nodes overrides. | Result | Field | Type | Description | | --- | --- | --- | | `result` | `null` | setStakedNodesOverrides - Sets staked nodes overrides | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "setStakedNodesOverrides", "params": { "path": "" } } ### repairShredFromPeer Repairs a shred from a peer node in the network. Parameters | Name | Type | Description | | --- | --- | --- | | `pubkey` | `string` | The public key of the peer to repair from, as a base-58 encoded string. | | `slot`\* | `integer` | The slot of the shred to repair. | | `shredIndex`\* | `integer` | The index of the shred to repair. | Result | Field | Type | Description | | --- | --- | --- | | `result` | `null` | repairShredFromPeer - Repairs shred from peer | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "repairShredFromPeer", "params": { "pubkey": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri", "slot": 123456789, "shredIndex": 0 } } ### setRepairWhitelist Sets the whitelist of nodes allowed to repair shreds. Parameters | Name | Type | Description | | --- | --- | --- | | `whitelist`\* | `array[string]` | A list of public keys (base-58 encoded strings) to set as the repair whitelist. | Result | Field | Type | Description | | --- | --- | --- | | `result` | `null` | setRepairWhitelist - Sets repair whitelist | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "setRepairWhitelist", "params": { "whitelist": [\ ""\ ] } } ### getSecondaryIndexKeySize Retrieves the size of the secondary index key for a given account. Parameters | Name | Type | Description | | --- | --- | --- | | `pubkeyStr`\* | `string` | The public key of the account to get the secondary index key size for, as a base-58 encoded string. | Result | Field | Type | Description | | --- | --- | --- | | `result` | `integer` | getSecondaryIndexKeySize - Gets secondary index key size | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "getSecondaryIndexKeySize", "params": { "pubkeyStr": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri" } } ### setPublicTpuAddress Sets the public TPU (Transaction Processing Unit) address. Parameters | Name | Type | Description | | --- | --- | --- | | `publicTpuAddr`\* | `string` | The public TPU address as a string. | Result | Field | Type | Description | | --- | --- | --- | | `result` | `null` | setPublicTpuAddress - Sets public TPU address | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "setPublicTpuAddress", "params": { "publicTpuAddr": "" } } ### setPublicTpuForwardsAddress Sets the public TPU forwards address. Parameters | Name | Type | Description | | --- | --- | --- | | `publicTpuForwardsAddr`\* | `string` | The public TPU forwards address as a string. | Result | Field | Type | Description | | --- | --- | --- | | `result` | `null` | setPublicTpuForwardsAddress - Sets public TPU forwards address | Example RequestResponse { "jsonrpc": "2.0", "id": 1, "method": "setPublicTpuForwardsAddress", "params": { "publicTpuForwardsAddr": "" } } [Network\ \ Access network-wide information like epoch data and performance metrics](https://docs.surfpool.run/rpc/network) [WebSocket RPC Methods\ \ Real-time WebSocket subscriptions for monitoring blockchain state changes](https://docs.surfpool.run/rpc/websockets) ### On this page [exit](https://docs.surfpool.run/rpc/admin#exit) [reloadPlugin](https://docs.surfpool.run/rpc/admin#reloadPlugin) [unloadPlugin](https://docs.surfpool.run/rpc/admin#unloadPlugin) [loadPlugin](https://docs.surfpool.run/rpc/admin#loadPlugin) [listPlugins](https://docs.surfpool.run/rpc/admin#listPlugins) [rpcAddress](https://docs.surfpool.run/rpc/admin#rpcAddress) [setLogFilter](https://docs.surfpool.run/rpc/admin#setLogFilter) [startTime](https://docs.surfpool.run/rpc/admin#startTime) [addAuthorizedVoter](https://docs.surfpool.run/rpc/admin#addAuthorizedVoter) [addAuthorizedVoterFromBytes](https://docs.surfpool.run/rpc/admin#addAuthorizedVoterFromBytes) [removeAllAuthorizedVoters](https://docs.surfpool.run/rpc/admin#removeAllAuthorizedVoters) [setIdentity](https://docs.surfpool.run/rpc/admin#setIdentity) [setIdentityFromBytes](https://docs.surfpool.run/rpc/admin#setIdentityFromBytes) [setStakedNodesOverrides](https://docs.surfpool.run/rpc/admin#setStakedNodesOverrides) [repairShredFromPeer](https://docs.surfpool.run/rpc/admin#repairShredFromPeer) [setRepairWhitelist](https://docs.surfpool.run/rpc/admin#setRepairWhitelist) [getSecondaryIndexKeySize](https://docs.surfpool.run/rpc/admin#getSecondaryIndexKeySize) [setPublicTpuAddress](https://docs.surfpool.run/rpc/admin#setPublicTpuAddress) [setPublicTpuForwardsAddress](https://docs.surfpool.run/rpc/admin#setPublicTpuForwardsAddress) --- # SVM Actions | Surfpool Docs Infrastructure as CodeSVM Addon SVM Actions =========== Actions for Solana and SVM Compatible Blockchains These actions are available when using the SVM addon for transaction building, signing, and broadcasting. [deploy\_program](https://docs.surfpool.run/iac/svm/actions#deploy_program) ---------------------------------------------------------------------------- `svm::deploy_program` deploys a Solana program to the specified SVM-compatible network. ### [Inputs](https://docs.surfpool.run/iac/svm/actions#inputs) | Name | Required | Type | Description | | --- | --- | --- | --- | | `description` | optional | string | A description of the deployment action | | `program` | required | object | The Solana program artifacts to deploy | | `payer` | optional | string | A reference to a signer for paying deployment costs | | `authority` | required | string | A reference to a signer for the program authority | | `commitment_level` | optional | string | The commitment level ('processed', 'confirmed', 'finalized') | | `auto_extend` | optional | bool | Whether to auto extend the program account (default: true) | ### [Outputs](https://docs.surfpool.run/iac/svm/actions#outputs) | Name | Type | Description | | --- | --- | --- | | `signatures` | object | The computed transaction signatures | | `program_id` | string | The program ID of the deployed program | | `program_idl` | string | The program IDL | action "deploy" "svm::deploy_program" { description = "Deploy hello world program" program = svm::get_program_from_anchor_project("hello_world") authority = signer.authority payer = signer.payer # Optional, defaults to authority } * * * [process\_instructions](https://docs.surfpool.run/iac/svm/actions#process_instructions) ---------------------------------------------------------------------------------------- The `svm::process_instructions` action encodes instructions, adds them to a transaction, and signs & broadcasts the transaction. ### [Inputs](https://docs.surfpool.run/iac/svm/actions#inputs-1) | Name | Required | Type | Description | | --- | --- | --- | --- | | `description` | optional | string | A description of the transaction | | `instruction` | required | map | The instructions to add to the transaction | | `signers` | required | array\[string\] | References to signer constructs | | `commitment_level` | optional | string | The commitment level | | `rpc_api_url` | required | string | The URL for API requests | ### [Outputs](https://docs.surfpool.run/iac/svm/actions#outputs-1) | Name | Type | Description | | --- | --- | --- | | `signature` | string | The transaction computed signature | action "program_call" "svm::process_instructions" { description = "Invoke instructions" instruction { program_idl = variable.program.idl instruction_name = "initialize" instruction_args = [1] payer { public_key = signer.payer.public_key } } signers = [signer.caller] } * * * [send\_sol](https://docs.surfpool.run/iac/svm/actions#send_sol) ---------------------------------------------------------------- The `svm::send_sol` action encodes a transaction which sends SOL, signs it, and broadcasts it to the network. ### [Inputs](https://docs.surfpool.run/iac/svm/actions#inputs-2) | Name | Required | Type | Description | | --- | --- | --- | --- | | `description` | optional | string | A description of the transaction | | `amount` | required | integer | The amount to send, in lamports | | `recipient` | required | string | The SVM address of the recipient | | `signer` | required | string | A reference to a signer construct | | `commitment_level` | optional | string | The commitment level | | `rpc_api_url` | required | string | The URL for API requests | ### [Outputs](https://docs.surfpool.run/iac/svm/actions#outputs-2) | Name | Type | Description | | --- | --- | --- | | `signature` | string | The transaction computed signature | action "send_sol" "svm::send_sol" { description = "Send some SOL" amount = svm::sol_to_lamports(1) signer = signer.caller recipient = "zbBjhHwuqyKMmz8ber5oUtJJ3ZV4B6ePmANfGyKzVGV" } * * * [send\_token](https://docs.surfpool.run/iac/svm/actions#send_token) -------------------------------------------------------------------- The `svm::send_token` action encodes a transaction which sends the specified token, signs it, and broadcasts it to the network. ### [Inputs](https://docs.surfpool.run/iac/svm/actions#inputs-3) | Name | Required | Type | Description | | --- | --- | --- | --- | | `description` | optional | string | A description of the transaction | | `amount` | required | integer | The amount of tokens to send, in base unit | | `token` | required | string | The token mint account address | | `recipient` | required | string | The SVM address of the recipient | | `authority` | optional | string | The pubkey of the authority account | | `fund_recipient` | optional | bool | Create and fund recipient token account if needed | | `signers` | required | array\[string\] | References to signer constructs | ### [Outputs](https://docs.surfpool.run/iac/svm/actions#outputs-3) | Name | Type | Description | | --- | --- | --- | | `signature` | string | The transaction computed signature | | `recipient_token_address` | pubkey | The recipient token account address | | `source_token_address` | pubkey | The source token account address | | `token_mint_address` | pubkey | The token mint address | action "send_sol" "svm::send_token" { description = "Send some tokens" amount = 1000000 signers = [signer.caller] recipient = "zbBjhHwuqyKMmz8ber5oUtJJ3ZV4B6ePmANfGyKzVGV" token = "3bv3j4GvMPjvvBX9QdoX27pVoWhDSXpwKZipFF1QiVr6" fund_recipient = true } * * * [setup\_surfnet](https://docs.surfpool.run/iac/svm/actions#setup_surfnet) -------------------------------------------------------------------------- `svm::setup_surfnet` can be used to configure a surfnet. The following operations are supported: * `set_account` - Set the lamports, owner, data, and executable fields of an account * `set_token_account` - Set the amount, delegate, delegated amount, and close authority for a token account * `clone_program_account` - Clone a program account from a source program ID to a destination program ID * `set_program_authority` - Set the authority of a program * `deploy_program` - Deploy a program directly to the surfnet (via direct account write, not transactions) * `reset_account` - Reset an account, removing it from local cache to be re-fetched from upstream * `stream_account` - Stream account data from mainnet so local data always matches mainnet ### [Inputs](https://docs.surfpool.run/iac/svm/actions#inputs-4) | Name | Required | Type | Description | | --- | --- | --- | --- | | `description` | optional | string | A description of the setup | | `rpc_api_url` | required | string | The URL for API requests | ### [set\_account](https://docs.surfpool.run/iac/svm/actions#set_account) Sets account data directly on the surfnet. | Name | Required | Type | Description | | --- | --- | --- | --- | | `public_key` | required | string | The public key of the account to set | | `account_path` | optional | string | The path to a JSON file containing the account data to set. If provided, other fields are ignored | | `lamports` | optional | integer | The amount of lamports the account should be set to have | | `data` | optional | bytes | The data to set in the account | | `owner` | optional | string | The owner to set for the account | | `executable` | optional | bool | The executability state to set for the account | | `rent_epoch` | optional | integer | The epoch at which the account will be rent-exempt | At least one of `lamports`, `data`, `owner`, `executable`, or `rent_epoch` must be provided (unless using `account_path`). ### [set\_token\_account](https://docs.surfpool.run/iac/svm/actions#set_token_account) Sets token account data on the surfnet. The associated token account is automatically derived from the owner's public key and token mint. | Name | Required | Type | Description | | --- | --- | --- | --- | | `public_key` | required | string | The public key of the token owner account to update | | `token` | required | string | The token symbol (e.g., "usdc", "bonk") or public key for the token mint | | `token_program` | optional | string | The token program ID. Valid values are `token2020`, `token2022`, or a public key (default: `token2020`) | | `amount` | optional | integer | The amount of tokens to set | | `delegate` | optional | string | The public key of the delegate to set, or null to clear | | `state` | optional | string | The state of the token account. Valid values are `initialized`, `frozen`, or `uninitialized` | | `delegated_amount` | optional | integer | The amount of tokens to delegate | | `close_authority` | optional | string | The public key of the close authority to set, or null to clear | At least one of `amount`, `delegate`, `state`, `delegated_amount`, or `close_authority` must be provided. ### [clone\_program\_account](https://docs.surfpool.run/iac/svm/actions#clone_program_account) Clones a program account from one program ID to another on the surfnet. | Name | Required | Type | Description | | --- | --- | --- | --- | | `source_program_id` | required | string | The public key of the program to clone | | `destination_program_id` | required | string | The destination public key of the program | ### [set\_program\_authority](https://docs.surfpool.run/iac/svm/actions#set_program_authority) Sets or removes the upgrade authority of a program on the surfnet. | Name | Required | Type | Description | | --- | --- | --- | --- | | `program_id` | required | string | The public key of the program to set the authority for | | `authority` | optional | string | The new authority for the program. If not provided, program's authority will be set to None (making it immutable) | ### [deploy\_program](https://docs.surfpool.run/iac/svm/actions#deploy_program-1) Deploys a program directly to the surfnet via account data write (not via transactions). | Name | Required | Type | Description | | --- | --- | --- | --- | | `program_id` | required | string | The public key of the program being deployed | | `binary_path` | required | string | The location of the program's .so file (e.g., `./target/deploy/my_program.so`) | | `authority` | optional | string | The public key of the authority over the program after it is deployed. If not provided, the program will have no authority | | `idl_path` | optional | string | The location of the program's IDL file (e.g., `./target/idl/my_program.json`) | ### [reset\_account](https://docs.surfpool.run/iac/svm/actions#reset_account) Resets an account on the surfnet, removing it from the local cache so it will be re-fetched from the upstream network. | Name | Required | Type | Description | | --- | --- | --- | --- | | `public_key` | required | string | The public key of the account to reset | | `include_owned_accounts` | optional | bool | Whether to recursively delete all accounts owned by this account. Default is false | ### [stream\_account](https://docs.surfpool.run/iac/svm/actions#stream_account) Streams account data from the mainnet RPC URL to the surfnet, keeping the local account data in sync with mainnet. | Name | Required | Type | Description | | --- | --- | --- | --- | | `public_key` | required | string | The public key of the account to stream | | `include_owned_accounts` | optional | bool | Whether to recursively stream all accounts owned by this account. Default is false | action "setup" "svm::setup_surfnet" { // Set account balance set_account { public_key = signer.caller.public_key lamports = 999999999 } // Set token balance set_token_account { public_key = signer.caller.public_key token = "usdc" amount = 1000000 } // Clone a program clone_program_account { source_program_id = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" destination_program_id = variable.my_program_id } // Set program authority set_program_authority { program_id = variable.my_program_id authority = signer.caller.public_key } // Deploy a program directly deploy_program { program_id = variable.my_program_id binary_path = "./target/deploy/my_program.so" idl_path = "./target/idl/my_program.json" } // Reset an account to re-fetch from upstream reset_account { public_key = variable.some_pubkey } // Stream account data from mainnet stream_account { public_key = variable.some_pubkey include_owned_accounts = true } } * * * [deploy\_subgraph](https://docs.surfpool.run/iac/svm/actions#deploy_subgraph) ------------------------------------------------------------------------------ `svm::deploy_subgraph` creates a live GraphQL database for your program. ### [Inputs](https://docs.surfpool.run/iac/svm/actions#inputs-5) | Name | Required | Type | Description | | --- | --- | --- | --- | | `description` | optional | string | A description of the subgraph | | `subgraph_name` | optional | string | The name of the subgraph | | `program_id` | required | string | The ID of the program to index | | `program_idl` | required | string | The IDL of the program | | `block_height` | required | integer | The block height to start indexing from | | `event` | required | map | Events to index in the subgraph | action "transfer_event_subgraph" "svm::deploy_subgraph" { program_id = action.deploy.program_id program_idl = action.deploy.program_idl block_height = action.deploy.block_height event { name = "TransferEvent" } } [SVM Functions\ \ Functions for Solana and SVM Compatible Blockchains](https://docs.surfpool.run/iac/svm/functions) [SVM Signers\ \ Signers for Solana and SVM Compatible Blockchains](https://docs.surfpool.run/iac/svm/signers) ### On this page [deploy\_program](https://docs.surfpool.run/iac/svm/actions#deploy_program) [Inputs](https://docs.surfpool.run/iac/svm/actions#inputs) [Outputs](https://docs.surfpool.run/iac/svm/actions#outputs) [process\_instructions](https://docs.surfpool.run/iac/svm/actions#process_instructions) [Inputs](https://docs.surfpool.run/iac/svm/actions#inputs-1) [Outputs](https://docs.surfpool.run/iac/svm/actions#outputs-1) [send\_sol](https://docs.surfpool.run/iac/svm/actions#send_sol) [Inputs](https://docs.surfpool.run/iac/svm/actions#inputs-2) [Outputs](https://docs.surfpool.run/iac/svm/actions#outputs-2) [send\_token](https://docs.surfpool.run/iac/svm/actions#send_token) [Inputs](https://docs.surfpool.run/iac/svm/actions#inputs-3) [Outputs](https://docs.surfpool.run/iac/svm/actions#outputs-3) [setup\_surfnet](https://docs.surfpool.run/iac/svm/actions#setup_surfnet) [Inputs](https://docs.surfpool.run/iac/svm/actions#inputs-4) [set\_account](https://docs.surfpool.run/iac/svm/actions#set_account) [set\_token\_account](https://docs.surfpool.run/iac/svm/actions#set_token_account) [clone\_program\_account](https://docs.surfpool.run/iac/svm/actions#clone_program_account) [set\_program\_authority](https://docs.surfpool.run/iac/svm/actions#set_program_authority) [deploy\_program](https://docs.surfpool.run/iac/svm/actions#deploy_program-1) [reset\_account](https://docs.surfpool.run/iac/svm/actions#reset_account) [stream\_account](https://docs.surfpool.run/iac/svm/actions#stream_account) [deploy\_subgraph](https://docs.surfpool.run/iac/svm/actions#deploy_subgraph) [Inputs](https://docs.surfpool.run/iac/svm/actions#inputs-5) --- # Standard Actions | Surfpool Docs Infrastructure as CodeStandard Library Standard Actions ================ Actions available in the standard library These actions are available in all Runbooks as part of the standard library. [send\_http\_request](https://docs.surfpool.run/iac/std/actions#send_http_request) ----------------------------------------------------------------------------------- The `std::send_http_request` action makes an HTTP request to the specified URL. ### [Inputs](https://docs.surfpool.run/iac/std/actions#inputs) | Name | Required | Type | Description | | --- | --- | --- | --- | | `url` | required | string | The URL to send the request to | | `method` | optional | string | The HTTP method (GET, POST, PUT, DELETE). Default: GET | | `headers` | optional | map | HTTP headers to include in the request | | `body` | optional | string | The request body (for POST/PUT requests) | | `timeout_ms` | optional | integer | Request timeout in milliseconds | ### [Outputs](https://docs.surfpool.run/iac/std/actions#outputs) | Name | Type | Description | | --- | --- | --- | | `status_code` | integer | The HTTP status code | | `body` | string | The response body | | `headers` | map | The response headers | action "api_call" "std::send_http_request" { description = "Fetch data from API" url = "https://api.example.com/data" method = "GET" headers = { "Authorization" = "Bearer ${variable.token}" } } output "response" { value = action.api_call.body } output "status" { value = action.api_call.status_code } ### [POST Request Example](https://docs.surfpool.run/iac/std/actions#post-request-example) action "create_resource" "std::send_http_request" { description = "Create a new resource" url = "https://api.example.com/resources" method = "POST" headers = { "Content-Type" = "application/json" } body = { "name" = variable.name, "value" = variable.value } } [read\_file](https://docs.surfpool.run/iac/std/actions#read_file) ------------------------------------------------------------------ The `std::read_file` action reads the contents of a file. ### [Inputs](https://docs.surfpool.run/iac/std/actions#inputs-1) | Name | Required | Type | Description | | --- | --- | --- | --- | | `path` | required | string | The path to the file to read | ### [Outputs](https://docs.surfpool.run/iac/std/actions#outputs-1) | Name | Type | Description | | --- | --- | --- | | `content` | string | The file contents | action "config" "std::read_file" { path = "./config.json" } variable "parsed_config" { value = std::jq(action.config.content, ".") } [write\_file](https://docs.surfpool.run/iac/std/actions#write_file) -------------------------------------------------------------------- The `std::write_file` action writes content to a file. ### [Inputs](https://docs.surfpool.run/iac/std/actions#inputs-2) | Name | Required | Type | Description | | --- | --- | --- | --- | | `path` | required | string | The path to the file to write | | `content` | required | string | The content to write to the file | action "save_output" "std::write_file" { path = "./output.json" content = { "result" = variable.result, "timestamp" = variable.timestamp } } [Standard Functions\ \ Utility functions available in the standard library](https://docs.surfpool.run/iac/std/functions) [SVM Addon Overview\ \ Add-on for Solana and SVM Compatible Blockchains (beta)](https://docs.surfpool.run/iac/svm/overview) ### On this page [send\_http\_request](https://docs.surfpool.run/iac/std/actions#send_http_request) [Inputs](https://docs.surfpool.run/iac/std/actions#inputs) [Outputs](https://docs.surfpool.run/iac/std/actions#outputs) [POST Request Example](https://docs.surfpool.run/iac/std/actions#post-request-example) [read\_file](https://docs.surfpool.run/iac/std/actions#read_file) [Inputs](https://docs.surfpool.run/iac/std/actions#inputs-1) [Outputs](https://docs.surfpool.run/iac/std/actions#outputs-1) [write\_file](https://docs.surfpool.run/iac/std/actions#write_file) [Inputs](https://docs.surfpool.run/iac/std/actions#inputs-2) --- # Standard Library Overview | Surfpool Docs Infrastructure as CodeStandard Library Standard Library Overview ========================= The standard library provides core functions and actions available to all Runbooks. The standard library provides core functions and actions that are available to all Runbooks regardless of which blockchain addons are enabled. [Functions](https://docs.surfpool.run/iac/std/overview#functions) ------------------------------------------------------------------ The standard library includes utility functions for: * **Operators**: Mathematical operations and comparisons * **Hash**: Hashing functions (SHA256, Keccak256, etc.) * **Hex**: Hex encoding and decoding * **Crypto**: Cryptographic operations * **JSON**: JSON encoding and decoding * **List**: List manipulation functions * **Assertions**: Equality and condition assertions * **Base64**: Base64 encoding and decoding [View all functions](https://docs.surfpool.run/iac/std/functions) [Actions](https://docs.surfpool.run/iac/std/overview#actions) -------------------------------------------------------------- The standard library includes actions for: * **HTTP**: Making HTTP requests * **File Operations**: Reading and writing files [View all actions](https://docs.surfpool.run/iac/std/actions) [Language & Syntax\ \ Use the txtx DSL to describe the deployments that surfpool manages.](https://docs.surfpool.run/iac/language) [Standard Functions\ \ Utility functions available in the standard library](https://docs.surfpool.run/iac/std/functions) ### On this page [Functions](https://docs.surfpool.run/iac/std/overview#functions) [Actions](https://docs.surfpool.run/iac/std/overview#actions) --- # Standard Functions | Surfpool Docs Infrastructure as CodeStandard Library Standard Functions ================== Utility functions available in the standard library These functions are available in all Runbooks as part of the standard library. [Operators](https://docs.surfpool.run/iac/std/functions#operators) ------------------------------------------------------------------- Basic mathematical and comparison operators: // Addition output "sum" { value = 1 + 2 // or std::add(1, 2) } // Subtraction output "diff" { value = 5 - 3 // or std::minus(5, 3) } // Multiplication output "product" { value = 4 * 3 // or std::multiply(4, 3) } // Division output "quotient" { value = 10 / 2 // or std::div(10, 2) } // Modulo output "remainder" { value = 10 % 3 // or std::modulo(10, 3) } [Hash Functions](https://docs.surfpool.run/iac/std/functions#hash-functions) ----------------------------------------------------------------------------- // SHA256 hash output "hash" { value = std::sha256("hello world") } // Keccak256 hash output "keccak" { value = std::keccak256("hello world") } [Hex Functions](https://docs.surfpool.run/iac/std/functions#hex-functions) --------------------------------------------------------------------------- // Encode string's raw bytes to hex (returns string with 0x prefix) output "hex" { value = std::encode_hex("hello, world") } // > hex: 0x68656c6c6f2c20776f726c64 // Decode from hex (returns buffer) output "decoded" { value = std::decode_hex("0x68656c6c6f2c20776f726c64") } // > decoded: 0x68656c6c6f2c20776f726c64 [Base58 Functions](https://docs.surfpool.run/iac/std/functions#base58-functions) --------------------------------------------------------------------------------- // Encode to base58 (accepts buffer or hex string) output "base58" { value = std::encode_base58("0x68656c6c6f") } // > base58: Cn8eVZg // Decode from base58 (returns buffer) output "decoded" { value = std::decode_base58("Cn8eVZg") } // > decoded: 0x68656c6c6f [Base64 Functions](https://docs.surfpool.run/iac/std/functions#base64-functions) --------------------------------------------------------------------------------- // Encode to base64 (accepts buffer or hex string) output "encoded" { value = std::encode_base64("0x48656c6c6f20776f726c6421") } // > encoded: SGVsbG8gd29ybGQh // Decode from base64 (returns buffer) output "decoded" { value = std::decode_base64("SGVsbG8gd29ybGQh") } // > decoded: 0x48656c6c6f20776f726c6421 [JSON Functions](https://docs.surfpool.run/iac/std/functions#json-functions) ----------------------------------------------------------------------------- // Query JSON with jq syntax output "message" { value = std::jq("{ \"message\": \"Hello world!\" }", ".message") } [List Functions](https://docs.surfpool.run/iac/std/functions#list-functions) ----------------------------------------------------------------------------- // Get element at index output "entry" { value = std::index(['a', 'b', 'c'], 1) // Returns 'b' } [Assertion Functions](https://docs.surfpool.run/iac/std/functions#assertion-functions) --------------------------------------------------------------------------------------- // Assert equality output "check_eq" { value = std::assert_eq(action.example.result, 1) } // Assert not equal output "check_ne" { value = std::assert_ne(action.example.result, 0) } // Assert greater than / greater than or equal output "check_gt" { value = std::assert_gt(action.example.result, 0) } // Assert less than / less than or equal output "check_lt" { value = std::assert_lt(action.example.result, 100) } [Standard Library Overview\ \ The standard library provides core functions and actions available to all Runbooks.](https://docs.surfpool.run/iac/std/overview) [Standard Actions\ \ Actions available in the standard library](https://docs.surfpool.run/iac/std/actions) ### On this page [Operators](https://docs.surfpool.run/iac/std/functions#operators) [Hash Functions](https://docs.surfpool.run/iac/std/functions#hash-functions) [Hex Functions](https://docs.surfpool.run/iac/std/functions#hex-functions) [Base58 Functions](https://docs.surfpool.run/iac/std/functions#base58-functions) [Base64 Functions](https://docs.surfpool.run/iac/std/functions#base64-functions) [JSON Functions](https://docs.surfpool.run/iac/std/functions#json-functions) [List Functions](https://docs.surfpool.run/iac/std/functions#list-functions) [Assertion Functions](https://docs.surfpool.run/iac/std/functions#assertion-functions) --- # Vercel Security Checkpoint Failed to verify your browser [Website owner? Click here to fix](https://vercel.link/security-checkpoint) Code 10 --- # Vercel Security Checkpoint Failed to verify your browser [Website owner? Click here to fix](https://vercel.link/security-checkpoint) Code 10 ---