### Install scikit-learn for Quickstart Source: https://docs.ar.io/build/verifiable-ai/training-provenance For the quickstart example, install scikit-learn as an additional dependency. This is necessary for certain examples to run correctly. ```bash pip install scikit-learn ``` -------------------------------- ### Install Required Packages (Quick Install) Source: https://docs.ar.io/build/run-a-gateway/quick-start Use this command to quickly install all necessary packages for the gateway. This is the recommended method for a swift setup. ```bash sudo apt update && sudo apt install -y curl git wget ``` -------------------------------- ### Install ar-io-mlflow Source: https://docs.ar.io/llms-full.txt Clone the repository and install the ar-io-mlflow package from source. Install scikit-learn for the quickstart example. ```bash git clone https://github.com/ar-io/ar-io-mlflow.git cd ar-io-mlflow pip install -e . ``` ```bash pip install scikit-learn ``` -------------------------------- ### Production Environment Configuration Example Source: https://docs.ar.io/llms-full.txt Example .env file for a production setup, detailing server, mode, routing, verification, cache, admin, telemetry, and rate limiting configurations. ```bash # .env - Production example # Server PORT=3000 HOST=0.0.0.0 BASE_DOMAIN=yourdomain.com ROOT_HOST_CONTENT=your-arns-name # Mode DEFAULT_MODE=proxy ALLOW_MODE_OVERRIDE=false # Routing ROUTING_STRATEGY=temperature ROUTING_GATEWAY_SOURCE=network # Verification VERIFICATION_ENABLED=true VERIFICATION_GATEWAY_SOURCE=top-staked VERIFICATION_GATEWAY_COUNT=3 ARNS_CONSENSUS_THRESHOLD=2 # Cache CONTENT_CACHE_ENABLED=true CONTENT_CACHE_PATH=./data/content-cache CONTENT_CACHE_MAX_SIZE_BYTES=53687091200 # Admin ADMIN_UI_ENABLED=true ADMIN_PORT=3001 ADMIN_HOST=127.0.0.1 # Telemetry TELEMETRY_ENABLED=true TELEMETRY_DB_PATH=./data/telemetry.db # Rate Limiting RATE_LIMIT_ENABLED=true RATE_LIMIT_MAX_REQUESTS=1000 ``` -------------------------------- ### Install Solana CLI Tools Source: https://docs.ar.io/build/run-a-gateway/manage/solana-migration Use this command to install the Solana CLI tools. Ensure you follow the output for any additional setup steps. ```bash # Install Solana CLI tools sh -c "$(curl -sSfL https://release.anza.xyz/stable/install)" ``` -------------------------------- ### Configure Wayfinder Router (Optional) Source: https://docs.ar.io/build/run-wayfinder-router/quick-start Copy the example environment file and edit it as needed for custom configuration. This step is optional if using the setup wizard. ```bash cp .env.example .env # Edit .env as needed, or skip and use the setup wizard ``` -------------------------------- ### Configure Wayfinder Router with .env File Source: https://docs.ar.io/llms-full.txt Copy the example environment file and edit it to configure the Wayfinder Router. Alternatively, skip this step and use the setup wizard. ```bash cp .env.example .env # Edit .env as needed, or skip and use the setup wizard ``` -------------------------------- ### Install Turbo SDK with bun Source: https://docs.ar.io/sdks/turbo-sdk Use this command to install the Turbo SDK using bun. Ensure you have Node.js and bun installed. ```bash bun add turbo ``` -------------------------------- ### Install Git Source: https://docs.ar.io/build/run-a-gateway/quick-start Download and run the Git installer with default settings to ensure Git is available on your system. ```text Download from $Lef Run installer with default settings ``` -------------------------------- ### Clone ar-io-verify Repository Source: https://docs.ar.io/llms-full.txt Clone the ar-io-verify repository and install its dependencies to get started. ```bash git clone https://github.com/ar-io/ar-io-verify.git cd ar-io-verify pnpm install ``` -------------------------------- ### Get Primary Name Request Example Source: https://docs.ar.io/sdks/ar-io-sdk/primary-names This snippet demonstrates how to construct a request to get primary name information. It specifies the initiator and the name to query, along with start and end timestamps for the query. ```javascript { "initiator": "\\\"t4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3\\\"", "name": "\\\"arns\\\"", "startTimestamp": "1728067635857", "endTimestamp": "1728067635857" } ``` -------------------------------- ### Example package.json for Deploying Parts Source: https://docs.ar.io/build/guides/hosting-decentralised-apps/using-undernames-for-versioning This example shows how to configure deploy scripts in your package.json file to deploy different parts of your application to specific undernames. ```json { "scripts": { "deploy:marketing": "ario-deploy deploy --arns-name your-arns-name --deploy-folder ./marketing/dist --ttl-seconds 3600", "deploy:app": "ario-deploy deploy --arns-name your-arns-name --deploy-folder ./app/dist --ttl-seconds 3600", "deploy:docs": "ario-deploy deploy --arns-name your-arns-name --deploy-folder ./docs/dist --ttl-seconds 3600", "deploy:admin": "ario-deploy deploy --arns-name your-arns-name --deploy-folder ./admin/dist --ttl-seconds 3600" } } ``` -------------------------------- ### Create Environment File Source: https://docs.ar.io/build/run-wayfinder-router/quick-start Create a .env file from the example to configure your environment variables. This is essential for setting up the router. ```bash cp .env.example .env ``` -------------------------------- ### Start ArDrive CLI Source: https://docs.ar.io/llms-full.txt Run this command from the repository root to start the ArDrive CLI after installation and building. ```shell yarn ardrive ``` -------------------------------- ### Install Turbo SDK Source: https://docs.ar.io/build/guides/storing-nfts Install the Turbo SDK using npm. This is the first step before authenticating and uploading. ```bash npm install @ardrive/turbo-sdk ``` -------------------------------- ### Complete Deployment Example Source: https://docs.ar.io/build/guides/working-with-arns/set-arns-records-programmatically This example demonstrates how to upload and set records in a single function call using TurboFactory. Ensure TurboFactory is imported and initialized before use. ```javascript const { TurboFactory } = require("@ar-io/turbo-factory"); const factory = new TurboFactory(); async function uploadAndSetRecords() { const result = await factory.upload( "./path/to/your/file.txt", "./path/to/your/schema.json" ); await factory.setRecords(result.data.id); console.log("File uploaded and records set successfully."); } uploadAndSetRecords(); ``` -------------------------------- ### Example Data Retrieval (GET) Source: https://docs.ar.io/apis/ar-io-node/data This snippet shows a GET request for data retrieval. It highlights the HTTP method used. ```javascript self.__next_f.push([ 1, { "ref": "$undefined", "xmlns": "http://www.w3.org/2000/svg", "width": 24, "height": 24, "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": 2, "strokeLinecap": "round", "strokeLinejoin": "round", "className": "lucide lucide-book-text", "aria-hidden": "true", "children": [ [ "$", "path", "k3hazp", { "d": "M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20" } ], [ "$", "path", "vwpz6n", { "d": "M8 11h8" } ], [ "$", "path", "1f0q6e", { "d": "M8" } ] ] } ]) ``` -------------------------------- ### Top Up with SOL using Turbo Source: https://docs.ar.io/build/upload/advanced-uploading-with-turbo This example demonstrates topping up an account with SOL. Specify the token amount in SOL and optionally add a comment. ```javascript const topUpResult = await turbo.topUpWithTokens({ tokenAmount: "0.1", // 0.1 SOL }); ``` -------------------------------- ### Basic Gateway Setup Environment Variables Source: https://docs.ar.io/build/run-a-gateway/manage/environment-variables Configure core settings, network, and essential data paths for a basic ar.io Gateway deployment. ```bash # Core configuration NODE_ENV=production LOG_LEVEL=info PORT=4000 ADMIN_API_KEY=your-admin-key-here # Network configuration TRUSTED_NODE_URL=https://turbo-gateway.com TRUSTED_GATEWAY_URL=https://turbo-gateway.com # Data paths CHUNKS_DATA_PATH=/data/chunks CONTIGUOUS_DATA_PATH=/data/contiguous SQLITE_DATA_PATH=/data/sqlite ``` -------------------------------- ### Arweave GET Request Example Source: https://docs.ar.io/learn/protocol-architecture This snippet demonstrates how to make a GET request to retrieve data from the Arweave network. It highlights the HTTP method used for such operations. ```javascript 34:[\ ``` ```javascript 35:[\ ``` -------------------------------- ### Install Turbo SDK with npm Source: https://docs.ar.io/build/upload/advanced-uploading-with-turbo Install the Turbo SDK using npm. This is the first step to using the advanced uploading features. ```bash npm install @ar-io/turbo ``` -------------------------------- ### Get File Input Element Source: https://docs.ar.io/sdks/turbo-sdk Example of using querySelector to find a file input element. ```javascript const file = document.querySelector('input[type="file"]'); ``` -------------------------------- ### Start Arweave Gateway Source: https://docs.ar.io/build/run-a-gateway/quick-start Run the Arweave gateway using the command line. Ensure you have completed the installation. ```bash arweave-gateway ``` -------------------------------- ### Setup Complete Website Structure Source: https://docs.ar.io/llms-full.txt Deploys multiple records for a complete website structure, including main site, versions, and documentation folders. Handles deployment errors for each record. ```javascript async function setupWebsiteStructure(arnsName) { const records = [ { undername: "@", folder: "./build", description: "Main site" }, { undername: "v1", folder: "./build-v1", description: "Version 1" }, { undername: "v2", folder: "./build-v2", description: "Version 2" }, { undername: "api", folder: "./api-docs", description: "API documentation", }, { undername: "docs", folder: "./user-docs", description: "User documentation", }, ]; for (const record of records) { try { console.log(`Deploying ${record.description}...`); await deployAndSetRecord(arnsName, record.undername, record.folder); console.log(`✅ ${record.undername} deployed successfully`); } catch (error) { console.error(`❌ Failed to deploy ${record.undername}:`, error.message); } } } // Usage await setupWebsiteStructure("myapp"); ``` -------------------------------- ### Clone ar-io-node Repository Source: https://docs.ar.io/build/run-a-gateway/quick-start Clone the ar-io-node repository to get started. Ensure you checkout the 'main' branch. ```bash git clone -b main https://github.com/ar-io/ar-io-node cd ar-io-node ``` -------------------------------- ### Create and Configure .env File Source: https://docs.ar.io/build/run-a-gateway/quick-start Create a .env file to configure your gateway. Set essential parameters like GraphQL host and port, start height, observer settings, and wallet addresses. ```bash nano .env ``` ```dotenv GRAPHQL_HOST=turbo-gateway.com GRAPHQL_PORT=443 START_HEIGHT=1000000 RUN_OBSERVER=true ARNS_ROOT_HOST= AR_IO_WALLET= OBSERVER_WALLET= ``` -------------------------------- ### Clone ar-io-mlflow Repository Source: https://docs.ar.io/build/verifiable-ai/training-provenance Clone the ar-io-mlflow repository to your local machine. This is the first step to get started with the library. ```bash git clone https://github.com/ar-io/ar-io-mlflow.git cd ar-io-mlflow pip install -e . ``` -------------------------------- ### Initialize Vite Application with React Source: https://docs.ar.io/build/guides/hosting-decentralised-apps/deploying-with-ario-deploy Create a new Vite project with the React template and install dependencies. ```bash npm create vite@latest my-permaweb-app -- --template react cd my-permaweb-app npm install ``` -------------------------------- ### Initialize Vite App with React Source: https://docs.ar.io/llms-full.txt Use this command to create a new Vite application with the React template. Remember to run 'npm install' afterwards. ```bash npm create vite@latest my-permaweb-app -- --template react cd my-permaweb-app npm install ``` -------------------------------- ### Get Local IP Address Source: https://docs.ar.io/build/run-a-gateway/quick-start Find your local machine's IP address for port forwarding setup. ```bash ip addr show | grep -w inet | awk '{print $2}' | awk -F'/' '{print $1}' ``` -------------------------------- ### Turbo Typescript SDK - Get Balance Source: https://docs.ar.io/llms-full.txt Example of checking the current credit balance using the Turbo Typescript SDK. ```APIDOC ## Turbo Typescript SDK - Get Balance ### Description Check your current credit balance using the Turbo Typescript SDK. ### Method `turbo.getBalance` ### Response #### Success Response (200) - **winc** (number) - The current credit balance. ``` -------------------------------- ### Set Up Your Signer Configuration Source: https://docs.ar.io/build/guides/hosting-decentralised-apps/deploy-permanent-dapp Create a shared setup file for Turbo and the Ar.io SDK. This file should contain configurations for both uploading and naming services. ```typescript // // Use this file to configure your signer for both uploads and naming. // It should be shared between your Turbo upload process and the ar.io SDK. // // Example configuration: // { // "arweave_host": "arweave.net", // "arweave_port": 443, // "protocol": "https", // "timeout": 20000, // "logging": false, // "wallet_path": "/path/to/your/wallet.json" // } ``` -------------------------------- ### Gateway Path Example Source: https://docs.ar.io/learn/gateways This snippet illustrates interacting with a gateway via the gateway path. It also shows a GET request. ```javascript 34:[\ ``` -------------------------------- ### Setup Website Structure Source: https://docs.ar.io/build/guides/working-with-arns/set-arns-records-programmatically Iterates through a list of records, deploying each one using the `deployAndSetRecord` function. This is useful for setting up a complex website with multiple subdomains or versions. ```javascript async function setupWebsiteStructure(arnsName) { const records = [ { undername: "@", folder: "./build", description: "Main site" }, { undername: "v1", folder: "./build-v1", description: "Version 1" }, { undername: "v2", folder: "./build-v2", description: "Version 2" }, { undername: "api", folder: "./api-docs", description: "API documentation", }, { undername: "docs", folder: "./user-docs", description: "User documentation", }, ]; for (const record of records) { try { console.log(`Deploying ${record.description}...`); await deployAndSetRecord(arnsName, record.undername, record.folder); console.log(`✅ ${record.undername} deployed successfully`); } catch (error) { console.error(`❌ Failed to deploy ${record.undername}:`, error.message); } } } ``` -------------------------------- ### Clone ar-io-verify Repository Source: https://docs.ar.io/build/verifiable-ai/operator-attestations Clone the ar-io-verify repository to get started with the verification sidecar. This command is typically run in a terminal. ```bash git clone https://github.com/ar-io/ar-io-verify.git cd ar-io-verify ``` -------------------------------- ### Get Main Record Info Source: https://docs.ar.io/build/guides/working-with-arns/set-arns-records-programmatically Fetches information for the main ARNs record. Ensure you have the Arweave SDK installed and configured. ```javascript const mainRecord = await getRecordInfo("myapp", "@"); ``` -------------------------------- ### Arweave Gateway with Custom Configuration Source: https://docs.ar.io/build/run-a-gateway/quick-start Start the Arweave gateway using a custom configuration file. This allows for more advanced setups. ```bash arweave-gateway --config /path/to/your/config.json ``` -------------------------------- ### Complex Multi-Condition Filter Example Source: https://docs.ar.io/build/run-a-gateway/manage/filters Demonstrates a complex filter setup involving multiple conditions. This is useful for advanced routing scenarios. ```json ["$","h3",null,{"className":"flex scroll-m-28 flex-row items-center gap-2","id":"complex-multi-condition-filter","children":["$","a",null,{"data-card":"","href":"#complex-multi-condition-filter","className":"peer","children":"Complex Multi-Condition Filter"},"$","svg",null,{"ref":"$undefined","xmlns":"http://www.w3.org/2000/svg","width":24,"height":24,"viewBox":"0 0 24 24","fill":"none","stroke":"currentColor","strokeWidth":2,"strokeLinecap":"round","strokeLinejoin":"round","className":"lucide size-3.5 shrink-0 text-fd-muted-foreground opacity-0 transition-opacity peer-hover:opacity-100","aria-label":"Link to section","children":[[["$","path","1cjeqo",{"d":"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}],["$","path","19qd67",{"d":"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"]],"$undefined"]}]}]},"$","$La6",null,{"className":"shiki shiki-themes github-light github-dark","style":{"--shiki-light":"#24292e","--shiki-dark":"#e1e4e8","--shiki-light-bg":"#fff","--shiki-dark-bg":"#24292e"},"tabIndex":"0","icon":"","children":"$Lef"}]},"$Lf0","$Lf1"]}]} ``` -------------------------------- ### Setup Signer and SDKs Source: https://docs.ar.io/build/guides/hosting-decentralised-apps/deploy-permanent-dapp Configure your Solana keypair and initialize the ar.io SDK (ARIO) and Turbo for authenticated operations. Load your keypair from a JSON file and ensure it's kept secure. ```typescript // setup.ts import { ARIO, ANT } from '@ar.io/sdk'; import { TurboFactory } from '@ardrive/turbo-sdk'; import { createKeyPairSignerFromBytes } from '@solana/kit'; import bs58 from 'bs58'; import fs from 'fs'; // Load your Solana keypair const keypairBytes = new Uint8Array( JSON.parse(fs.readFileSync('./solana-keypair.json', 'utf-8')), ); // For ar.io SDK (ArNS names, records) export const signer = await createKeyPairSignerFromBytes(keypairBytes); export const ario = ARIO.mainnet({ signer }); // For Turbo (file uploads to Arweave) // Turbo uses its own signer format — pass the secret key as base58 export const turbo = TurboFactory.authenticated({ privateKey: bs58.encode(keypairBytes.slice(0, 32)), token: 'solana', }); ``` -------------------------------- ### Run ar-io-verify Server Source: https://docs.ar.io/build/verifiable-ai/operator-attestations Start the ar-io-verify server in one terminal using the 'dev' script. This is part of the local development setup. ```bash pnpm run dev ``` -------------------------------- ### Install Turbo SDK Source: https://docs.ar.io/build/upload/advanced-uploading-with-turbo Install the Turbo SDK using either npm or Yarn. Choose the command that matches your package manager. ```bash # For Node.js npm install @ardrive/turbo-sdk ``` ```bash # For Yarn users yarn add @ardrive/turbo-sdk ``` -------------------------------- ### Example Production Configuration (.env) Source: https://docs.ar.io/build/run-wayfinder-router/configuration This snippet shows a comprehensive example of a .env file for production deployment, illustrating settings for server, mode, routing, verification, caching, admin UI, telemetry, and rate limiting. ```env # .env - Production example # Server PORT=3000 HOST=0.0.0.0 BASE_DOMAIN=yourdomain.com ROOT_HOST_CONTENT=your-arns-name # Mode DEFAULT_MODE=proxy ALLOW_MODE_OVERRIDE=false # Routing ROUTING_STRATEGY=temperature ROUTING_GATEWAY_SOURCE=network # Verification VERIFICATION_ENABLED=true VERIFICATION_GATEWAY_SOURCE=top-staked VERIFICATION_GATEWAY_COUNT=3 ARNS_CONSENSUS_THRESHOLD=2 # Cache CONTENT_CACHE_ENABLED=true CONTENT_CACHE_PATH=./data/content-cache CONTENT_CACHE_MAX_SIZE_BYTES=53687091200 # Admin ADMIN_UI_ENABLED=true ADMIN_PORT=3001 ADMIN_HOST=127.0.0.1 # Telemetry TELEMETRY_ENABLED=true TELEMETRY_DB_PATH=./data/telemetry.db # Rate Limiting RATE_LIMIT_ENABLED=true RATE_LIMIT_MAX_REQUESTS=1000 ``` -------------------------------- ### Run Wayfinder Router with Docker Compose Source: https://docs.ar.io/build/run-wayfinder-router/quick-start Use Docker Compose to start the Wayfinder Router and its dependencies. Ensure Docker is installed and running. ```bash docker compose up -d ``` -------------------------------- ### Initialize Turbo with Authentication Source: https://docs.ar.io/build/upload/advanced-uploading-with-turbo This snippet shows how to initialize Turbo and include authentication details. Ensure you replace placeholder values with your actual credentials. ```javascript Turbo.configure({ // ... other configurations headers: { "Authorization": "Bearer YOUR_API_KEY" } }); ``` -------------------------------- ### Direct Path Gateway Example Source: https://docs.ar.io/learn/gateways This snippet demonstrates how to interact with a gateway using the direct path. It shows a GET request to retrieve data. ```javascript 33:[\ ``` -------------------------------- ### Interact with Arweave Gateway (Upload Data) Source: https://docs.ar.io/build/run-a-gateway/quick-start Example using arweave-js to upload data to the Arweave network via the gateway. Requires arweave-js to be installed. ```javascript import Arweave from 'arweave'; const arweave = Arweave.init({ host: 'localhost', port: 1984, protocol: 'http' }); async function uploadData() { const data = 'Hello Arweave!'; const transaction = await arweave.createTransaction({ data: data }); await arweave.signTransaction(transaction); const response = await arweave.transactions.post(transaction); console.log('Transaction posted:', response); } uploadData(); ``` -------------------------------- ### Install ar.io SDK with bun Source: https://docs.ar.io/build/run-a-gateway/join-the-network Use this command to globally install the ar.io SDK using bun. ```bash bun add --global @ar.io/sdk ``` -------------------------------- ### Initialize SDK with Solana Wallet Source: https://docs.ar.io/build/guides/working-with-arns/register-arns-programmatically This snippet shows how to import and initialize the AR.IO SDK. Ensure you have a Solana signer available, which can be created using tools from `@solana/kit`. ```javascript const { ARIO } = require("@ar.io/sdk"); // Initialize ARIO with a Solana signer for transactions // See the SDK Configuration page for how to create a signer from @solana/kit ``` -------------------------------- ### ARNS Record Structure Source: https://docs.ar.io/sdks/ar-io-sdk/arweave-name-system-arns An example of the JSON structure returned when fetching an ARNS record. This includes process ID, start timestamp, and end timestamp. ```json { "processId": "bh9l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM", "startTimestamp": 1720720819969, "endTimestamp": 1752256702026 } ``` -------------------------------- ### JSON Filter Configuration Example Source: https://docs.ar.io/build/run-a-gateway/manage/filters This JSON object defines a filter configuration. It specifies criteria for matching requests based on tags and a starting value. ```json { "tags": [ "App-Name" ], "valueStartsWith": "MyApp" } ``` -------------------------------- ### Install Turbo SDK Source: https://docs.ar.io/build/upload/advanced-uploading-with-turbo Install the Turbo SDK for Node.js or Yarn environments. ```bash # For Node.js npm install @ardrive/turbo-sdk # For Yarn users yarn add @ardrive/turbo-sdk ```