Giter VIP home page Giter VIP logo

binance-thresh-wallet's Introduction

Binance chain threshold wallet

Binance chain wallet powered by two-party ECDSA.
Soon to be integrated into the ZenGo iOS wallet (www.zengo.com)

Installation:

$ npm install @kzen-networks/binance-thresh-wallet

Usage:

Server (acts as the co-signer in the two-party signing protocol):

const { BncThreshSigServer} = require('@kzen-networks/binance-thresh-wallet');
const server = new BncThreshSigServer();
server.launch();

Client:

const { BncThreshSigClient } = require('@kzen-networks/binance-thresh-wallet');

(async () => {
    const client = new BncThreshSigClient();
    
    // initialize
    await client.init();
    
    const address = client.getAddress();
    console.log(address);
    // tbnb1zaudxtp40f6w3vgjmxqpxjaxfa7mt09t5x0h2s
    
    /* Now you should deposit BNB into this address */

    console.log(await client.getBalance());
    // [{"free":"0.09244000","frozen":"0.00000000","locked":"0.00000000","symbol":"BNB"}]

    const toAddress = client.getAddress(1);  // new address
    console.log(toAddress);
    // tbnb1glzdlqt70uk7qw8e7jy7u708emfhe9qsdwxhc5

    console.log(await client.transfer(address, toAddress, 0.00123, 'BNB', 'demo!'));
    // {"result":[{"code":0,"hash":"DD505FB142B473471D969BA278E82548BEDD637FEC3A3ED6350408B34A74DB9E","height":"","log":"Msg 0: ","ok":true}],"status":200}
})();

Demo:

You can also use a demo using the command line.
Server:

$ demo/server

Client:

$ demo/client --help

Usage: client [options] [command]

Options:
  -h, --help                               output usage information

Commands:
  address [options]
  balance <address>
  transfer [options] <from> <to> <amount>
  buy_order <symbol> <price> <quantity>
  sell_order <symbol> <price> <quantity>
  cancel_order <symbol> <ref_id>

Transfer demo:

Transfer demo

Trade Demo:

Trade demo

Contact

Feel free to reach out or join the KZen Research Telegram for discussions on code and research.

binance-thresh-wallet's People

Contributors

oleiba avatar talbeerysec avatar omershlo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.