From 72cc640bb17b62105d9c70cb9296046bd5d02cf5 Mon Sep 17 00:00:00 2001 From: Ramana Kumar Date: Thu, 7 Mar 2024 21:15:01 +0000 Subject: [PATCH] Update README.md with Ethereum example Shows how to use the DST to sign/verify messages with the configuration suitable for Ethereum beacon chain. --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 7ce37a1..57a7d2f 100644 --- a/README.md +++ b/README.md @@ -613,6 +613,12 @@ const signature = bls.sign(message, privateKey); const isValid = bls.verify(signature, message, publicKey); console.log({ publicKey, signature, isValid }); +// Use custom DST, e.g. for Ethereum consensus layer +const htfEthereum = {DST: 'BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_POP_'}; +const signatureEth = bls.sign(message, privateKey, htfEthereum); +const isValidEth = bls.verify(signature, message, publicKey, htfEthereum); +console.log({ signatureEth, isValidEth }); + // Sign 1 msg with 3 keys const privateKeys = [ '18f020b98eb798752a50ed0563b079c125b0db5dd0b1060d1c1b47d4a193e1e4',