You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"\nSends Liquid funds to the Bitcoin mainchain, through the federated withdraw mechanism. The wallet internally generates the returned `bitcoin_address` via `bitcoin_xpub` and `bip32_counter` previously set in `initpegoutwallet`. The counter will be incremented upon successful send, avoiding address re-use.\n"
5163
+
+ HelpRequiringPassphrase(pwallet) +
5164
+
"\nArguments:\n"
5165
+
"1. \"address\" (string, required) Must be \"\". Only for non-PAK `sendtomainchain` compatibility.\n"
5166
+
"2. \"amount\" (numeric, required) The amount being sent to `bitcoin_address`.\n"
5167
+
"3. \"subtractfeefromamount\" (boolean, optional, default=false) The fee will be deducted from the amount being pegged-out.\n"
5168
+
"\nResult:\n"
5169
+
"\nResult:\n"
5170
+
"{\n"
5171
+
"\"bitcoin_address\" (string) The destination address on Bitcoin mainchain."
5172
+
"\"txid\" (string) Transaction ID of the resulting Liquid transaction\n"
5173
+
"\"bitcoin_xpub\" (string) The xpubkey of the child destination address.\n"
5174
+
"\"derivation_path\" (string) The derivation path in text that leads to `bitcoin_address` from the `bitcoin_xpub`.\n"
5175
+
"}\n"
5176
+
"\nExamples:\n"
5177
+
+ HelpExampleCli("sendtomainchain", "\"\" 0.1")
5178
+
+ HelpExampleRpc("sendtomainchain", "\"\" 0.1")
5179
+
);
5180
+
5181
+
LOCK2(cs_main, pwallet->cs_wallet);
5182
+
5183
+
EnsureWalletIsUnlocked(pwallet);
5184
+
5185
+
if (!request.params[0].get_str().empty()) {
5186
+
throwJSONRPCError(RPC_TYPE_ERROR, "`address` argument must be \"\" for PAK-enabled networks as the address is generated automatically.");
throwJSONRPCError(RPC_INVALID_PARAMETER, "Invalid amount for send, must send more than 0.0001 BTC");
5193
+
5194
+
bool subtract_fee = false;
5195
+
if (request.params.size() > 2) {
5196
+
subtract_fee = request.params[1].get_bool();
5197
+
}
5198
+
5199
+
CPAKList paklist = g_paklist_blockchain;
5200
+
if (g_paklist_config) {
5201
+
paklist = *g_paklist_config;
5202
+
}
5203
+
if (paklist.IsReject()) {
5204
+
throwJSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Pegout freeze is under effect to aid a pak transition to a new list. Please consult the network operator.");
5205
+
}
5206
+
5207
+
// Fetch pegout key data
5208
+
int counter = pwallet->offline_counter;
5209
+
CExtPubKey& xpub = pwallet->offline_xpub;
5210
+
CPubKey& onlinepubkey = pwallet->online_key;
5211
+
5212
+
if (counter < 0) {
5213
+
throwJSONRPCError(RPC_WALLET_ERROR, "Pegout authorization for this wallet has not been set. Please call `initpegoutwallet` with the appropriate arguments first.");
5214
+
}
5215
+
5216
+
std::vector<uint32_t> vPath;
5217
+
vPath.push_back(0);
5218
+
vPath.push_back((uint32_t)counter);
5219
+
5220
+
secp256k1_pubkey onlinepubkey_secp;
5221
+
if (secp256k1_ec_pubkey_parse(secp256k1_ctx, &onlinepubkey_secp, onlinepubkey.begin(), onlinepubkey.size()) != 1) {
5222
+
throwJSONRPCError(RPC_TYPE_ERROR, "Pubkey is invalid");
0 commit comments