npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

rootchain-sdk

v1.0.2

Published

The Official TypeScript SDK for RootChain - High-precision RPC client.

Readme

rootchain-sdk

Version TypeScript License


The rootchain-sdk provides a clean, heavily-typed API wrapper over the rootchain-rpc JSON-RPC 2.0 endpoints. It empowers developers to build rich, reactive Web3 interfaces on top of the RootChain ecosystem with absolute minimal overhead.

📦 Installation

This package is optimized for modern toolchains (Node >= 18, Bun, Vite).

npm install rootchain-sdk
# or
bun add rootchain-sdk
# or
yarn add rootchain-sdk
# or
pnpm add rootchain-sdk

⚡ Core Features

  • 100% Type-Safe: Comprehensive types for transactions, blocks, receipts, and RRC network structs.
  • Offline Transaction Building: Deterministically serialize and sign payloads completely offline, mitigating key-leakage attacks.
  • JSON-RPC Provider Wrapper: Native JsonRpcProvider for network data, account querying, and telemetry extraction.
  • Key Derivation: Securely derive Ed25519 paths via standard BIP-39 mnemonic recovery phrases.
  • WASM Deployment Ready: Methods and structures natively adapted for deploying and querying sandboxed webassembly bytecodes.

🚀 Quick Start Guide

1. Initialize the Provider

Connect directly to your local node or remote rootchain-rpc endpoint:

import { JsonRpcProvider } from 'rootchain-sdk';

// Initialize the generic provider
const provider = new JsonRpcProvider('http://localhost:8545');

// Fetch network status
const { height, chain_id } = await provider.getChainInfo();
console.log(`Connected to ${chain_id} at block ${height}`);

2. Wallet & Account Derivation

Derive your private keys deterministically and check your native balance securely:

import { Wallet } from 'rootchain-sdk';

// Instantiate a wallet connected to the provider
const privateKeyHex = "0x4f3c..."; // Ensure 32-bytes representation
const wallet = new Wallet(privateKeyHex, provider);

// Resolve public key representation
const address = await wallet.getAddress();

// Retrieve canonical balance and account nonce
const { balance, nonce } = await provider.getBalance(address);
console.log(`Remaining Balance: ${balance} micro-ROOT`);

3. Issue a Raw Transaction

Seamlessly instruct the provider to broadcast signed Transfer transitions directly to the PoA network:

const txReceipt = await wallet.sendTransaction({
  tx_type: "Transfer",
  to: "0x8888...",          // 32-byte recipient Hash
  amount: 1000000000000n,    // BigInt for safe u128 handling
  fee: 1000n,                // Network execution fee
  payload: new Uint8Array()  // Zero-length buffer for standardized transfers
});

console.log(`Transaction successfully queued with hash: ${txReceipt.hash}`);

// Optionally, await network determinism
await provider.waitForTransaction(txReceipt.hash);
console.log('Transaction explicitly finalized within an immutable block!');

📚 Advanced Documentation

Submitting Equivocation Proofs

The SDK provides a built-in helper for submitting proofs of validator misbehavior:

const proof = {
  validator: "0xaddr...",
  height: 500,
  round: 1,
  hash_a: "0x...",
  signature_a: "0x...",
  hash_b: "0x...",
  signature_b: "0x..."
};

const { hash } = await provider.submitEquivocationProof(proof);
console.log(`Equivocation proof submitted: ${hash}`);

For deeper operational hooks into rootchain-std execution contracts (ContractCall and ContractDeploy), refer to the advanced ecosystem tutorials outlined in the /docs directory.