Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
bitcoin-tx.cpp File Reference
#include <bitcoin-build-config.h>
#include <chainparamsbase.h>
#include <clientversion.h>
#include <coins.h>
#include <common/args.h>
#include <common/system.h>
#include <compat/compat.h>
#include <consensus/amount.h>
#include <consensus/consensus.h>
#include <core_io.h>
#include <key_io.h>
#include <policy/policy.h>
#include <primitives/transaction.h>
#include <script/script.h>
#include <script/sign.h>
#include <script/signingprovider.h>
#include <univalue.h>
#include <util/exception.h>
#include <util/fs.h>
#include <util/moneystr.h>
#include <util/rbf.h>
#include <util/strencodings.h>
#include <util/string.h>
#include <util/translation.h>
#include <cstdio>
#include <functional>
#include <memory>
Include dependency graph for bitcoin-tx.cpp:

Go to the source code of this file.

Functions

static void SetupBitcoinTxArgs (ArgsManager &argsman)
static int AppInitRawTx (int argc, char *argv[])
static void RegisterSetJson (const std::string &key, const std::string &rawJson)
static void RegisterSet (const std::string &strInput)
static void RegisterLoad (const std::string &strInput)
static CAmount ExtractAndValidateValue (const std::string &strValue)
static void MutateTxVersion (CMutableTransaction &tx, const std::string &cmdVal)
static void MutateTxLocktime (CMutableTransaction &tx, const std::string &cmdVal)
static void MutateTxRBFOptIn (CMutableTransaction &tx, const std::string &strInIdx)
template<typename T>
static T TrimAndParse (const std::string &int_str, const std::string &err)
static void MutateTxAddInput (CMutableTransaction &tx, const std::string &strInput)
static void MutateTxAddOutAddr (CMutableTransaction &tx, const std::string &strInput)
static void MutateTxAddOutPubKey (CMutableTransaction &tx, const std::string &strInput)
static void MutateTxAddOutMultiSig (CMutableTransaction &tx, const std::string &strInput)
static void MutateTxAddOutData (CMutableTransaction &tx, const std::string &strInput)
static void MutateTxAddOutScript (CMutableTransaction &tx, const std::string &strInput)
static void MutateTxDelInput (CMutableTransaction &tx, const std::string &strInIdx)
static void MutateTxDelOutput (CMutableTransaction &tx, const std::string &strOutIdx)
static bool findSighashFlags (int &flags, const std::string &flagStr)
static CAmount AmountFromValue (const UniValue &value)
static std::vector< unsigned char > ParseHexUV (const UniValue &v, const std::string &strName)
static void MutateTxSign (CMutableTransaction &tx, const std::string &flagStr)
static void MutateTx (CMutableTransaction &tx, const std::string &command, const std::string &commandVal)
static void OutputTxJSON (const CTransaction &tx)
static void OutputTxHash (const CTransaction &tx)
static void OutputTxHex (const CTransaction &tx)
static void OutputTx (const CTransaction &tx)
static std::string readStdin ()
static int CommandLineRawTx (int argc, char *argv[])
 if (ret !=CONTINUE_EXECUTION) return ret
 catch (const std::exception &e)
 catch (...)
std::vector< std::string > SplitString (std::string_view str, char sep)
template<typename T>
std::string ToString (const T &t)
 Locale-independent version of std::to_string.
std::string TrimString (std::string_view str, std::string_view pattern=" \f\n\r\t\v")
std::string_view TrimStringView (std::string_view str, std::string_view pattern=" \f\n\r\t\v")

Variables

static bool fCreateBlank
static std::map< std::string, UniValueregisters
static const int CONTINUE_EXECUTION =-1
const TranslateFn G_TRANSLATION_FUN {nullptr}
 Translate string to current locale using Qt.
