/multisig-tests

Examples for working with BCH multisig transactions and bitore-lib-cash library

Primary LanguageJavaScript

multisig-tests

This is a series of example programs for working with multisig transactions, using the bitcore-lib-cash library.

  • 01-create-ms-wallet.js - Generate a 2-of-3 multisig wallet.
  • 02-spend-ms-wallet.js - Spend from the wallet when all private keys are known.
  • 03-round-robin-signing.js - Bob passes a partially signed Tx to Alice. Alice signs and broadcasts the transaction.
  • 04-create-3-of-5.js - Create a 3-of-5 multisignature address.
  • 05-round-robin-signing.js - Example for signing the multisig transaction by passing the partially signed transaction to each participant in-series. They each add their signature then pass it on to the next player.
  • 06-parallel-signing.js - Example for signing the multisig transaction in parallel. Each player signs their copy of the transaction and sends just the signature to an aggregator. The aggregator combines all signatures and broadcasts the transaction.

Installation

  • git clone https://github.com/christroutner/multisig-tests
  • cd multisig-tests
  • npm install

Usage

  • node 01-create-ms-wallet.js
  • node 03-round-robin-signing.js

Note: You'll need to fund the multisig address generated by the first script.

License

MIT

Results

The scripts in this repository was a series of experiments to see how best to approach work with multisignature transactions. The purpose is to create a 'Minting Council' that controls the minting of new tokens for an organization. This idea is based on the organizational structure laid out at PSFoundation.info. Based on the results of these experiments, I envision a protocol as follows.

  1. Holders of the NFT are responsible for ensuring they've made a transaction so that their public key is visible on the blockchain. Otherwise they can not be included in a multisig transaction. NFTs can be passed to new addresses, but that address must have made at least one transaction so that its public key is exposed on the blockchain.

  2. A member of the Management generates a multisig transaction at the direction of the VIP membership. The on-chain public addresses for each NFT is used in the creation of the transaction. Each transaction requires a 50%+ threshold. The transaction information is uploaded to the P2WDB in JSON format.

    • This requires a way to look up the public key for any address holding an NFT. That will require a modification to psf-slp-indexer or a special program to extract the data.
  3. The Management contacts each member of the Minting Council using e2e encrypted messaging, to let them know the transaction exists and the P2WDB hash for retrieving it.

  4. Each member of the Minting Council issues a command that does the following:

    • It downloads the multisig transaction from the P2WDB.
    • It signs the transaction.
    • It sends the signature to the Management via e2e encrypted messaging.
  5. The Managment runs a command that:

    • Checks for new e2ee messages with signatures attached.
    • Attempts to collect enough signatures to meet the signature threshold.
    • Broadcasts the transaction if enough signatures are found.