Git Product home page Git Product logo

bmultisig's People

Contributors

blusyn avatar braydonf avatar nodech avatar pinheadmz avatar tynes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bmultisig's Issues

Index xpub index for cosigners.

Even though we have path entry in database for cosigners it is not automatically used to figure out XPUB.index, but will be convenient to expose xpub.index to the users and simplify API usage.

Related bcoin-org/bcoin#689 - This tries to solve XPUB issue for bcoin xpub Only wallets.

Proposal has been broadcast state

Each proposal has a state that is kept track of in the proposal db, once all of the users approve the proposal, it goes into the approved state, but there is no way to know that it has been broadcasted.

Steven would like the ability to specify broadcast: bool for when the final cosigner approves such that it can be broadcast then. This would update the state to broadcasted (or is confirmed better?) so that the UI can filter out proposals that have already been sent

MTX Utils

  • a way to extract signatures from the transaction.

Export other modules

I'd like to be able to do something like:

const { MultisigClient } = require('bmultisig');

Right now, lib/bmultisig.js exports a Plugin so for me to access the client,
I have to do something like:

const MultisigClient = require('./node_modules/bmultisig/lib/client');

I believe you would need to give the path to the specific file to import with Webpack as well

Compatibility tests with locked coins

Currently there are not tests that cover RPC behaviour with bmultisig and what kind of issues it might cause.

we should cover them with test cases. There are several edge cases possible.

getWallets() returns an error when no wallets

I'm getting the following error which causes requests to fail: Cannot read property 'wallets' of null

This is coming from here. Would probably either need to check if wallets is defined first, or just return wallets rather than wallets.wallets

Cosigner token collision

It's required that cosignerToken be truly random, so other cosigners can't guess the token.
BUT if two cosigners choose same cosigner token, it will be a conflict and authentication does not handle that correctly.

Probably after wallet is finalized we should invalidate wallet if two tokens are same.
Or add additional information on authentication to let you choose the cosigner you want to authenticate with.

@BluSyn

Unlock

Add endpoints to manually unlock coins and reject proposals.

Fresh install includes buggy brq

The error received is:

TypeError: Cannot read property 'buffer' of null
    at RequestOptions.toHTTP (request-browser.js?8340:290)
    at _request (request-browser.js?8340:369)
    at request (request-browser.js?8340:409)
    at MultisigClient.request (client.js?9aa0:174)
    at MultisigClient.get (client.js?9aa0:223)
    at MultisigClient.getWallets (client.js?9995:87)

To reproduce:

$ mkdir /tmp/multisig-debug && cd /tmp/multisig-debug
$ npm init -y >/dev/null
$ npm install bmultisig
$ grep -rin tohttp node_modules | grep browser

> node_modules/brq/lib/request-browser.js:286:  toHTTP() {
> node_modules/brq/lib/request-browser.js:369:  const response = await fetch(opt.toURL(), opt.toHTTP());

$ less +286 node_modules/brq/lib/request-browser.js

  toHTTP() {
    return {
      method: this.method,
      headers: this.getHeaders(),
      body: this.body.buffer,  // bug here
      mode: 'cors',
      credentials: 'include',
      cache: 'no-cache',
      redirect: 'follow',
      referrer: 'no-referrer'
    };
  }

Digging a little deeper:

$ cd /tmp/multisig-debug/node_modules/bmultisig
$ jq .dependencies < package.json
{
  "bclient": "~0.0.2",
  "bcoin": "github:bcoin-org/bcoin#e093b2b",
  "bcrypto": "~0.2.0",
  "bdb": "~0.1.0",
  "bevent": "0.0.2",
  "blgr": "~0.0.2",
  "bmutex": "~0.0.2",
  "bstring": "~0.0.2",
  "bufio": "~0.1.0",
  "bval": "~0.0.2",
  "bweb": "~0.0.2"
}

I think that the problem lies in an old version of bclient being imported, you can see we are at version 0.1.3 on npm here - https://www.npmjs.com/package/bclient

Wallet export/import

We need to be able to do couple of things:

  • export bmultisig wallet
  • import bmultisig wallet
  • import wallet from bwallet with additional bmultisig info

Tests and API Updates

There are couple of tests that are good to have and current tests may not cover edge case:

  • chain/wallet reset
  • lock/unlock inconsistencies between wallet and multisigdb
    • e.g. failed sent transaction
    • rpc calls
    • http endpoints?

API Updates

  • export/import bmultisig (#61)
  • Admin api for unlocking all coins and proposals (reject) (#63)
  • Admin API for listing locked coins and proposals (info, debug) (#63)

cosignerPath not used?

Currently there is a cosignerPath field passed in on wallet join.
It does not appear this value is returned at any point.

It should return in the list of cosigners, along with their xpubs. This is useful for hardware wallets to know what the path is for each cosigner.

Additionally, I do not think it is necessary to save the entire path in the DB. The only part of the path that is "non-deterministic" is the purpose, since there are several different HD schemes (44, 49, 84, etc.), and likely more in the future.

I propose removing cosignerPath, and adding a purpose (uint) field, that is then returned with the list of cosigners.

Creates nested <network> directory instead of using existing one

This is my first time playing with bmultisig so I could be using it wrong...
Seeing unexpected behavior in its data directory creation.

I'm running it with --prefix= .../bcoin/regtest and it is correctly finding the wallet.conf file in that location. (ports and API keys are parsed correctly and it seems to be running fine)
but then, unlike bwallet, it creates a NEW directory regtest INSIDE its prefix directory:

screen shot 2018-12-07 at 8 40 50 am

MultisigMTX applySignatures

Change/update applySignatures so it can have more flexible format. Currently it accepts sorted array of signatures, that correspond to each of the inputs.
We can accept map that is similar to coinview.

Also consider moving applySignature to the bcoin MTX.

Join Key Improvements

During implementation I've been considering 2 major changes to how cosigner joinKey works would make the system much more robust.

  1. The joinKey should be deterministically generated by the user creating the wallet, and should not be know-able by the server. This can be done by making it a signature using the creator's private key. The server can validate the joinKey with the creators' public key. In a "public wallet server" scenario, this prevents the server operator from hi-jacking the join process, or any "man-in-the-middle" scenario.

  2. The joinKey should be serialized with both the key + wallet name. Currently in order for cosigners to join a wallet, they need many pieces of information: API Key, Wallet Name, Join Key. I think the joinKey should return as a serialized combination of all auth information, so the client can display or read a simple QR code to join a multisig wallet. This would also help in a "public wallet server" scenario, where the wallet name may be auto-generated.

@nodar-chkuaselidze

Bcash support

In order to support bcash, we need to start using bmultisig as plugin.
It will use primitives/address which will take care of the cashaddr.
And we can accept additional flag to disable several paths (e.g. get nested address)

@bucko13

Separate bwallet and bmultisig

Currently, seperation of bwallet and bmultisig is not supported.

Integration tests when running bmultisig separately from bwallet. Running bmultisig separately from bwallet can be useful in some cases, but have not been tested.

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.