Skip to content

Commit 5adf6dc

Browse files
feat: read private key from env file (#672)
Co-authored-by: Santos Rosati <rosatisantos@gmail.com> Co-authored-by: Tatu <65305492+srosati@users.noreply.github.com>
1 parent 7c79316 commit 5adf6dc

1 file changed

Lines changed: 32 additions & 7 deletions

File tree

batcher/aligned/generate_proof_and_send.sh

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
#!/bin/bash
22

3+
# Get the directory of the script
4+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
5+
6+
# Load environment variables from .env file
7+
if [ -f "$SCRIPT_DIR/.env" ]; then
8+
source "$SCRIPT_DIR/.env"
9+
fi
10+
311
if [ $# -lt 1 ]; then
412
echo "Usage: $0 <x> <repetitions?>"
513
exit 1
@@ -16,10 +24,27 @@ fi
1624
echo "Generating proof $x != 0"
1725
go run scripts/test_files/gnark_groth16_bn254_infinite_script/cmd/main.go $x
1826

19-
./batcher/target/release/aligned submit \
20-
--proving_system Groth16Bn254 \
21-
--repetitions $repetitions \
22-
--proof scripts/test_files/gnark_groth16_bn254_infinite_script/infinite_proofs/ineq_${x}_groth16.proof \
23-
--public_input scripts/test_files/gnark_groth16_bn254_infinite_script/infinite_proofs/ineq_${x}_groth16.pub \
24-
--vk scripts/test_files/gnark_groth16_bn254_infinite_script/infinite_proofs/ineq_${x}_groth16.vk \
25-
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657
27+
# Set default values for RPC and BATCHER if they are not set
28+
RPC=${RPC:-http://localhost:8545}
29+
BATCHER=${BATCHER:-ws://localhost:8080}
30+
31+
cmd=(
32+
./batcher/target/release/aligned
33+
submit
34+
--proving_system Groth16Bn254
35+
--repetitions "$repetitions"
36+
--proof "scripts/test_files/gnark_groth16_bn254_infinite_script/infinite_proofs/ineq_${x}_groth16.proof"
37+
--public_input "scripts/test_files/gnark_groth16_bn254_infinite_script/infinite_proofs/ineq_${x}_groth16.pub"
38+
--vk "scripts/test_files/gnark_groth16_bn254_infinite_script/infinite_proofs/ineq_${x}_groth16.vk"
39+
--proof_generator_addr 0x66f9664f97F2b50F62D13eA064982f936dE76657
40+
--rpc "$RPC"
41+
--conn "$BATCHER"
42+
)
43+
44+
# If PRIVATE_KEY is set then add private key argument
45+
if [ -n "$PRIVATE_KEY" ]; then
46+
cmd+=(--private_key "$PRIVATE_KEY")
47+
fi
48+
49+
# Execute the command
50+
"${cmd[@]}"

0 commit comments

Comments
 (0)