Skip to content

shivamSspirit/flux-quickstart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FluxRPC Quickstart

Get started with Solana RPC in 5 minutes using FluxRPC.

TypeScript Solana License: MIT

What You'll Learn

  • Check wallet SOL balance
  • Get blockhash for transactions
  • Read account data from the blockchain

Quick Start

1. Get Your API Key (60 seconds)

  1. Go to dashboard.fluxbeam.xyz
  2. Sign in with Google, GitHub, or your Solana wallet
  3. Click "Create API Key"
  4. Copy your key (looks like: https://${FLUXRPC_REGION}.fluxrpc.com/?key=${FLUXRPC_API_KEY})

No credit card. No approval process.

2. Clone & Install

git clone https://github.com/shivamSspirit/flux-quickstart.git
cd flux-quickstart
npm install

3. Add Your API Key

cp .env.example .env

Edit .env and add your key:

FLUXRPC_API_KEY=your-api-key-here
FLUXRPC_REGION=eu

4. Run

npm run dev

Expected Output:

FluxRPC Quickstart

1. getBalance
   Wallet:  'your wallet address'
   Balance: 0.035737443 SOL
   Latency: 145ms

2. getLatestBlockhash
   Blockhash: Zb6cPmjqh9UmdG4TP4QRVDsjFEinDzze8CY2mrgXgEv
   Valid until: 375,270,398

3. getAccountInfo
   Owner: 11111111111111111111111111111111
   Lamports: 35,737,443
   Executable: false
   Data size: 0 bytes

Done!

The 3 Essential Methods

1. getBalance

Check how much SOL any wallet has.

const { sol } = await getBalance('YOUR_WALLET_ADDRESS');
console.log(`Balance: ${sol} SOL`);

Returns:

{
  address: string;   // The wallet address
  lamports: number;  // Balance in lamports (1 SOL = 1B lamports)
  sol: number;       // Balance in SOL
}

2. getBlockhash

Get the latest blockhash. Required before sending any transaction.

const { blockhash } = await getBlockhash();
// Use this blockhash when building your transaction

Returns:

{
  blockhash: string;           // Current blockhash
  lastValidBlockHeight: number; // Block height until this hash is valid
}

3. getAccountInfo

Read account details from the blockchain.

const info = await getAccountInfo('YOUR_WALLET_ADDRESS');
if (info.exists) {
  console.log(`Owner: ${info.owner}`);
}

Returns:

{
  address: string;      // The account address
  exists: boolean;      // Does the account exist?
  owner?: string;       // Program that owns this account
  lamports?: number;    // Balance in lamports
  executable?: boolean; // Is this a program account?
  dataLength?: number;  // Size of account data in bytes
}

Project Structure

flux-quickstart/
├── src/
│   └── index.ts       # RPC methods + demo
├── dist/              # Compiled output
├── .env.example       # Environment template
├── .env               # Your API key (git-ignored)
├── package.json       # Dependencies
├── tsconfig.json      # TypeScript config
└── README.md

FluxRPC Endpoints

https://${REGION}.fluxrpc.com/?key=${API_KEY}
Region Endpoint
Europe https://eu.fluxrpc.com/?key=YOUR_KEY
US https://us.fluxrpc.com/?key=YOUR_KEY

Commands

Command What it does
npm install Install dependencies
npm run build Compile TypeScript
npm run dev Build and run
npm start Run compiled code

Next Steps

License

MIT

About

FluxRPC Quickstart: Query Solana in 5 Minutes

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors