Add psetv2 support#53
Conversation
I would do it here since we are at it. They are just extra fields
I pushed to npm v2.1.0 |
|
@tiero @louisinger I synced my branch with master and added the missing support for taproot. The "biggest" changes are the new taproot input/output fields (of course), and among the roles, I worked on the abstraction for signing and finalizing an input, whether it is taproot or non-taproot. @louisinger Not sure why, but some of the tests of I ask you guys if you could write a taproot test case in |
|
You can look in bitcoinJS PR for test vectors, I aaked them to make.simple calculator bside also CHECKSIG |
Did you test with this branch? ElementsProject/elements#1121 But I guess the only thing we care about now is making sure GDK's |
No, I didn't yet. I have to compile the binary for that version in order to test against it, there doesn't seem to be any available.
Right now, a pset in base64 format containing only unconfidential inputs made with this new package can be successfully decoded with the elements CLI's |
| "bip174-liquid": "^1.0.3", | ||
| "bip66": "^1.1.0", | ||
| "bitcoin-ops": "^1.4.0", | ||
| "bitcoinjs-lib": "^6.0.2", |
| get bytes() { | ||
| return Buffer.concat([Buffer.of(this.prefix), this.value]); | ||
| } | ||
| get number() { |
| import { OPS } from '../ops'; | ||
| import BitSet from 'bitset'; | ||
|
|
||
| export class Input { |
There was a problem hiding this comment.
there is an export conflict with input.ts/Input class
There was a problem hiding this comment.
ok my bad, exported as PsetInput -> maybe clearer to rename ?
This adds support for psetv2, which looks more similar to the go-elements implementation rather than the existing psbt (psetv0) package.
This is done on purpose in order to have a clear separation between the 2 packages, and also to have a clear separation of the "roles" as described in the spec.
Pset,Input,OutputandGlobalare the classes for the inner representation of a partial transaction.Creator,Updater,Blinder,Signer,FinalizerandExtractorare the classes to manipulate a partial transaction according to the spec.NOTE: To prevent having secp256k1-zkp as a direct dependency, the Blinder role makes use of 2 interfaces
BlindingGeneratorandBlindingValidator(similarly to what is done in go-elements) to generate blinding data for the last output of the last blinder, and to validate all blinding data before adding to the partial transaction.confidential.ts, instead, containsZKPGeneratorandZKPValidatorthat are the implementations of such interfaces.BONUS:
AssetHashand adds tests for it, and similarly, this introducesElementsValuereplacing the deprecatedsatoshiToConfidentialValue|confidentialValueToSatoshi.TODO:Closes #32.
Closes #51.
Please @tiero review this.