static const unsigned int N_SIGHASH_OPTS = 7
struct { 
   const char *   flagStr 
   int   flags 
sighashOptions [N_SIGHASH_OPTS]
 MAIN_FUNCTION
 try
int ret = EXIT_FAILURE

Function Documentation

◆ AmountFromValue()

CAmount AmountFromValue ( const UniValue & value)
static

Definition at line 554 of file bitcoin-tx.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AppInitRawTx()

int AppInitRawTx ( int argc,
char * argv[] )
static

Definition at line 89 of file bitcoin-tx.cpp.

Here is the call graph for this function:

◆ catch() [1/2]

catch ( ...)

Definition at line 870 of file bitcoin-tx.cpp.

◆ catch() [2/2]

catch ( const std::exception & e)

Definition at line 867 of file bitcoin-tx.cpp.

Here is the call graph for this function:

◆ CommandLineRawTx()

int CommandLineRawTx ( int argc,
char * argv[] )
static

Definition at line 795 of file bitcoin-tx.cpp.

Here is the call graph for this function:

◆ ExtractAndValidateValue()

CAmount ExtractAndValidateValue ( const std::string & strValue)
static

Definition at line 203 of file bitcoin-tx.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ findSighashFlags()

bool findSighashFlags ( int & flags,
const std::string & flagStr )
static

Definition at line 540 of file bitcoin-tx.cpp.

Here is the caller graph for this function:

◆ if()

Definition at line 159 of file bitcoin-util.cpp.

◆ MutateTx()

void MutateTx ( CMutableTransaction & tx,
const std::string & command,
const std::string & commandVal )
static

Definition at line 696 of file bitcoin-tx.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MutateTxAddInput()

void MutateTxAddInput ( CMutableTransaction & tx,
const std::string & strInput )
static

Definition at line 259 of file bitcoin-tx.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MutateTxAddOutAddr()

void MutateTxAddOutAddr ( CMutableTransaction & tx,
const std::string & strInput )
static

Definition at line 294 of file bitcoin-tx.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MutateTxAddOutData()

void MutateTxAddOutData ( CMutableTransaction & tx,
const std::string & strInput )
static

Definition at line 434 of file bitcoin-tx.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MutateTxAddOutMultiSig()

void MutateTxAddOutMultiSig ( CMutableTransaction & tx,
const std::string & strInput )
static

Definition at line 361 of file bitcoin-tx.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MutateTxAddOutPubKey()

void MutateTxAddOutPubKey ( CMutableTransaction & tx,
const std::string & strInput )
static

Definition at line 318 of file bitcoin-tx.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MutateTxAddOutScript()

void MutateTxAddOutScript ( CMutableTransaction & tx,
const std::string & strInput )
static

Definition at line 464 of file bitcoin-tx.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MutateTxDelInput()

void MutateTxDelInput ( CMutableTransaction & tx,
const std::string & strInIdx )
static

Definition at line 508 of file bitcoin-tx.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MutateTxDelOutput()

void MutateTxDelOutput ( CMutableTransaction & tx,
const std::string & strOutIdx )
static

Definition at line 517 of file bitcoin-tx.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MutateTxLocktime()

void MutateTxLocktime ( CMutableTransaction & tx,
const std::string & cmdVal )
static

Definition at line 221 of file bitcoin-tx.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MutateTxRBFOptIn()

void MutateTxRBFOptIn ( CMutableTransaction & tx,
const std::string & strInIdx )
static

Definition at line 230 of file bitcoin-tx.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MutateTxSign()

void MutateTxSign ( CMutableTransaction & tx,
const std::string & flagStr )
static

Definition at line 576 of file bitcoin-tx.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MutateTxVersion()

void MutateTxVersion ( CMutableTransaction & tx,
const std::string & cmdVal )
static

Definition at line 212 of file bitcoin-tx.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OutputTx()

void OutputTx ( const CTransaction & tx)
static

Definition at line 767 of file bitcoin-tx.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OutputTxHash()

void OutputTxHash ( const CTransaction & tx)
static

Definition at line 753 of file bitcoin-tx.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OutputTxHex()

void OutputTxHex ( const CTransaction & tx)
static

Definition at line 760 of file bitcoin-tx.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OutputTxJSON()

void OutputTxJSON ( const CTransaction & tx)
static

Definition at line 744 of file bitcoin-tx.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ParseHexUV()

std::vector< unsigned char > ParseHexUV ( const UniValue & v,
const std::string & strName )
static

Definition at line 566 of file bitcoin-tx.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readStdin()

std::string readStdin ( )
static

Definition at line 777 of file bitcoin-tx.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RegisterLoad()

void RegisterLoad ( const std::string & strInput)
static

Definition at line 162 of file bitcoin-tx.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RegisterSet()

void RegisterSet ( const std::string & strInput)
static

Definition at line 147 of file bitcoin-tx.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RegisterSetJson()

void RegisterSetJson ( const std::string & key,
const std::string & rawJson )
static

Definition at line 136 of file bitcoin-tx.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetupBitcoinTxArgs()

void SetupBitcoinTxArgs ( ArgsManager & argsman)
static

Definition at line 46 of file bitcoin-tx.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SplitString()

std::vector< std::string > util::SplitString ( std::string_view str,
char sep )
inlinenodiscard

Definition at line 149 of file string.h.

Here is the caller graph for this function:

◆ ToString()

template<typename T>
std::string util::ToString ( const T & t)

Locale-independent version of std::to_string.

Definition at line 246 of file string.h.

Here is the caller graph for this function:

◆ TrimAndParse()

template<typename T>
T TrimAndParse ( const std::string & int_str,
const std::string & err )
static

Definition at line 250 of file bitcoin-tx.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TrimString()

std::string util::TrimString ( std::string_view str,
std::string_view pattern = " \f\n\r\t\v" )
inlinenodiscard

Definition at line 169 of file string.h.

Here is the caller graph for this function:

◆ TrimStringView()

std::string_view util::TrimStringView ( std::string_view str,
std::string_view pattern = " \f\n\r\t\v" )
inlinenodiscard

Definition at line 159 of file string.h.

Here is the caller graph for this function:

Variable Documentation

◆ CONTINUE_EXECUTION

const int CONTINUE_EXECUTION =-1
static

Definition at line 42 of file bitcoin-tx.cpp.

◆ fCreateBlank

bool fCreateBlank
static

Definition at line 40 of file bitcoin-tx.cpp.

◆ flags

int flags

Definition at line 529 of file bitcoin-tx.cpp.

◆ flagStr

const char* flagStr

Definition at line 528 of file bitcoin-tx.cpp.

◆ G_TRANSLATION_FUN

const TranslateFn G_TRANSLATION_FUN {nullptr}

Translate string to current locale using Qt.

Definition at line 44 of file bitcoin-tx.cpp.

◆ MAIN_FUNCTION

MAIN_FUNCTION
Initial value:
{
SetupEnvironment()
Definition system.cpp:64

Definition at line 858 of file bitcoin-tx.cpp.

◆ N_SIGHASH_OPTS

const unsigned int N_SIGHASH_OPTS = 7
static

Definition at line 526 of file bitcoin-tx.cpp.

◆ registers

std::map<std::string,UniValue> registers
static

Definition at line 41 of file bitcoin-tx.cpp.

◆ ret

return ret = EXIT_FAILURE

Definition at line 875 of file bitcoin-tx.cpp.

◆ [struct]

const struct { ... } sighashOptions[N_SIGHASH_OPTS]
Initial value:
= {
{"DEFAULT", SIGHASH_DEFAULT},
{"ALL", SIGHASH_ALL},
{"NONE", SIGHASH_NONE},
{"SINGLE", SIGHASH_SINGLE},
{"ALL|ANYONECANPAY", SIGHASH_ALL|SIGHASH_ANYONECANPAY},
{"NONE|ANYONECANPAY", SIGHASH_NONE|SIGHASH_ANYONECANPAY},
{"SINGLE|ANYONECANPAY", SIGHASH_SINGLE|SIGHASH_ANYONECANPAY},
}
@ SIGHASH_ANYONECANPAY
Definition interpreter.h:34
@ SIGHASH_DEFAULT
Taproot only; implied when sighash byte is missing, and equivalent to SIGHASH_ALL.
Definition interpreter.h:36
@ SIGHASH_ALL
Definition interpreter.h:31
@ SIGHASH_NONE
Definition interpreter.h:32
@ SIGHASH_SINGLE
Definition interpreter.h:33

◆ try

try
Initial value:
{
int ret = AppInitRawTx(argc, argv)
int ret
static int AppInitRawTx(int argc, char *argv[])

Definition at line 862 of file bitcoin-tx.cpp.