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:

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: