set -euo pipefail
+# filesystem directories
DATA_DIRECTORY=".data"
+USB_DIRECTORY="$DATA_DIRECTORY/.usb"
+
+# options
+ENCRYPTION="luks"
+MODE=
+
+# multisig parameters (M of N)
M=3
N=7
-MODE=
-ENCRYPTION="luks"
-USB_PATH=
-USB_DIRECTORY="$DATA_DIRECTORY/.usb"
+
+# variables used in usb functions
USB_DECRYPT_NAME="cold-usb"
+USB_PATH=
USB_PATH_PRE_DECRYPT=
-BITCOIN_CLI="bitcoin-cli -datadir=$DATA_DIRECTORY -chain=regtest"
+BITCOIN_CLI="bitcoin-cli -datadir=$DATA_DIRECTORY"
bitcoin_core_start() {
RUNNING=`ps -A | ( grep bitcoind > /dev/null && echo "1" ) || echo "0"`
setup_test_wallets
multisig_create
-EXPECTED="87faa7387bf537283ef62654bf897c4198e3e27c7c97868cdda2e9dcf1945685dfc00722272a97f690afdb6549aaf16fe3e05f78c5fef8447b798787dd092891 .data/descriptors.txt"
+EXPECTED="c7f64e597a1a36e00eacd8683dd235cb5a27718b93020a450ef8dfaadcadc971944cf9ecb222523f45aab629e07d0b30432811ebcec1a93f7c9185feadf7d722 .data/descriptors.txt"
assert "$EXPECTED" "`b2sum $DATA_DIRECTORY/descriptors.txt`"
M=1
N=3
multisig_create
-EXPECTED="a4cfdcbe25bd990e66bd6f8f86597cbeca08fb38b5fa448f7d77e9bc8de24e52c6dabfd25e6ddd1e716c6fac695af5e5d830a43e654a84c1bb51db937599f37f .data/descriptors.txt"
+EXPECTED="8cc32973b09603ed26f038c2812d91b465a70dd70076645569d4e4a1b6ec399b05b48b091ae587fd89fc9b5a4002897a1cced1a74b43975093db3d7b1698804c .data/descriptors.txt"
assert "$EXPECTED" "`b2sum $DATA_DIRECTORY/descriptors.txt`"
M=3
N=5
multisig_create
-EXPECTED="702de574ece926314e6ffdc2cba809549eeea97e5e3de16dfed41c462dcc84ffeb9bcd2a5b95b7aa3747c336aa6ad7beaeb7376e607a35c7cd762db9bb6b2425 .data/descriptors.txt"
+EXPECTED="b1b5c5ece2083d4310af19a93dd91e7efd7aa8b68dfa45773f5c7f98002797e22e8a6239b4eaa2a57de7180668d5711b54f69b3f2ba3fd99acba48353306908f .data/descriptors.txt"
assert "$EXPECTED" "`b2sum $DATA_DIRECTORY/descriptors.txt`"
M=6
N=7
multisig_create
-EXPECTED="48513d041c3eeaa162dde91f252dee4925eb1a2ecb8099ca6d64a121e913ca49322fea7eaf00af8a80dfc59f6764033272f81bb369b3eebcfbd19d6054863410 .data/descriptors.txt"
+EXPECTED="dbad09fff0449b0424c3261b80a103006117557e591f35b1b14a24506a799637a1762212bef182b65f61d8a4f1b1951d2b2578efe9057d2bfa687791d1fcad85 .data/descriptors.txt"
assert "$EXPECTED" "`b2sum $DATA_DIRECTORY/descriptors.txt`"
clean_env
Use bitcoin core to get information on fully formed change descriptors and output result to descriptors.txt:
cat change.descriptors | bitcoin-cli -stdin getdescriptorinfo | jq -j '.descriptor' >> descriptors.txt
+
+
+multi-signature descriptors created and saved to descriptors.txt successfully
EOF
assert "$(<expected)" "$(<result)"
source source.sh
+BITCOIN_CLI="bitcoin-cli -datadir=$DATA_DIRECTORY -chain=regtest"
+
assert() {
if [[ "$1" != "$2" ]]; then
echo -e "Expected:\n$1\nResult:\n$2"
} > /dev/null 2>&1
setup_test_descriptors() {
+ RANGE=${1:-999}
+
cat > wallet1.descriptors << EOF
{
"wallet_name": "wallet1",
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
}
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
}
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
}
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
}
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
}
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
}
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": false,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
},
"internal": true,
"range": [
0,
- 2999
+ $RANGE
],
"next": 0
}
reset_env
-setup_test_descriptors
+setup_test_descriptors 2999
(eval "$BITCOIN_CLI -named createwallet wallet_name=live descriptors=true blank=true disable_private_keys=true" > result)
EXPECTED='{