Skip to content

Instantly share code, notes, and snippets.

@hoffmang9
Last active February 4, 2023 19:29
Show Gist options
  • Save hoffmang9/3e5dae25a07e22dc95fa6abe3d4af847 to your computer and use it in GitHub Desktop.
Save hoffmang9/3e5dae25a07e22dc95fa6abe3d4af847 to your computer and use it in GitHub Desktop.
How to sign and verify arbitrary data with Chia keys

You will need some data about your HD key. Don't share the results, but reference this command for the following steps.

chia keys show

Grab the Fingerprint value for your key set. You will also need the keypath to your Pool Public key, e.g. (m/12381/8444/1/0). You will drop the parentheses and the leading m/ as shown below.

chia keys sign -f [fingerprint] -t [hd_path] -d [message] (sign a message with a private key)
# Working Example
chia keys sign -f 3100174794 -t 12381/8444/1/0 -d "This is a test"

This will create a signuture string of 9098a6bc1efe1c02ee3f397f74e74295049eca49dc5437626fb096347e7741adc148e9be8fcd5c5836b8c700a04af3c5193cbeedd6c3d54a564786fb455bbfdd636df199794a19c85b2b886fb98c1caae495b102a93284bb782284af461cb41f.

You can use that to then verify the plain text.

chia keys verify -p [public_key] -d [message] -s [signature] (verify a signature with a pk)
# Working example
chia keys verify -p a550e1d5db57eb4eea4da60bdfbc2056bb3a243666b7da93ad00659b8a63de2db7e118cb077fadf4c35106746035959a -d "This is a test" -s 9098a6bc1efe1c02ee3f397f74e74295049eca49dc5437626fb096347e7741adc148e9be8fcd5c5836b8c700a04af3c5193cbeedd6c3d54a564786fb455bbfdd636df199794a19c85b2b886fb98c1caae495b102a93284bb782284af461cb41f

This will result in either True or False.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment