Skip to content

maierfelix/banotils

Repository files navigation

banotils

This repository contains several utils to work with the cryptocurrency Banano inside the Browser and Node.

Demo:

Documentation:

The documentation is auto-generated and can be found here.

Installation:

Package installation:

npm install banotils

Browser installation:

<script src="https://unpkg.com/banotils/dist/index.iife.min.js"></script>

Features:

  • RPC-based requests
  • Wallet generation (Seed, Address, Private and Public keys)
  • Mnemonic generation (BIP39)
  • QR code generation
  • Receiving and sending BAN
  • Several methods for querying data (Account balance, history etc.)
  • Proof-of-Work generation (CPU, GPU or NODE based)
  • AES PBKDF2 encryption/decryption

Browser Example:

<script src="https://unpkg.com/banotils/dist/index.iife.min.js"></script>

<script>
(async() => {

  // Set API endpoint
  await banotils.setAPIURL(`https://kaliumapi.appditto.com/api`);

  // Generate random wallet
  const walletSeed = crypto.getRandomValues(new Uint8Array(32));
  const walletPrivateKey = banotils.getPrivateKey(walletSeed);
  const walletPublicKey = banotils.getPublicKey(walletPrivateKey);
  const walletAddress = banotils.getAccountAddress(walletPublicKey);

  // Print wallet information
  console.log("Seed:", banotils.bytesToHex(walletSeed));
  console.log("Address:", walletAddress);
  console.log("Private key:", banotils.bytesToHex(walletPrivateKey));
  console.log("Public key:", banotils.bytesToHex(walletPublicKey));

})();
</script>

Node Example:

const banotils = require("banotils");
const crypto = require("crypto").webcrypto;

(async() => {

  // Set API endpoint
  await banotils.setAPIURL(`https://kaliumapi.appditto.com/api`);

  // Generate random wallet
  const walletSeed = crypto.getRandomValues(new Uint8Array(32));
  const walletPrivateKey = banotils.getPrivateKey(walletSeed);
  const walletPublicKey = banotils.getPublicKey(walletPrivateKey);
  const walletAddress = banotils.getAccountAddress(walletPublicKey);

  // Print wallet information
  console.log("Seed:", banotils.bytesToHex(walletSeed));
  console.log("Address:", walletAddress);
  console.log("Private key:", banotils.bytesToHex(walletPrivateKey));
  console.log("Public key:", banotils.bytesToHex(walletPublicKey));

})();

Inspired by:

About

Utilities for the banano cryptocurrency

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published