Blocana SDK
Software Development Kits for building applications on Blocana
TypeScript SDK
Build web applications, Node.js backends, and SPAs with our TypeScript SDK.
Installation
npm install @blocana/client
Rust SDK
Develop high-performance applications and smart contracts with our Rust SDK.
Installation
blocana-client = "0.1.0"
Python SDK
Create data-driven applications and analytics tools with our Python SDK.
Installation
pip install blocana-client
Quick Start Examples
Create a Wallet (TypeScript)
import { BlockanaClient, Wallet } from '@blocana/client';
// Initialize the client
const client = new BlockanaClient({
networkUrl: 'https://testnet.blocana.io',
apiKey: 'your-api-key'
});
// Create a new wallet
const wallet = Wallet.createNew();
console.log("Address:", wallet.address);
console.log("Private Key:", wallet.privateKey);
// Connect to existing wallet
const existingWallet = Wallet.fromPrivateKey(
"0x1a2b3c..."
);
// Get wallet balance
const balance = await client.getBalance(wallet.address);
console.log("Balance:", balance);
Send a Transaction (Rust)
use blocana_client::{Client, Transaction, Wallet};
use std::str::FromStr;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Initialize the client
let client = Client::new(
"https://testnet.blocana.io",
Some("your-api-key")
)?;
// Load wallet from private key
let wallet = Wallet::from_private_key(
"0x1a2b3c..."
)?;
// Create a transaction
let tx = Transaction::new(
"0xdestination...",
1000000000, // amount in smallest units
Some("Payment for services")
);
// Sign and send the transaction
let tx_hash = client.send_transaction(&wallet, tx).await?;
println!("Transaction sent: {}", tx_hash);
Ok(())
}
SDK Features
Wallet Management
Create, import, and manage wallets securely with comprehensive key handling.
Transaction Building
Create, sign, and broadcast transactions with built-in fee estimation and validation.
Smart Contracts
Deploy and interact with smart contracts through intuitive interfaces with ABI support.
Block Data
Query blockchain data, blocks, transactions, and state with efficient pagination support.
Event Subscription
Subscribe to blockchain events including new blocks, transactions, and contract events.
Network Management
Configure network endpoints with automatic load balancing and failover support.