Bitcoin: How do you finalize a PSBT when the last signature is provided by a HWW?
Share
Here’s the one, how to handle PSBT (evidence of the packets of the stake), when the last signature is provided by the apporays (HWW):
ADOLING PSBT C Hww Signature
At the existence of API -Interface, the device for the opparaths of Khielkov, such as Ledger or Trezor, you can stir with the situation, when the nailed signature is not presented. However, it is important to note that these devices are desperately signed by the prevailing initiation.
To complete the PSBT (evidence of the packets of the stake) after the signature HWW, the powered the following action:
Shag 1: Take Subcribe Hww
The first step is to sign up for your attachment. This may be the help of the method sign_tx
, the imposed API of the device, as a question in the question.
`Rust
Use PSBT :: PreLude ::*;
// Are you going to have a Ledger and Trezor Arf.
Let Hww = Ledgerdevice :: New ("Path/To/Ledger"). unwrap ();
Hww.sign_tx (PSBT :: TX :: Newtransaction (
PSBT :: Summ :: Zero (),
PSBT :: Target,
PSBT :: HASH,
PSBT :: Prescription :: Non -Divine,
));
Shag 2: Submit the PSBT PSBT
After that, you have a hww sign, you can make a focal PSBT, using the method Winlintize
, presented by API devices.
`Rust
// Are you going that you have a Ledger and Trezor device.
Loop PSBT = Complete (
hww.hww_signature,
PSBT :: Summ :: Zero (),
PSBT :: Target,
PSBT :: HASH,
);
Shag 3: Subcribe the final PSBT (invisible)
If you want to subscribe psbt, use the second HWW, again use the method sign_tx
.
`Rust
// Are you still having a Ledger device and Trezor with the same API.
Let Hww_sign = Ledgerdevice :: New ("Path/To/Oreth_ledger"). unwrap ();
Loop PSBT_SIGN = Finalize (
Hww.sign_tx (PSBT :: Summ :: Zero (), PSBT :: TARGET, PSBT :: Hash),
PSBT :: Summ :: Zero (),
PSBT :: Target,
PSBT :: HASH,
);
Shag 4: check out the psbt
To impact that the final psbt is right, check it, verify his hash and subscribe.
`Rust
// Are you going to have a Ledger and Trezor Arf.
Let Hww = Ledgerdevice :: New ("Path/To/Ledger"). unwrap ();
hww.verify_finalized_psbt (& PSBT :: Hash, & PSBT :: Signature);
PRIMER PURIENTS
Here is the priming that demonstrats how to give PSBT with the synatures hww:
`Rust
Use PSBT :: PreLude ::*;
FN MAIN () {
// Create a new trezor device with the same api.
Let Trezor = Trezordevice :: New ("Path/To/Trezor"). unwrap ();
// Dress the open key and closed key for your Koshka.
Past PK = Generate_Keys (). Unwrap ();
Loop Sk = Generate_Keys (). Unwrap ();
// Create a new PSBT transaction (Bulletproof).
Empty mut psbt = creat_psbt (& pk, & sk);
// Subcribe PSBT with the Ledger and Second Designer Trezor.
Let Hww_sign = Ledgerdevice :: New ("Path/To/Ledger"). unwrap ();
Let Trezor_sign = Trezordevice :: New ("Path/To/Trezor"). unwrap ();
psbt.sign_tx (hww_sign.hww_signature, & psbt);
psbt.sign_tx (trezor_sign.hww_signature, & psbt);
// Council psbt.
let inployized_psbt = infintize (& hww_sign.hww_signature, & psbt) .unwrap ();
Println! ("Completed PSBT Hash: {}", abildized_psbt.hash ());
}
Obraty unicanhered that this is a preferential primer, and you should consult with the Documentation on API devices for concrete instructions about Tom how to give PSBT with HWW. Crossing that, Image in the view that hwws for key transaction and subscriptions are not recommended by the Bitcoin with the problem of the immobility.