bip174 icon indicating copy to clipboard operation
bip174 copied to clipboard

Add BIP370 fields

Open Nesopie opened this issue 1 year ago • 1 comments

This PR adds support to BIP370.

A couple of questions:

  • For the input fields pertaining to hashes (eg, RIPEMD160) should I check if the preimage is the same as the hash?
  • For PrevTxId - should I take the input as string or Buffer? And should I assume that the txid is already in reverse byte/little-endian order?
  • should I check for correctness in general? For example, check if height locktime is less than 500 million, or hash(preimage) === hash etc or is the check function simply for type safety?
  • There's a util function for writing or reading from/to Uint64. But now that Buffer has a util for performing that operation, wondering if I can use that instead?
  • A lot of the existing code uses Buffer.allocUnsafe(), any reason why?

TODOS:

  • Add test vectors from BIP370
  • Support for a couple more global key value pairs
  • Support for proprietary key value pairs
  • Migrate to Uint8Array

Nesopie avatar Apr 13 '24 00:04 Nesopie

Is this still in progress? The PSBT_OUT_SCRIPT field is needed for silent payments.

andrewtoth avatar Jan 04 '25 14:01 andrewtoth