SPROUT_PKEY_NAME='sprout-proving.key'
SPROUT_VKEY_NAME='sprout-verifying.key'
-SAPLING_SPEND_NAME='sapling-spend-testnet.params'
-SAPLING_OUTPUT_NAME='sapling-output-testnet.params'
-SAPLING_SPROUT_GROTH16_NAME='sprout-groth16-testnet.params'
-SPROUT_URL="https://z.cash/downloads"
+SAPLING_SPEND_NAME='sapling-spend.params'
+SAPLING_OUTPUT_NAME='sapling-output.params'
+SAPLING_SPROUT_GROTH16_NAME='sprout-groth16.params'
+SPROUT_URL="https://download.z.cash/downloads"
SPROUT_IPFS="/ipfs/QmZKKx7Xup7LiAtFRhYsE1M7waXcv9ir9eCECyXAFGxhEo"
SHA256CMD="$(command -v sha256sum || echo shasum)"
if ! [ -f "$output" ]
then
- for method in wget ipfs curl failure; do
- if "fetch_$method" "$filename" "$dlname"; then
- echo "Download successful!"
- break
+ for i in 1 2
+ do
+ for method in wget ipfs curl failure; do
+ if "fetch_$method" "${filename}.part.${i}" "${dlname}.part.${i}"; then
+ echo "Download of part ${i} successful!"
+ break
+ fi
+ done
+ done
+
+ for i in 1 2
+ do
+ if ! [ -f "${dlname}.part.${i}" ]
+ then
+ fetch_failure
fi
done
+ cat "${dlname}.part.1" "${dlname}.part.2" > "${dlname}"
+ rm "${dlname}.part.1" "${dlname}.part.2"
+
"$SHA256CMD" $SHA256ARGS -c <<EOF
$expectedhash $dlname
EOF
fi
else
# create lock file
- eval "exec 200>/$lockfile"
+ eval "exec 200>$lockfile"
# acquire the lock
flock -n 200 \
&& return 0 \
This script will fetch the Zcash zkSNARK parameters and verify their
integrity with sha256sum.
-NOTE: If you're using testnet or regtest, you will need to invoke this
-script with --testnet in order to download additional parameters. This
-is temporary.
-
If they already exist locally, it will exit now and do nothing else.
EOF
# This may be the first time the user's run this script, so give
# them some info, especially about bandwidth usage:
cat <<EOF
-The parameters are currently just under 911MB in size, so plan accordingly
-for your bandwidth constraints. If the files are already present and
-have the correct sha256sum, no networking is used.
+The complete parameters are currently just under 1.7GB in size, so plan
+accordingly for your bandwidth constraints. If the Sprout parameters are
+already present the additional Sapling parameters required are just under
+800MB in size. If the files are already present and have the correct
+sha256sum, no networking is used.
Creating params directory. For details about this directory, see:
$README_PATH
cd "$PARAMS_DIR"
+ # Sprout parameters:
fetch_params "$SPROUT_PKEY_NAME" "$PARAMS_DIR/$SPROUT_PKEY_NAME" "8bc20a7f013b2b58970cddd2e7ea028975c88ae7ceb9259a5344a16bc2c0eef7"
fetch_params "$SPROUT_VKEY_NAME" "$PARAMS_DIR/$SPROUT_VKEY_NAME" "4bd498dae0aacfd8e98dc306338d017d9c08dd0918ead18172bd0aec2fc5df82"
- if [ "x${1:-}" = 'x--testnet' ]
- then
- echo "(NOTE) Testnet parameters enabled."
- fetch_params "$SAPLING_SPEND_NAME" "$PARAMS_DIR/$SAPLING_SPEND_NAME" "0ed6e26abae38daa80405b44da73af4fda2a9cacdaa3d20da4e81acdce43b7d1"
- fetch_params "$SAPLING_OUTPUT_NAME" "$PARAMS_DIR/$SAPLING_OUTPUT_NAME" "fd36323771e3d3a63289fb7cedc9e41508bd0ae5053eb760340cc4e75d5b5805"
- fetch_params "$SAPLING_SPROUT_GROTH16_NAME" "$PARAMS_DIR/$SAPLING_SPROUT_GROTH16_NAME" "7bae010c761ce11f149466aec6c50a7a2264076b6a75f352d9f60268c1d778b9"
- fi
+ # Sapling parameters:
+ fetch_params "$SAPLING_SPEND_NAME" "$PARAMS_DIR/$SAPLING_SPEND_NAME" "8e48ffd23abb3a5fd9c5589204f32d9c31285a04b78096ba40a79b75677efc13"
+ fetch_params "$SAPLING_OUTPUT_NAME" "$PARAMS_DIR/$SAPLING_OUTPUT_NAME" "2f0ebbcbb9bb0bcffe95a397e7eba89c29eb4dde6191c339db88570e3f3fb0e4"
+ fetch_params "$SAPLING_SPROUT_GROTH16_NAME" "$PARAMS_DIR/$SAPLING_SPROUT_GROTH16_NAME" "b685d700c60328498fbde589c8c7c484c722b788b265b72af448a5bf0ee55b50"
}
-main ${1:-}
+main
rm -f /tmp/fetch_params.lock
exit 0