Skip to content

Commit

Permalink
fix: Generate keys and config on the fly
Browse files Browse the repository at this point in the history
  • Loading branch information
aidan46 committed Jan 14, 2025
1 parent eb7110f commit 57bf645
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions examples/rpc_publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,21 @@ PROVIDER="//Charlie"
INPUT_FILE="$1"
INPUT_FILE_NAME="$(basename "$INPUT_FILE")"
INPUT_TMP_FILE="/tmp/$INPUT_FILE_NAME.car"
P2P_PUBLIC_KEY="examples/p2p-keys/public.pem"
P2P_PUBLIC_KEY="/tmp/public.pem"
P2P_PRIVATE_KEY="/tmp/private.pem"
P2P_ADDRESS="/ip4/127.0.0.1/tcp/62649"

# Generate ED25519 private key
openssl genpkey -algorithm ED25519 -out "$P2P_PRIVATE_KEY" -outpubkey "$P2P_PUBLIC_KEY"
target/release/mater-cli convert -q --overwrite "$INPUT_FILE" "$INPUT_TMP_FILE" &&
INPUT_COMMP="$(target/release/polka-storage-provider-client proofs commp "$INPUT_TMP_FILE")"
PIECE_CID="$(echo "$INPUT_COMMP" | jq -r ".cid")"
PIECE_SIZE="$(echo "$INPUT_COMMP" | jq ".size")"
PEER_ID="$(target/release/polka-storage-provider-client generate-peer-id --pubkey "$P2P_PUBLIC_KEY")"
P2P_CONFIG="examples/p2p-config/bootstrap.toml"
P2P_CONFIG="/tmp/bootstrap.toml"
echo "address = \"$P2P_ADDRESS\"
keypair = \"@$P2P_PRIVATE_KEY\"
" > "$P2P_CONFIG"


# Setup balances
Expand Down

0 comments on commit 57bf645

Please sign in to comment.