Skip to content

Instantly share code, notes, and snippets.

@rootulp
Last active March 7, 2024 20:39
Show Gist options
  • Save rootulp/0b627fea5340bb57b5ffbb4c22d196d3 to your computer and use it in GitHub Desktop.
Save rootulp/0b627fea5340bb57b5ffbb4c22d196d3 to your computer and use it in GitHub Desktop.
tx sign doesn't throw an error when incorrect Ledger is used
#!/bin/sh
# Stop script execution if an error is encountered
set -o errexit
# Stop script execution if an undefined variable is used
set -o nounset
# Prerequisite: prior to running this script, start a single node devnet with ./scripts/single-node.sh
CHAIN_ID="private"
KEY_NAME="validator"
KEYRING_BACKEND="test"
BROADCAST_MODE="block"
celestia-appd keys add test1
celestia-appd keys add test2
celestia-appd keys add test3 --ledger --account 1 # Add this from real Ledger
celestia-appd keys add test4 --ledger --account 2 # Add this from test Ledger
celestia-appd keys add multisig --multisig test1,test2,test3 --multisig-threshold 2
TEST1=$(celestia-appd keys show test1 -a)
TEST2=$(celestia-appd keys show test2 -a)
TEST3=$(celestia-appd keys show test3 -a)
TEST4=$(celestia-appd keys show test4 -a)
MULTISIG=$(celestia-appd keys show multisig -a)
VALIDATOR=$(celestia-appd keys show validator -a)
celestia-appd tx bank send $VALIDATOR $MULTISIG 100000utia --from $VALIDATOR --fees 1000utia --chain-id $CHAIN_ID --keyring-backend $KEYRING_BACKEND --broadcast-mode $BROADCAST_MODE --yes
# Uncomment the next line to verify that the multisig account received some funds
celestia-appd query bank balances $MULTISIG
celestia-appd tx bank send $MULTISIG $VALIDATOR 1utia --from $MULTISIG --fees 1000utia --chain-id $CHAIN_ID --keyring-backend $KEYRING_BACKEND --generate-only > unsignedTx.json
celestia-appd tx sign unsignedTx.json --multisig $MULTISIG --from test1 --output-document test1sig.json --chain-id $CHAIN_ID
celestia-appd tx sign unsignedTx.json --multisig $MULTISIG --from test2 --output-document test2sig.json --chain-id $CHAIN_ID
# Plug in test Ledger
echo " "
echo "The following command should error because test3 isn't on test Ledger but it doesn't throw an error"
celestia-appd tx sign unsignedTx.json --multisig $MULTISIG --from test3 --output-document test3sig.json --chain-id $CHAIN_ID --ledger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment