Skip to content
JavaScript utilities for the banano cryptocurrency.
Branch: master
Clone or download
Pull request Compare This branch is 3 commits ahead of coranos:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app/scripts Initial commit May 2, 2019
libraries/tweetnacl
test
.eslintrc.json
.gitignore
LICENSE
README.md
config-sample.json
index.js
main.js
package-lock.json
package.json

README.md

bananojs

JavaScript utilities for the banano cryptocurrency.

requirements:

  1. nodejs 6.4.1 or higher https://nodejs.org/en/download/
  2. clone this repo
https://github.com/BananoCoin/bananojs.git
  1. to install, run the command
npm install
  1. to test, run the command
npm test
  1. to test, run the command
npm run coverage

simple banano functions

const bananojs = require('bananojs');
const crypto = require('crypto');
const seed = crypto.randomBytes(32).toString('hex');
const privateKey = bananojs.getPrivateKey(seed, 0);
const publicKey = bananojs.getPublicKey(privateKey);
const account = bananojs.getAccount(publicKey);

camo bananos account setup

  1. create a seed, (seed0)

  2. get the account for the source seed:

    npm start checkpending ${seed0}

    checkpending account ban_3i1aq1cchnmbn9x5rsbap8b15akfh7wj7pwskuzi7ahz8oq6cobd99d4r3b7 checkpending 0 pending blocks []

  3. send some bananos to the account.

  4. ensure the bans are pending:

    npm start checkpending ${seed0}

    checkpending account ban_3i1aq1cchnmbn9x5rsbap8b15akfh7wj7pwskuzi7ahz8oq6cobd99d4r3b7 checkpending 1 pending blocks [ '47DF7B2B0D6FBB3A9C6171B07755F6BB618775291D664951ABC08D1C9C5839B1' ]

  5. set your rep to be your camo account

    npm start register ${seed0}

    register pendingResponse [ '2DA9516C8C66D47978CFAD19776EEC1EA8DE9231DE6A00AC404802904EA14701' ] register bananoAccount ban_3i1aq1cchnmbn9x5rsbap8b15akfh7wj7pwskuzi7ahz8oq6cobd99d4r3b7 register camoAccount ban_1mgadefd5c676kebpfxifhggkuy38pb18wkh7kichk8kte339udifiykwo7j register account response 88F20CC57C39F857C945BC3FEA6227F4AAC0DB6AD677A4B3430AE71B069AB81B

  6. verify your seed and banano account have a camo account.

    npm start checkseed ${seed0}

    checkseed bananoAccount ban_3i1aq1cchnmbn9x5rsbap8b15akfh7wj7pwskuzi7ahz8oq6cobd99d4r3b7 checkseed camoAccount ban_1mgadefd5c676kebpfxifhggkuy38pb18wkh7kichk8kte339udifiykwo7j

    npm start checkaccount ${bananoAccount}

    checkaccount representative ban_1mgadefd5c676kebpfxifhggkuy38pb18wkh7kichk8kte339udifiykwo7j

  7. send to a camo account

    npm start sendraw ${fundingPrivateKey} ${camoSeed} ${toBananoAccount} ${amountRaw}

    send response [ '860F6A56B5EADF3A3582E2C5BE107D8E7781C67614EA14F4E5CCCA792B70845C' ]

  8. receive at the camo account.

    npm start receive ${camoSeed} ${fromBananoAccount}

    receive response [ '3AA8564507D096A4351B74E49E4FE421A4192DA7F5097281268966DEB0E03503' ]

todo: alter deposits and withdrawals so they return success/failure as well as a message.

You can’t perform that action at this time.