Here is an article on how to finish PSBT (Episode Bullets Test) when the last signature is provided by hardware wallet (HWW):
PSBT Completion with HWW Signature
When hardware portfolios such as Mastro or Trezor book use bees of the device, situations where the final signature has not yet been submitted can be satisfied. However, it should be noted that these devices usually provide the required signature during successful initiation.
To complete the PSBT (Episode bullet test), after receiving HWW signature, follow the following steps:
Step 1: Get HWW signature
The first step is to get a HWW signature from hardware wallet. This can be done using the Sign_tx device bees as mentioned in the program.
`Rūdys
US PSBT :: Prelude ::*;
// Let's say we have a accounting device and a Trezor device with the same bees.
Let HWW = Ledgerdevice :: New ("Road/Book"). Ukrap ();
HWW.SIGN_TX (PSBT :: TX :: Newtransation (
PSBT :: amount :: zero (),
PSBT :: Target,
PSBT :: Hash,
PSBT :: Prokofstake :: not confirmed,
))););
Step 2: Create PSBT complete
Once you have a HWW signature, you can create a finished PSBT using the Fabija method presented by Bees.
Rūdys
// Let's say we have a accounting device and a Trezor device with the same bees.
Let PSBT = finish (
Hww.hww_signature,
PSBT :: amount :: zero (),
PSBT :: Target,
PSBT :: Hash,
);
Step 3: Sign complete PSBT (optional)
If you want to sign a finished PSBT using another HWW, use the Sign_tx method again.
Rūdys
// Let's say you have another accounting device and a Trezor device with the same bees.
Let hww_sign = Ledgerdevice :: New ("Road/to/other_Ledger"). Ukrap ();
Let PSBT_SIGN = we will finish (
Hww.sign_tx (psbt :: amu :: zero (), psbt :: Target, PSBT :: Hash),
PSBT :: amount :: zero (),
PSBT :: Target,
PSBT :: Hash,
);
Step 4: Check the finished PSBT
To make sure the finished PSBT is correct, check it by checking its bag and signature.
Rūdys
// Let's say we have a accounting device and a Trezor device with the same bees.
Let HWW = Ledgerdevice :: New ("Road/Book"). Ukrap ();
Hww.verify_finalized_psbt (& psbt :: Hash, & psbt :: signature);
for the use of case usage
Here is an example of an example of how to finish PSBT using HWW signatures:
Rūdys
US PSBT :: Prelude ::*;
FN Main () {
// Create a new Trezor device with the same bees.
Let Trezor = Trezordevice :: New ("Road/to/Trezor"). Ukrap ();
// generates a public key and a private wallet key.
Let PK = generate_keys (). Ukrap ();
Let SK = Generate_Keys (). Ukrap ();
// Create a new PSBT operation (Bulletheads test).
Let Mut PSBT = Create_psbt (& PK, & SK);
// Sign the PSBT accounting device and another Trezor device.
Allow hww_sign = Ledgerdevice :: New (Path/Ledger). Ukrap ();
Let Trezor_Sign = Trezordevice: New ("Road/to/Trezor"). Ukrap ();
Psbt.sign_tx (hww_sign.hww_signature, & psbt);
PSBT.Sign_tx (Trezor_Sign.hww_signature, & PSBT);
// Get a finished PSBT.
Let's complete_psbt = finish (& hww_sign.hww_signature, & psbt) .Unwrap ();
Println! ("Completed PSBT bag: {}", completed_psbt.hash ());
}
`
Remember that this is a simplified example and you should contact the API of the device to obtain specific instructions on how to complete PSBT using HWW signatures. Also, remember that the Bitcoin community does not recommend the use of HWWS to use key storage and signature operations due to safety problems.
Leave a Reply