Sign Message and Verify
Sign and verify challenges for off-chain authentication
Note that Blocto SDK for EVM-compatible chains is still in Beta. APIs are subject to breaking changes.
Install from npm/yarn
Use web3.js
Verify Signature (personal.sign)
For dApps relying on signMessage
for off-chain authentication, Blocto follows ERC-1271 and ERC-191. To verify the signature, you need to call an isValidSignature
method on the wallet contract to check if the signature came from the rightful owner of the wallet contract.
We have built the tools to carry out this verification:
Use it in your dApps (usually on backend):
Don't forget to update the RPC URL to current network.
Sample Code
PersonalSign Technical Details
According to ERC-191 and ERC-1271, when receiving personalSign
request with message
, Blocto will sign:
0x19
+0x0
+[User’s wallet address]
+ hash(0x19
+0x45 (E)
+thereum Signed Message:
+len(message)
+message
)
Verify Signature (typed data sign)
According to ERC-191 and ERC-1271, when receiving typeDataSign
request, Blocto will sign:
0x19
+0x0
+[User’s wallet address]
+[typed-data-hash]
Last updated