CARV
CARVPlayPortalProtocol
  • Overview
    • Introducing CARV
  • SVM - AI AGENTIC CHAIN
    • Introduction
      • Architecture
      • AI Agent in TEE environment
      • CARV Verifier Nodes
    • Quick Start
      • Bridge Token
      • Explorer
      • Command line tool
      • Reading from CARV SVM Network
      • Writing to the Network
      • Network Info
  • D.A.T.A. - AI FRAMEWORK
    • Introduction
      • DeepSeek Integration
      • D.A.T.A's Core Features
      • How It Empowers AI Agents
      • Driving the Future of AI and Blockchain
      • Leveraging CARV SVM Chain for Privacy and Trustless Data Sharing
    • Quick Start Guide
    • Architecture
    • ERC-7231 (CARV ID)
    • Examples
      • On-Chain Insights
    • Getting Started
      • D.A.T.A Framework Plugin for Eliza
    • Use Cases and Implementation
      • Getting On-Chain Data for AI Agents
      • What's Coming with the D.A.T.A Framework
    • API Documentation
      • News
      • On-chain Data SQL Query
        • Ethereum Schema
        • Bitcoin Schema
        • Base Schema
        • Solana Schema
      • On-chain Data SQL Query by LLM
      • Token Info and Price
      • User Balance by Twitter ID
      • User Balance by Discord ID
  • CARV Ecosystem
    • CARV Play
      • Portal Access
      • Integration Guide
        • .Play Name Service Integration
        • API-Verified Quest (RESTFUL)
        • API-Verified Quest (GraphQL)
        • CARV ID OAuth 2.0
        • CARV ID Telegram SDK
      • Smart Contracts & Security
    • MOFF Bot & Customer Data Platform
    • CARV Account
      • ERC 7231
    • Verifier Nodes
      • How to Purchase Nodes
      • Buyback Program
      • Why Verifier Nodes
      • How do Verifier Nodes Work
        • CARV/veCARV Token
        • CARV Vault
        • CARV NFT License
        • CARV Protocol Service
        • Trusted Execution Environment (TEE)
        • Verifier Node
        • Attestation
        • Delegation
        • Rewards
        • SGX Attestation Verification
      • Verifier Node Sale Dynamics
      • Smart Contract Addresses
      • License Key (NFT)
      • Delegation
      • Node Rewards
      • Join Mainnet Verifier Nodes
        • Prerequisites
        • Delegation Tutorial
        • Operating a Verifier Node
          • Running in VPS
          • Running in CLI
            • Using Source Code
            • Using Docker
            • Gasless Server API
          • Running in Desktop App
      • Explorer
      • FAQ
        • Node Sale
        • Node Operation
  • CARV LABS
    • Introduction
    • Working with CARV Labs
  • Tokenomics
    • Utility
      • veCARV(s)
    • Distribution & Vesting
  • DECENTRALIZED GOVERNANCE
    • ⚔️Universal Guardian Program
    • 📔DAO Governance
    • 🌏Community Programs & Activities
  • Resources
    • 🗜️Writings
    • 🗞️CARV in the News
    • 🫶Social & Community Links
    • 🅰️Brand Guideline
    • 💰Job Openings
Powered by GitBook
On this page
  1. SVM - AI AGENTIC CHAIN
  2. Quick Start

Writing to the Network

Now that we understand how to read data from the CARV SVM Chain, let’s learn how to write data. On CARV SVM Chain, transactions consist of instructions—just like on Solana—but they benefit from CARV’s Layer 2 architecture. This architecture offers faster finality, lower costs, and seamless integration with Ethereum’s security guarantees.

Let’s explore a common operation: transferring SOL, to understand how transactions work on CARV SVM Chain.

Transfer SOL

To perform a simple transfer of SOL from one account to another, we invoke the transfer instruction on the System Program. Here’s how you can do it:

import {
    LAMPORTS_PER_SOL, SystemProgram, Transaction,
    sendAndConfirmTransaction, Keypair,
} from "@solana/web3.js";

// Connect to CARV SVM Chain's RPC endpointconst rpcUrl = "https://rpc.testnet.carv.io/rpc";
const connection = new pg.Connection(rpcUrl);

// Get sender's keypair from the playground wallet
const sender = pg.wallet.keypair;

// Generate a new keypair for the receiver
const receiver = new Keypair();

// Create the transfer instruction
const transferInstruction = SystemProgram.transfer({
    fromPubkey: sender.publicKey, toPubkey: receiver.publicKey, lamports: 0.01 * LAMPORTS_PER_SOL,  // Transfer 0.01 SOL
});

// Add the instruction to a new transaction
const transaction = new Transaction().add(transferInstruction);

// Send and confirm the transaction
const transactionSignature = await sendAndConfirmTransaction(
    connection,
    transaction,
    [sender]
);

// Log the transaction URL using CARV’s explorer
console.log("Transaction Signature:",`https://explorer.ops.soo.network/?cluster=custom&customUrl=https%3A%2F%2Frpc.carv.testnet.soo.network%2Frpc%2Fcarv-McPrlbfMcW0ggpkvr07Tjs2YfviwpHaI/${transactionSignature}`);

Key Concepts:

  • Creating Instructions: Specifies what the transaction will do (e.g., transfer funds).

  • Building Transactions: Combines one or more instructions.

  • Sending and Confirming: Executes the transaction and verifies its success.

  • Explorer Integration: Links to CARV’s explorer for transaction details.

When you run this code, you’ll see a transaction signature and a link to view it in CARV’s explorer. Clicking the link provides transaction details, including the fast confirmation enabled by CARV SVM Chain.

PreviousReading from CARV SVM NetworkNextNetwork Info

Last updated 2 months ago