Created
November 24, 2020 20:40
-
-
Save mcdee/044b8a4e69a7189ff8f46d011e6fd130 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The withdrawal account. | |
export ETHDO_ALLOW_WEAK_PASSHRASES=true | |
export ETHDO_WALLET_PASSPHRASE=secret | |
ethdo wallet create --type=hd --mnemonic='abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon art' --wallet='Withdrawal wallet' | |
ethdo account create --account='Withdrawal wallet/A withdrawal account' | |
export WITHDRAWAL_ACCOUNT_PUBLIC_KEY=$(ethdo account info --account='Withdrawal wallet/A withdrawal account' | grep 'Public key' | sed 's/Public key: //') | |
# To prove that the withdrawal accout holder holds the private key for a public key: | |
# 1. The requestor sends a random 32-byte hex string to the withdrawal account holder. | |
export REQUESTOR_DATA=$(xxd -l 32 -p /dev/urandom | tr -d " \n") | |
# 2. The two parties agreee upon a shared 32-byte domain. | |
export DOMAIN=0102030405060708010203040506070801020304050607080102030405060708 | |
# 3. The withdrawal account holder signs the data and sends the signature to the requestor. | |
export SIGNATURE=$(ethdo signature sign --account='Withdrawal wallet/A withdrawal account' --domain=${DOMAIN} --data=${REQUESTOR_DATA}) | |
# 4. The requestor verifies the signature against the public key. | |
ethdo signature verify --data=${REQUESTOR_DATA} --domain=${DOMAIN} --signature=${SIGNATURE} --signer=${WITHDRAWAL_ACCOUNT_PUBLIC_KEY} --verbose |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment