Remove P2SH

This commit is contained in:
likho 2022-12-05 12:52:59 +02:00
parent b1d2d1ce26
commit bc5e7fcaac

View file

@ -50,7 +50,7 @@ const String GENESIS_HASH_MAINNET =
const String GENESIS_HASH_TESTNET =
"0000594ada5310b367443ee0afd4fa3d0bbd5850ea4e33cdc7d6a904a7ec7c90";
enum DerivePathType { bip44, bip49 }
enum DerivePathType { bip44, bip84 }
bip32.BIP32 getBip32Node(int chain, int index, String mnemonic,
NetworkType network, DerivePathType derivePathType) {
@ -86,8 +86,8 @@ bip32.BIP32 getBip32NodeFromRoot(
switch (derivePathType) {
case DerivePathType.bip44:
return root.derivePath("m/44'/$coinType'/0'/$chain/$index");
case DerivePathType.bip49:
return root.derivePath("m/49'/$coinType'/0'/$chain/$index");
case DerivePathType.bip84:
return root.derivePath("m/84'/$coinType'/0'/$chain/$index");
default:
throw Exception("DerivePathType must not be null.");
}
@ -203,11 +203,6 @@ class ParticlWallet extends CoinServiceAPI {
_getCurrentAddressForChain(0, DerivePathType.bip44);
Future<String>? _currentReceivingAddressP2PKH;
// Future<String> get currentReceivingAddressP2SH =>
// _currentReceivingAddressP2SH ??=
// _getCurrentAddressForChain(0, DerivePathType.bip49);
Future<String>? _currentReceivingAddressP2SH;
@override
Future<void> exit() async {
_hasCalledExit = true;
@ -271,10 +266,6 @@ class ParticlWallet extends CoinServiceAPI {
// P2PKH
return DerivePathType.bip44;
}
if (decodeBase58[0] == _network.scriptHash) {
// P2SH
return DerivePathType.bip49;
}
throw ArgumentError('Invalid version or Network mismatch');
} else {
try {
@ -357,27 +348,20 @@ class ParticlWallet extends CoinServiceAPI {
longMutex = true;
Map<String, Map<String, String>> p2pkhReceiveDerivations = {};
Map<String, Map<String, String>> p2shReceiveDerivations = {};
Map<String, Map<String, String>> p2pkhChangeDerivations = {};
Map<String, Map<String, String>> p2shChangeDerivations = {};
final root = await compute(getBip32RootWrapper, Tuple2(mnemonic, _network));
List<String> p2pkhReceiveAddressArray = [];
List<String> p2shReceiveAddressArray = [];
int p2pkhReceiveIndex = -1;
int p2shReceiveIndex = -1;
List<String> p2pkhChangeAddressArray = [];
List<String> p2shChangeAddressArray = [];
int p2pkhChangeIndex = -1;
int p2shChangeIndex = -1;
// The gap limit will be capped at [maxUnusedAddressGap]
// int receivingGapCounter = 0;
// int changeGapCounter = 0;
// actual size is 24 due to p2pkh and p2sh so 12x2
// actual size is 12 due to p2pkh so 12x1
const txCountBatchSize = 12;
try {
@ -387,20 +371,13 @@ class ParticlWallet extends CoinServiceAPI {
final resultReceive44 = _checkGaps(maxNumberOfIndexesToCheck,
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip44, 0);
final resultReceive49 = _checkGaps(maxNumberOfIndexesToCheck,
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip49, 0);
Logging.instance
.log("checking change addresses...", level: LogLevel.Info);
// change addresses
final resultChange44 = _checkGaps(maxNumberOfIndexesToCheck,
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip44, 1);
final resultChange49 = _checkGaps(maxNumberOfIndexesToCheck,
maxUnusedAddressGap, txCountBatchSize, root, DerivePathType.bip49, 1);
await Future.wait(
[resultReceive44, resultReceive49, resultChange44, resultChange49]);
await Future.wait([resultReceive44, resultChange44]);
p2pkhReceiveAddressArray =
(await resultReceive44)['addressArray'] as List<String>;
@ -408,24 +385,12 @@ class ParticlWallet extends CoinServiceAPI {
p2pkhReceiveDerivations = (await resultReceive44)['derivations']
as Map<String, Map<String, String>>;
p2shReceiveAddressArray =
(await resultReceive49)['addressArray'] as List<String>;
p2shReceiveIndex = (await resultReceive49)['index'] as int;
p2shReceiveDerivations = (await resultReceive49)['derivations']
as Map<String, Map<String, String>>;
p2pkhChangeAddressArray =
(await resultChange44)['addressArray'] as List<String>;
p2pkhChangeIndex = (await resultChange44)['index'] as int;
p2pkhChangeDerivations = (await resultChange44)['derivations']
as Map<String, Map<String, String>>;
p2shChangeAddressArray =
(await resultChange49)['addressArray'] as List<String>;
p2shChangeIndex = (await resultChange49)['index'] as int;
p2shChangeDerivations = (await resultChange49)['derivations']
as Map<String, Map<String, String>>;
// save the derivations (if any)
if (p2pkhReceiveDerivations.isNotEmpty) {
await addDerivations(
@ -433,24 +398,13 @@ class ParticlWallet extends CoinServiceAPI {
derivePathType: DerivePathType.bip44,
derivationsToAdd: p2pkhReceiveDerivations);
}
if (p2shReceiveDerivations.isNotEmpty) {
await addDerivations(
chain: 0,
derivePathType: DerivePathType.bip49,
derivationsToAdd: p2shReceiveDerivations);
}
if (p2pkhChangeDerivations.isNotEmpty) {
await addDerivations(
chain: 1,
derivePathType: DerivePathType.bip44,
derivationsToAdd: p2pkhChangeDerivations);
}
if (p2shChangeDerivations.isNotEmpty) {
await addDerivations(
chain: 1,
derivePathType: DerivePathType.bip49,
derivationsToAdd: p2shChangeDerivations);
}
// If restoring a wallet that never received any funds, then set receivingArray manually
// If we didn't do this, it'd store an empty array
@ -460,12 +414,6 @@ class ParticlWallet extends CoinServiceAPI {
p2pkhReceiveAddressArray.add(address);
p2pkhReceiveIndex = 0;
}
if (p2shReceiveIndex == -1) {
final address =
await _generateAddressForChain(0, 0, DerivePathType.bip49);
p2shReceiveAddressArray.add(address);
p2shReceiveIndex = 0;
}
// If restoring a wallet that never sent any funds with change, then set changeArray
// manually. If we didn't do this, it'd store an empty array.
@ -475,12 +423,6 @@ class ParticlWallet extends CoinServiceAPI {
p2pkhChangeAddressArray.add(address);
p2pkhChangeIndex = 0;
}
if (p2shChangeIndex == -1) {
final address =
await _generateAddressForChain(1, 0, DerivePathType.bip49);
p2shChangeAddressArray.add(address);
p2shChangeIndex = 0;
}
await DB.instance.put<dynamic>(
boxName: walletId,
@ -490,10 +432,7 @@ class ParticlWallet extends CoinServiceAPI {
boxName: walletId,
key: 'changeAddressesP2PKH',
value: p2pkhChangeAddressArray);
await DB.instance.put<dynamic>(
boxName: walletId,
key: 'receivingAddressesP2SH',
value: p2shReceiveAddressArray);
await DB.instance.put<dynamic>(
boxName: walletId,
key: 'changeAddressesP2SH',
@ -504,12 +443,7 @@ class ParticlWallet extends CoinServiceAPI {
boxName: walletId,
key: 'receivingIndexP2PKH',
value: p2pkhReceiveIndex);
await DB.instance.put<dynamic>(
boxName: walletId,
key: 'receivingIndexP2SH',
value: p2shReceiveIndex);
await DB.instance.put<dynamic>(
boxName: walletId, key: 'changeIndexP2SH', value: p2shChangeIndex);
await DB.instance
.put<dynamic>(boxName: walletId, key: "id", value: _walletId);
await DB.instance
@ -568,17 +502,6 @@ class ParticlWallet extends CoinServiceAPI {
.data
.address!;
break;
case DerivePathType.bip49:
address = P2SH(
data: PaymentData(
redeem: P2WPKH(
data: PaymentData(pubkey: node.publicKey),
network: _network)
.data),
network: _network)
.data
.address!;
break;
default:
throw Exception("No Path type $type exists");
}
@ -903,14 +826,12 @@ class ParticlWallet extends CoinServiceAPI {
if (shouldAutoSync) {
timer ??= Timer.periodic(const Duration(seconds: 150), (timer) async {
// chain height check currently broken
// if ((await chainHeight) != (await storedChainHeight)) {
if (await refreshIfThereIsNewData()) {
await refresh();
GlobalEventBus.instance.fire(UpdatedInBackgroundEvent(
"New data found in $walletId $walletName in background!",
walletId));
}
// }
});
}
} catch (error, strace) {
@ -1309,16 +1230,6 @@ class ParticlWallet extends CoinServiceAPI {
DB.instance.get<dynamic>(boxName: walletId, key: 'changeAddressesP2PKH')
as List<dynamic>;
// for (var i = 0; i < receivingAddresses.length; i++) {
// if (!allAddresses.contains(receivingAddresses[i])) {
// allAddresses.add(receivingAddresses[i]);
// }
// }
// for (var i = 0; i < changeAddresses.length; i++) {
// if (!allAddresses.contains(changeAddresses[i])) {
// allAddresses.add(changeAddresses[i]);
// }
// }
for (var i = 0; i < receivingAddressesP2PKH.length; i++) {
if (!allAddresses.contains(receivingAddressesP2PKH[i])) {
allAddresses.add(receivingAddressesP2PKH[i] as String);
@ -1391,10 +1302,7 @@ class ParticlWallet extends CoinServiceAPI {
.put<dynamic>(boxName: walletId, key: "receivingIndexP2PKH", value: 0);
await DB.instance
.put<dynamic>(boxName: walletId, key: "changeIndexP2PKH", value: 0);
await DB.instance
.put<dynamic>(boxName: walletId, key: "receivingIndexP2SH", value: 0);
await DB.instance
.put<dynamic>(boxName: walletId, key: "changeIndexP2SH", value: 0);
await DB.instance.put<dynamic>(
boxName: walletId,
key: 'blocked_tx_hashes',
@ -1412,26 +1320,13 @@ class ParticlWallet extends CoinServiceAPI {
final initialChangeAddressP2PKH =
await _generateAddressForChain(1, 0, DerivePathType.bip44);
final initialReceivingAddressP2SH =
await _generateAddressForChain(0, 0, DerivePathType.bip49);
final initialChangeAddressP2SH =
await _generateAddressForChain(1, 0, DerivePathType.bip49);
await _addToAddressesArrayForChain(
initialReceivingAddressP2PKH, 0, DerivePathType.bip44);
await _addToAddressesArrayForChain(
initialChangeAddressP2PKH, 1, DerivePathType.bip44);
await _addToAddressesArrayForChain(
initialReceivingAddressP2SH, 0, DerivePathType.bip49);
await _addToAddressesArrayForChain(
initialChangeAddressP2SH, 1, DerivePathType.bip49);
// this._currentReceivingAddress = Future(() => initialReceivingAddress);
var newaddr = await _getCurrentAddressForChain(0, DerivePathType.bip44);
_currentReceivingAddressP2PKH = Future(() => newaddr);
_currentReceivingAddressP2SH = Future(() => initialReceivingAddressP2SH);
Logging.instance.log("_generateNewWalletFinished", level: LogLevel.Info);
}
@ -1456,23 +1351,7 @@ class ParticlWallet extends CoinServiceAPI {
),
);
final data = PaymentData(pubkey: node.publicKey);
final p2shData = PaymentData(
redeem:
P2WPKH(data: PaymentData(pubkey: node.publicKey), network: _network)
.data);
String address;
switch (derivePathType) {
case DerivePathType.bip44:
address = P2PKH(data: data, network: _network).data.address!;
break;
case DerivePathType.bip49:
address = P2SH(data: p2shData, network: _network).data.address!;
break;
// default:
// // should never hit this due to all enum cases handled
// return null;
}
String address = P2PKH(data: data, network: _network).data.address!;
// add generated address & info to derivations
await addDerivation(
@ -1496,9 +1375,6 @@ class ParticlWallet extends CoinServiceAPI {
case DerivePathType.bip44:
indexKey += "P2PKH";
break;
case DerivePathType.bip49:
indexKey += "P2SH";
break;
}
final newIndex =
@ -1522,9 +1398,6 @@ class ParticlWallet extends CoinServiceAPI {
case DerivePathType.bip44:
chainArray += "P2PKH";
break;
case DerivePathType.bip49:
chainArray += "P2SH";
break;
}
final addressArray =
@ -1559,9 +1432,6 @@ class ParticlWallet extends CoinServiceAPI {
case DerivePathType.bip44:
arrayKey += "P2PKH";
break;
case DerivePathType.bip49:
arrayKey += "P2SH";
break;
}
if (kDebugMode) {
@ -1576,14 +1446,8 @@ class ParticlWallet extends CoinServiceAPI {
{required int chain, required DerivePathType derivePathType}) {
String key;
String chainId = chain == 0 ? "receive" : "change";
switch (derivePathType) {
case DerivePathType.bip44:
key = "${walletId}_${chainId}DerivationsP2PKH";
break;
case DerivePathType.bip49:
key = "${walletId}_${chainId}DerivationsP2SH";
break;
}
key = "${walletId}_${chainId}DerivationsP2PKH";
return key;
}
@ -1911,9 +1775,6 @@ class ParticlWallet extends CoinServiceAPI {
case DerivePathType.bip44:
indexKey += "P2PKH";
break;
case DerivePathType.bip49:
indexKey += "P2SH";
break;
}
final newReceivingIndex =
DB.instance.get<dynamic>(boxName: walletId, key: indexKey) as int;
@ -1932,9 +1793,6 @@ class ParticlWallet extends CoinServiceAPI {
case DerivePathType.bip44:
_currentReceivingAddressP2PKH = Future(() => newReceivingAddress);
break;
case DerivePathType.bip49:
_currentReceivingAddressP2SH = Future(() => newReceivingAddress);
break;
}
}
} on SocketException catch (se, s) {
@ -1970,9 +1828,6 @@ class ParticlWallet extends CoinServiceAPI {
case DerivePathType.bip44:
indexKey += "P2PKH";
break;
case DerivePathType.bip49:
indexKey += "P2SH";
break;
}
final newChangeIndex =
DB.instance.get<dynamic>(boxName: walletId, key: indexKey) as int;
@ -2160,13 +2015,6 @@ class ParticlWallet extends CoinServiceAPI {
final changeAddresses =
DB.instance.get<dynamic>(boxName: walletId, key: 'changeAddressesP2PKH')
as List<dynamic>;
final changeAddressesP2SH =
DB.instance.get<dynamic>(boxName: walletId, key: 'changeAddressesP2SH')
as List<dynamic>;
for (var i = 0; i < changeAddressesP2SH.length; i++) {
changeAddresses.add(changeAddressesP2SH[i] as String);
}
final List<Map<String, dynamic>> allTxHashes =
await _fetchHistory(allAddresses);
@ -2874,9 +2722,6 @@ class ParticlWallet extends CoinServiceAPI {
case DerivePathType.bip44:
addressesP2PKH.add(address);
break;
case DerivePathType.bip49:
addressesP2SH.add(address);
break;
}
}
}
@ -2940,78 +2785,6 @@ class ParticlWallet extends CoinServiceAPI {
}
}
// p2sh / bip49
final p2shLength = addressesP2SH.length;
if (p2shLength > 0) {
print("THIS P2SH IS NOT NULL");
final receiveDerivations = await _fetchDerivations(
chain: 0,
derivePathType: DerivePathType.bip49,
);
final changeDerivations = await _fetchDerivations(
chain: 1,
derivePathType: DerivePathType.bip49,
);
for (int i = 0; i < p2shLength; i++) {
// receives
final receiveDerivation = receiveDerivations[addressesP2SH[i]];
// if a match exists it will not be null
if (receiveDerivation != null) {
final p2wpkh = P2WPKH(
data: PaymentData(
pubkey: Format.stringToUint8List(
receiveDerivation["pubKey"] as String)),
network: _network)
.data;
final redeemScript = p2wpkh.output;
final data =
P2SH(data: PaymentData(redeem: p2wpkh), network: _network).data;
for (String tx in addressTxid[addressesP2SH[i]]!) {
results[tx] = {
"output": data.output,
"keyPair": ECPair.fromWIF(
receiveDerivation["wif"] as String,
network: _network,
),
"redeemScript": redeemScript,
};
}
} else {
// if its not a receive, check change
final changeDerivation = changeDerivations[addressesP2SH[i]];
// if a match exists it will not be null
if (changeDerivation != null) {
final p2wpkh = P2WPKH(
data: PaymentData(
pubkey: Format.stringToUint8List(
changeDerivation["pubKey"] as String)),
network: _network)
.data;
final redeemScript = p2wpkh.output;
final data =
P2SH(data: PaymentData(redeem: p2wpkh), network: _network)
.data;
for (String tx in addressTxid[addressesP2SH[i]]!) {
results[tx] = {
"output": data.output,
"keyPair": ECPair.fromWIF(
changeDerivation["wif"] as String,
network: _network,
),
"redeemScript": redeemScript,
};
}
}
}
}
}
Logging.instance.log("FETCHED TX BUILD DATA IS -----$results",
level: LogLevel.Info, printFullLength: true);
return results;
@ -3067,11 +2840,12 @@ class ParticlWallet extends CoinServiceAPI {
Logging.instance.log("AND THIS DATA IS -----${utxoSigningData[txid]}",
level: LogLevel.Info, printFullLength: true);
// txb.sign(
// vin: i,
// keyPair: utxoSigningData[txid]["keyPair"] as ECPair,
// witnessValue: utxosToUse[i].value,
// redeemScript: utxoSigningData[txid]["redeemScript"] as Uint8List?);
txb.sign(
vin: i,
keyPair: utxoSigningData[txid]["keyPair"] as ECPair,
witnessValue: utxosToUse[i].value,
hashType: 1,
redeemScript: utxoSigningData[txid]["redeemScript"] as Uint8List?);
}
} catch (e, s) {
Logging.instance.log("Caught exception while signing transaction: $e\n$s",
@ -3082,22 +2856,7 @@ class ParticlWallet extends CoinServiceAPI {
final builtTx = txb.buildIncomplete();
final vSize = builtTx.virtualSize();
print("BUILT TX IS ${builtTx.toHex().toString()}");
// String hexBefore = builtTx.toHex();
// if (builtTx.toHex().toString().endsWith('0000')) {
// // print("END WITH ZERO");
// String stripped = hexBefore.substring(0, hexBefore.length - 4);
// return {"hex": stripped, "vSize": vSize};
// // } else {
// // print("DOES NOT END WITH ZERO");
// // return {"hex": builtTx.toHex(), "vSize": vSize};
// }
return {"hex": builtTx.toHex(), "vSize": vSize};
// print("AND NOW IT IS $stripped");
//
// return {"hex": stripped, "vSize": vSize};
}
@override
@ -3195,38 +2954,6 @@ class ParticlWallet extends CoinServiceAPI {
await DB.instance
.delete<dynamic>(key: 'changeIndexP2PKH_BACKUP', boxName: walletId);
// p2Sh
final tempReceivingAddressesP2SH = DB.instance
.get<dynamic>(boxName: walletId, key: 'receivingAddressesP2SH_BACKUP');
final tempChangeAddressesP2SH = DB.instance
.get<dynamic>(boxName: walletId, key: 'changeAddressesP2SH_BACKUP');
final tempReceivingIndexP2SH = DB.instance
.get<dynamic>(boxName: walletId, key: 'receivingIndexP2SH_BACKUP');
final tempChangeIndexP2SH = DB.instance
.get<dynamic>(boxName: walletId, key: 'changeIndexP2SH_BACKUP');
await DB.instance.put<dynamic>(
boxName: walletId,
key: 'receivingAddressesP2SH',
value: tempReceivingAddressesP2SH);
await DB.instance.put<dynamic>(
boxName: walletId,
key: 'changeAddressesP2SH',
value: tempChangeAddressesP2SH);
await DB.instance.put<dynamic>(
boxName: walletId,
key: 'receivingIndexP2SH',
value: tempReceivingIndexP2SH);
await DB.instance.put<dynamic>(
boxName: walletId, key: 'changeIndexP2SH', value: tempChangeIndexP2SH);
await DB.instance.delete<dynamic>(
key: 'receivingAddressesP2SH_BACKUP', boxName: walletId);
await DB.instance
.delete<dynamic>(key: 'changeAddressesP2SH_BACKUP', boxName: walletId);
await DB.instance
.delete<dynamic>(key: 'receivingIndexP2SH_BACKUP', boxName: walletId);
await DB.instance
.delete<dynamic>(key: 'changeIndexP2SH_BACKUP', boxName: walletId);
// P2PKH derivations
final p2pkhReceiveDerivationsString = await _secureStore.read(
key: "${walletId}_receiveDerivationsP2PKH_BACKUP");
@ -3244,22 +2971,6 @@ class ParticlWallet extends CoinServiceAPI {
key: "${walletId}_receiveDerivationsP2PKH_BACKUP");
await _secureStore.delete(key: "${walletId}_changeDerivationsP2PKH_BACKUP");
// P2SH derivations
final p2shReceiveDerivationsString = await _secureStore.read(
key: "${walletId}_receiveDerivationsP2SH_BACKUP");
final p2shChangeDerivationsString = await _secureStore.read(
key: "${walletId}_changeDerivationsP2SH_BACKUP");
await _secureStore.write(
key: "${walletId}_receiveDerivationsP2SH",
value: p2shReceiveDerivationsString);
await _secureStore.write(
key: "${walletId}_changeDerivationsP2SH",
value: p2shChangeDerivationsString);
await _secureStore.delete(key: "${walletId}_receiveDerivationsP2SH_BACKUP");
await _secureStore.delete(key: "${walletId}_changeDerivationsP2SH_BACKUP");
// UTXOs
final utxoData = DB.instance
.get<dynamic>(boxName: walletId, key: 'latest_utxo_model_BACKUP');
@ -3312,43 +3023,6 @@ class ParticlWallet extends CoinServiceAPI {
await DB.instance
.delete<dynamic>(key: 'changeIndexP2PKH', boxName: walletId);
// p2sh
final tempReceivingAddressesP2SH = DB.instance
.get<dynamic>(boxName: walletId, key: 'receivingAddressesP2SH');
await DB.instance.put<dynamic>(
boxName: walletId,
key: 'receivingAddressesP2SH_BACKUP',
value: tempReceivingAddressesP2SH);
await DB.instance
.delete<dynamic>(key: 'receivingAddressesP2SH', boxName: walletId);
final tempChangeAddressesP2SH =
DB.instance.get<dynamic>(boxName: walletId, key: 'changeAddressesP2SH');
await DB.instance.put<dynamic>(
boxName: walletId,
key: 'changeAddressesP2SH_BACKUP',
value: tempChangeAddressesP2SH);
await DB.instance
.delete<dynamic>(key: 'changeAddressesP2SH', boxName: walletId);
final tempReceivingIndexP2SH =
DB.instance.get<dynamic>(boxName: walletId, key: 'receivingIndexP2SH');
await DB.instance.put<dynamic>(
boxName: walletId,
key: 'receivingIndexP2SH_BACKUP',
value: tempReceivingIndexP2SH);
await DB.instance
.delete<dynamic>(key: 'receivingIndexP2SH', boxName: walletId);
final tempChangeIndexP2SH =
DB.instance.get<dynamic>(boxName: walletId, key: 'changeIndexP2SH');
await DB.instance.put<dynamic>(
boxName: walletId,
key: 'changeIndexP2SH_BACKUP',
value: tempChangeIndexP2SH);
await DB.instance
.delete<dynamic>(key: 'changeIndexP2SH', boxName: walletId);
// P2PKH derivations
final p2pkhReceiveDerivationsString =
await _secureStore.read(key: "${walletId}_receiveDerivationsP2PKH");
@ -3365,22 +3039,6 @@ class ParticlWallet extends CoinServiceAPI {
await _secureStore.delete(key: "${walletId}_receiveDerivationsP2PKH");
await _secureStore.delete(key: "${walletId}_changeDerivationsP2PKH");
// P2SH derivations
final p2shReceiveDerivationsString =
await _secureStore.read(key: "${walletId}_receiveDerivationsP2SH");
final p2shChangeDerivationsString =
await _secureStore.read(key: "${walletId}_changeDerivationsP2SH");
await _secureStore.write(
key: "${walletId}_receiveDerivationsP2SH_BACKUP",
value: p2shReceiveDerivationsString);
await _secureStore.write(
key: "${walletId}_changeDerivationsP2SH_BACKUP",
value: p2shChangeDerivationsString);
await _secureStore.delete(key: "${walletId}_receiveDerivationsP2SH");
await _secureStore.delete(key: "${walletId}_changeDerivationsP2SH");
// UTXOs
final utxoData =
DB.instance.get<dynamic>(boxName: walletId, key: 'latest_utxo_model');