** I will not cook
Bitcoin’s Mainnet continues to develop, and new features such as separated witnesses (Segwit) and multimedia signature wallets are becoming increasingly important. One of the main aspects of these updates is the SIG surgery, which allows for a safer and more efficient examination of surgery. However, understanding how this process works from scratch can be a bit stunning for beginners.
In this article, we will dive into the world of Segwit operations, and we are particularly researching how to create raw Segwit Testnet from scratch and inspection (multimedia) SIG operation.
What is the raw segwit surgery?
Before immersing itself in the process, it is necessary to understand what the raw Segwit operation looks like. The untreated Segwit operation is a binary encoding message showing the block status in the Bitcoin circuit. This format is designed to make it more efficient and safer compared to traditional Merkele wood operations.
Check (multi) SIG operation
SIG operation is an essential step in checking Segwit operations signature scheme. This ensures the required number of signatures, which makes it difficult for the attacker to falsify or damage the operation.
To perform a check (road) SIG operation, you will have:
- Create a new SEGWITTRANSACTION object using Bitcoin :: SEGWIT :: Create_new_transaction.
- Set the required signatures by calling the set_multisig_secret and Set_Signatures operation.
Creating a raw Segwit operation from scratch
Here is an example of the C ++ code fragment that shows how to create a raw -free SegWit operation:
`CPP
#include
#include
int main () {
// Create a new Bitcoin operation using Bitcoin :: Segwit :: Create_new_transaction.
Segwit :: Operation TX;
IF (TX.create (New Std :: Line (Testnet), 0, 0)) {
Bitcoin_log_Error (“Failed to create surgery”);
// Set the required signatures
Segwit :: Signatures Sigs = Bitcoin :: SegWit :: Create_Signatures (tx.get_hash (), 2);
tx.set_multisig_secret (sigs);
// Create a new object of Raw Segwit surgery.
Segwit :: Orienction RAW_TX = SegWit :: MAKE_RAW_TROSACTION (TX, 0);
return 1;
}
Bitcoin_log_Debug (Raw Segwit Operating Successfully created “);
return 0;
}
`
By performing a check (multifaceted) SIG operation
To perform a check (multimedia) SIG operation, you need to create a new SegWit :: Transaction object using Bitcoin :: Segwit :: Create_new_transaction and set the required signatures. Here is the code fragment:
`CPP
#include
#include
int main () {
// Create a new Bitcoin operation using Bitcoin :: Segwit :: Create_new_transaction.
Segwit :: Operation TX;
IF (TX.create (New Std :: Line (Testnet), 0, 0)) {
Bitcoin_log_Error (“Failed to create surgery”);
// Set the required signatures
Segwit :: Signatures Sigs = Bitcoin :: SegWit :: Create_Signatures (tx.get_hash (), 2);
tx.set_multisig_secret (sigs);
// Perform SIG surgery for inspection (multimedia).
BOOL FOUND_ALL_SIGS = FALSE;
O (! Found_all_sigs) {
Bitcoin_log_debug (“check (multi) SIG operation:”);
Segwit :: Operation New_tx = SEGWIT :: MAKE_RAW_TRANSACTION (TX, 0);
// Check that the new operation contains the required signatures.
Segwit :: Signatures Sigs_new;
if (new_tx.get_signatures (sigs_new)) {
Bitcoin_log_debug (Check (Multi) SIG operation: found all the signatures needed.