#include "primitives/transaction.h" CTransaction tx; tx.vin.resize(1); tx.vout.resize(1); // Set the input value and script tx.vin[0].prevout.SetNull(); tx.vin[0].scriptSig << OP_1; // Set the output value and script tx.vout[0].nValue = 5000000000; tx.vout[0].scriptPubKey << OP_DUP << OP_HASH160 << hash160(pubkey) << OP_EQUALVERIFY << OP_CHECKSIG; // Sign the transaction SigningTransaction signature(tx); signature.Sign(0, privkey, true); signature.UpdateInput(0, tx.vin[0].prevout); // Output the signed transaction in hexadecimal format printf("%s\n", signature.GetSerialized().ToString().c_str());In this example, we create a new transaction with one input and one output. We set the value and script for each of these, and then sign the transaction using a private key. The package library for the CTransaction class is Bitcoin Core, which is an open source software project that serves as the reference implementation for the Bitcoin cryptocurrency.