Included here are scripts to generate and verify a Proof-of-Winning (PWN) JSON payloads.
PWN requires you come with:
- 🙋 A SS58 compliant Address that you have the private key for.
The scripts depend on installations of:
sha512sum
(Install on: MacOS - Linux & WSL - fromcoreutils
package)jq
(Install on: MacOS - Linux & WSL)subkey
(Install anywhere with cargo, version 3 or above)
These scripts gotta run 😉:
# Allow execution
chmod +x generate-proof-of-win-signature.sh generate-proof-of-win-private-key.sh verify-proof-of-win.sh
😱 You would just put secrets into some random executable you found online?!
🫠 ... and put your secrets into it?!
- ./generate-proof-of-win-private-key.sh
- This uses
subkey
with a private key provided.
- This uses
- ./generate-proof-of-win-signature.sh
- This uses a Polkadot.js API signed message.
Fire up the option you want to use, and follow the prompts - do so carefully and completely!
# Option with private key or mnemonic
./generate-proof-of-win-private-key.sh
# Option with Polkadot.js wallet
./generate-proof-of-win-signature.sh
Both scripts produce a payload file of PWN-<your SS58 address here>.json
.
So as an example, PWN-14XeJg226wvHG6PWmhKUsrv5PmeccjbXwFe9pVrBbryEWeZc.json
will look something like:
{
"message": "<Bytes>I LIKE WINNING! BOOOOO YAAAAAA!</Bytes>",
"ss58Address": "14XeJg226wvHG6PWmhKUsrv5PmeccjbXwFe9pVrBbryEWeZc",
"secretHash": "0x58cf16bcdceec9bce18246eeaa2f3358a2cdfdb7dc98a3d5f61da18f841b057369c58e64a456e236e853d853ef088a0eb57551a2a2b124c3060d5f402a2bf0a3",
"signature": "0x78bea5e6ae9973c9842e33c1f37109fd5a8dc4f954cd22a133756a7590fffd0363f956afd24a16a6bcb00a3ce7bfdcc8045dad80b421bd01a8948ff9d2853e8a"
}
- ./verify-proof-of-win.sh
- This verifies a PWN json file correctly passes tests.
- You can test this by checking the example above 😉.
# Option with private key or mnemonic
./verify-proof-of-win.sh <path/to/PWN-$ADDRESS.json>
🎉 You know it's good if you get Signature verifies correctly.
😉 Otherwise you need to try again.
The Academy team will provide a place to copy& paste or upload the JSON file to assign your winnings!