Proposal: Transaction Signer Interface for Blockstack.js

Currently, blockstack.js only supports transaction signing with pubkey hash addresses. This is fine for many use cases, but doesn’t cover all the supported signature types (e.g., multisig and segwit), nor will the interface work with, say, hardware wallets.

My proposal is to add a new interface type:

interface TransactionSigner {
  signerVersion(): number
  getAddress(): Promise<string>
  signTransaction(transaction: bitcoinjs.TransactionBuilder, inputIndex: number): Promise<void>
}

The version, for now, should always return 1, but we can use the version number if we want to change the signer spec in the future.

The functions in blockstack.js transactions (txbuild.js) would accept the type inputs:

(string | TransactionSigner)

So as to be backwards compatible, and just create a simple pubkeyhash signer of the TransactionSigner interface.

2 Likes

I like this! I’ll try to implement multisig support working in my node.js CLI using this interface.

1 Like

Okay cool – I can start a feature branch with this interface pretty quickly. Will tag you when its up.

1 Like

@jude: the branch is feature/transaction-signer-interface

https://github.com/blockstack/blockstack.js/tree/feature/transaction-signer-interface

1 Like

Just updating this proposal: this was added in blockstack.js version 17.2.0:

2 Likes