MCPcopy Create free account
hub / github.com/ElementsProject/elements / decoderawtransaction

Function decoderawtransaction

src/rpc/rawtransaction.cpp:501–585  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

499}
500
501static RPCHelpMan decoderawtransaction()
502{
503 return RPCHelpMan{"decoderawtransaction",
504 "\nReturn a JSON object representing the serialized, hex-encoded transaction.\n",
505 {
506 {"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction hex string"},
507 {"iswitness", RPCArg::Type::BOOL, RPCArg::DefaultHint{"depends on heuristic tests"}, "Whether the transaction hex is a serialized witness transaction.\n"
508 "If iswitness is not present, heuristic tests will be used in decoding.\n"
509 "If true, only witness deserialization will be tried.\n"
510 "If false, only non-witness deserialization will be tried.\n"
511 "This boolean should reflect whether the transaction has inputs\n"
512 "(e.g. fully valid, or on-chain transactions), if known by the caller."
513 },
514 },
515 RPCResult{
516 RPCResult::Type::OBJ, "", "",
517 {
518 {RPCResult::Type::STR_HEX, "txid", "The transaction id"},
519 {RPCResult::Type::STR_HEX, "hash", "The transaction hash (differs from txid for witness transactions)"},
520 {RPCResult::Type::NUM, "size", "The transaction size"},
521 {RPCResult::Type::NUM, "vsize", "The virtual transaction size (differs from size for witness transactions)"},
522 {RPCResult::Type::NUM, "weight", "The transaction's weight (between vsize*4 - 3 and vsize*4)"},
523 {RPCResult::Type::NUM, "version", "The version"},
524 {RPCResult::Type::NUM_TIME, "locktime", "The lock time"},
525 {RPCResult::Type::ARR, "vin", "",
526 {
527 {RPCResult::Type::OBJ, "", "",
528 {
529 {RPCResult::Type::STR_HEX, "coinbase", /*optional=*/true, ""},
530 {RPCResult::Type::STR_HEX, "txid", /*optional=*/true, "The transaction id"},
531 {RPCResult::Type::NUM, "vout", /*optional=*/true, "The output number"},
532 {RPCResult::Type::OBJ, "scriptSig", /*optional=*/true, "The script",
533 {
534 {RPCResult::Type::STR, "asm", "asm"},
535 {RPCResult::Type::STR_HEX, "hex", "hex"},
536 }},
537 {RPCResult::Type::ARR, "txinwitness", /*optional=*/true, "",
538 {
539 {RPCResult::Type::STR_HEX, "hex", "hex-encoded witness data (if any)"},
540 }},
541 {RPCResult::Type::NUM, "sequence", "The script sequence number"},
542 }},
543 }},
544 {RPCResult::Type::ARR, "vout", "",
545 {
546 {RPCResult::Type::OBJ, "", "",
547 {
548 {RPCResult::Type::NUM, "value", "The value in " + CURRENCY_UNIT},
549 {RPCResult::Type::NUM, "n", "index"},
550 {RPCResult::Type::OBJ, "scriptPubKey", "",
551 {
552 {RPCResult::Type::STR, "asm", "the asm"},
553 {RPCResult::Type::STR, "desc", "Inferred descriptor for the output"},
554 {RPCResult::Type::STR_HEX, "hex", "the hex"},
555 {RPCResult::Type::STR, "type", "The type, eg 'pubkeyhash'"},
556 {RPCResult::Type::STR, "address", /*optional=*/true, "The Bitcoin address (only if a well-defined address exists)"},
557 }},
558 }},

Callers

nothing calls this directly

Calls 10

HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
RPCTypeCheckFunction · 0.85
DecodeHexTxFunction · 0.85
JSONRPCErrorFunction · 0.85
TxToUnivFunction · 0.85
get_boolMethod · 0.80
CTransactionClass · 0.50
uint256Class · 0.50
isNullMethod · 0.45

Tested by

no test coverage detected