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

octra-sdk

v1.1.2

Published

Community JavaScript SDK for the Octra blockchain

Downloads

62

Readme

Octra SDK

Modern JavaScript/TypeScript SDK for the Octra blockchain inspired by ethers.js.

Supports wallet management, transactions, smart contracts, token interactions, and future privacy-oriented features.


Features

  • Wallet management
  • HD Wallet (Mnemonic)
  • Private key import
  • Send transaction
  • Contract deploy
  • Contract call
  • Contract view
  • Token transfer
  • Transaction history
  • Fee estimation
  • Global browser support
  • Node.js support
  • Ethers-like API
  • Planned support for stealth and FHE features

Requirements

  • Node.js >= 18

Installation

NPM

npm install octra-sdk

Bun

bun add octra-sdk

Yarn

yarn add octra-sdk

Import

ESM

import { Wallet, Provider, Contract } from 'octra-sdk';

CommonJS

const {
  Wallet,
  Provider,
  Contract
} = require('octra-sdk');

Browser CDN

<script src="https://cdn.jsdelivr.net/npm/octra-sdk/dist/octra-sdk.min.js"></script>

<script>
  const wallet =
    octra.Wallet.createRandom();
</script>

Initialize Provider

import { Provider } from 'octra-sdk';

const provider =
  new Provider(
    'https://your-octra-rpc.example'
  );

Create Wallet

Random Wallet

import { Wallet } from 'octra-sdk';

const wallet =
  Wallet.createRandom();

console.log(wallet.address);

console.log(wallet.mnemonic);

console.log(wallet.privateKey);

Import Wallet

From Mnemonic

const wallet =
  Wallet.fromMnemonic(
    'word word word ...'
  );

From Private Key

const wallet =
  Wallet.fromPrivateKey(
    'BASE64_PRIVATE_KEY'
  );

Connect Wallet to RPC

const wallet =
  Wallet
    .createRandom()
    .connect(
      'https://your-octra-rpc.example'
    );

Get Balance

const balance =
  await wallet.getBalance();

console.log(balance);

Output:

{
  address:
    'oct...',
  raw:
    '1000000',
  formatted:
    '1.000000',
  nonce: 10,
  pendingNonce: 11
}

Get Account Info

const account =
  await wallet.getAccount();

console.log(account);

Send Transaction

const tx =
  await wallet.transfer(
    'octxxxxxxxxxxxxxxxx',
    '1.5'
  );

console.log(tx);

Send Transaction with Message

const tx =
  await wallet.sendTransaction({
    to:
      'octxxxxxxxxxxxxx',
    amount: '2.5',
    message:
      'hello octra',
    ou: '10000'
  });

Wait Transaction Confirmation

const provider =
  new Provider(
    'https://your-octra-rpc.example'
  );

const receipt =
  await provider.waitForTransaction(
    tx.tx_hash
  );

console.log(receipt);

Get Transaction

const tx =
  await provider.getTransaction(
    'TX_HASH'
  );

Transaction History

const history =
  await wallet.getHistory(
    20,
    0
  );

console.log(history);

Compile AML Contract

const compiled =
  await provider.compileAml(`
contract Counter {

  storage {
    count: u64
  }

}
`);

console.log(compiled);

Compile Assembly Contract

const compiled =
  await provider.compileAssembly(`
PUSH 1
PUSH 2
ADD
HALT
`);

Deploy Contract

const deployed =
  await wallet.deployContract({
    bytecode:
      compiled.bytecode
  });

console.log(
  deployed.contractAddress
);

Create Contract Instance

const contract =
  new Contract(
    'octcontractxxxxx',
    abi,
    wallet
  );

Contract View Call

const value =
  await contract.get_count();

console.log(value);

Contract State Call

const tx =
  await contract.increment(
    1
  );

console.log(tx);

Manual Contract View

const result =
  await provider.call(
    'octcontractxxxxx',
    'balance_of',
    [
      'octxxxxxxxxx'
    ]
  );

