Skip to content

Instantly share code, notes, and snippets.

@chiro-hiro
Last active December 25, 2022 12:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chiro-hiro/6b15ecfe48d95c99404d0938f0771680 to your computer and use it in GitHub Desktop.
Save chiro-hiro/6b15ecfe48d95c99404d0938f0771680 to your computer and use it in GitHub Desktop.
Validate ethereum proof
import { ethers } from 'ethers';
(async () => {
let proofs = [
'0x4f54e1c15ca1d7aec6d16fcc8b524ef298a470b5dd61fd4aeccdd2abd4755e437340fe513a8267397ae468cc8643e1ea0d86f78d029ab35871c0d61d81ba32c51c',
'0x6fca48d5a3522f42984dda6ff662c63de7df537c40da53e74fcc77d00a73441c30c222612af565c74faed88830c4a4083fd9a98c46e5aeaae392dfe61c5a14941c',
'0xd3ba49eabe5cc487d012360e2d38c0238666f9ec596be5f3b7e542e67c448a187b09a9a5acda889366eb5789073b0a73961375f336d28beb4d78479405765e361b',
];
for (let i = 0; i < proofs.length; i += 1) {
console.log(
await ethers.utils.recoverAddress(
ethers.utils.arrayify(
ethers.utils.hashMessage('0x000000000000000000000000635e045200000000000000000000000000000001443eee1d4e7883ab279332661e5172401e26e6ab0000000000000000000000000000000000000000000000000de0b6b3a7640000')
),
proofs[i],
),
);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment