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

Function createpsbt

src/rpc/rawtransaction.cpp:2077–2224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2075}
2076
2077static RPCHelpMan createpsbt()
2078{
2079 return RPCHelpMan{"createpsbt",
2080 "\nCreates a transaction in the Partially Signed Transaction format.\n"
2081 "Implements the Creator role.\n",
2082 {
2083 {"inputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "The json objects",
2084 {
2085 {"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
2086 {
2087 {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"},
2088 {"vout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The output number"},
2089 {"sequence", RPCArg::Type::NUM, RPCArg::DefaultHint{"depends on the value of the 'replaceable' and 'locktime' arguments"}, "The sequence number"},
2090 {"pegin_bitcoin_tx", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The raw bitcoin transaction (in hex) depositing bitcoin to the mainchain_address generated by getpeginaddress"},
2091 {"pegin_txout_proof", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "A rawtxoutproof (in hex) generated by the mainchain daemon's `gettxoutproof` containing a proof of only bitcoin_tx"},
2092 {"pegin_claim_script", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The witness program generated by getpeginaddress."},
2093 {"issuance_amount", RPCArg::Type::NUM, RPCArg::Optional::OMITTED, "The amount to be issued"},
2094 {"issuance_tokens", RPCArg::Type::NUM, RPCArg::Optional::OMITTED, "The number of asset issuance tokens to generate"},
2095 {"asset_entropy", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "For new asset issuance, this is any additional entropy to be used in the asset tag calculation. For reissuance, this is the original asaset entropy"},
2096 {"asset_blinding_nonce", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "Do not set for new asset issuance. For reissuance, this is the blinding factor for reissuance token output for the asset being reissued"},
2097 {"blind_reissuance", RPCArg::Type::BOOL, RPCArg::Default{true}, "Whether to mark the issuance input for blinding or not. Only affects issuances with re-issuance tokens."},
2098 },
2099 },
2100 },
2101 },
2102 {"outputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "The outputs (key-value pairs), where none of the keys are duplicated.\n"
2103 "That is, each address can only appear once and there can only be one 'data' object.\n"
2104 "For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also\n"
2105 " accepted as second parameter.",
2106 {
2107 {"", RPCArg::Type::OBJ_USER_KEYS, RPCArg::Optional::OMITTED, "",
2108 {
2109 {"address", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in " + CURRENCY_UNIT},
2110 {"blinder_index", RPCArg::Type::NUM, RPCArg::Optional::OMITTED, "The index of the input whose signer will blind this output. Must be provided if this output is to be blinded"},
2111 {"asset", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "The asset tag for this output if it is not the main chain asset"},
2112 },
2113 },
2114 {"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
2115 {
2116 {"data", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "A key-value pair. The key must be \"data\", the value is hex-encoded data"},
2117 },
2118 },
2119 },
2120 },
2121 {"locktime", RPCArg::Type::NUM, RPCArg::Default{0}, "Raw locktime. Non-0 value also locktime-activates inputs"},
2122 {"replaceable", RPCArg::Type::BOOL, RPCArg::Default{false}, "Marks this transaction as BIP125 replaceable.\n"
2123 " Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible."},
2124 {"psbt_version", RPCArg::Type::NUM, RPCArg::Default{2}, "The PSBT version number to use."},
2125 },
2126 RPCResult{
2127 RPCResult::Type::STR, "", "The resulting raw transaction (base64-encoded string)"
2128 },
2129 RPCExamples{
2130 HelpExampleCli("createpsbt", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"[{\\\"data\\\":\\\"00010203\\\"}]\"")
2131 },
2132 [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
2133{
2134 if (!g_con_elementsmode)

Callers

nothing calls this directly

Calls 15

HelpExampleCliFunction · 0.85
RPCTypeCheckFunction · 0.85
ConstructTransactionFunction · 0.85
JSONRPCErrorFunction · 0.85
GenerateAssetEntropyFunction · 0.85
CalculateAssetFunction · 0.85
CalculateReissuanceTokenFunction · 0.85
EncodePSBTFunction · 0.85
isTrueMethod · 0.80
get_intMethod · 0.80
get_boolMethod · 0.80
findMethod · 0.80

Tested by

no test coverage detected