Get Contract Info

const info =
  await provider.getContract(
    'octcontractxxxxx'
  );

console.log(info);

Token Transfer

await wallet.callContract({
  address:
    'octtokenxxxx',
  method:
    'transfer',
  params: [
    'octxxxxx',
    1000000
  ]
});

Fee Estimation

const fees =
  await provider.getFees();

console.log(fees);

Output:

{
  standard: {
    minimum: '1000',
    recommended: '10000',
    fast: '20000'
  },

  deploy: {
    minimum: '50000000'
  }
}

Utility Functions

Normalize Amount

octra.utils.normalizeAmount(
  '1.5'
);

// 1500000

Convert Raw to Display

octra.utils.rawToDisplay(
  '1500000'
);

// 1.500000

SHA256

octra.utils.sha256(
  Buffer.from('hello')
);

Global Browser Usage

<script src=""https://cdn.jsdelivr.net/npm/octra-sdk/dist/octra-sdk.min.js"></script>

<script>
  const wallet =
    octra.Wallet
      .createRandom();

  console.log(
    wallet.address
  );
</script>

Recommended Project Structure

project/
├── src/
├── contracts/
├── scripts/
├── tests/
├── package.json
└── .env

Example Full Transfer Script

import {
  Wallet
} from 'octra-sdk';

async function main() {

  const wallet =
    Wallet.fromMnemonic(
      process.env.MNEMONIC
    ).connect(
      'https://your-octra-rpc.example'
    );

  const balance =
    await wallet.getBalance();

  console.log(
    'Balance:',
    balance.formatted
  );

  const tx =
    await wallet.transfer(
      'octxxxxxxxxx',
      '1.25'
    );

  console.log(tx);

}

main();

Example Smart Contract Script

import {
  Wallet,
  Provider,
  Contract
} from 'octra-sdk';

const provider =
  new Provider(
    'https://your-octra-rpc.example'
  );

const wallet =
  Wallet.fromMnemonic(
    process.env.MNEMONIC
  ).connect(
    'https://your-octra-rpc.example'
  );

const abi = [
  {
    type: 'function',
    name: 'increment',
    stateMutability:
      'nonpayable'
  },
  {
    type: 'function',
    name: 'get_count',
    stateMutability:
      'view'
  }
];

const contract =
  new Contract(
    'octcontractxxxxx',
    abi,
    wallet
  );

const count =
  await contract.get_count();

console.log(count);

await contract.increment(
  1
);

API Overview

| Class | Description | |---|---| | Wallet | Wallet management | | Provider | RPC provider | | Contract | Smart contract wrapper |


Wallet Methods

| Method | Description | |---|---| | createRandom() | Create random wallet | | fromMnemonic() | Import mnemonic | | fromPrivateKey() | Import private key | | getBalance() | Get balance | | transfer() | Send OCT | | deployContract() | Deploy contract | | callContract() | Call contract |


Provider Methods

| Method | Description | |---|---| | getBalance() | Get address balance | | getTransaction() | Get tx detail | | waitForTransaction() | Wait confirmation | | getContract() | Get contract | | compileAml() | Compile AML | | compileAssembly() | Compile ASM |


Contract Methods

| Method | Description | |---|---| | dynamic ABI methods | Auto-generated | | view calls | Read contract | | state calls | Write contract |


Environment Variables

RPC_URL=https://your-octra-rpc.example
MNEMONIC=your mnemonic here
PRIVATE_KEY=your_private_key

Security Notes

  • Never expose mnemonics
  • Don't commit .env
  • Store private keys offline
  • Use hardware isolation for production
  • Always verify contracts before deployment

Disclaimer

This SDK is an independent open-source project and is not officially affiliated with the Octra core team.

Use at your own risk. Always audit smart contracts and transaction flows before using in production environments.


License

MIT License

Copyright © Octra SDK Contributors