PersonalMessage
Utilities & types for working with EIP-191 Personal Messages
Examples
Computing Sign Payload
An EIP-191 personal sign payload can be computed using PersonalMessage.getSignPayload
:
import { Hex, PersonalMessage, Secp256k1 } from 'ox'
const payload = PersonalMessage.getSignPayload(Hex.fromString('hello world'))
const signature = Secp256k1.sign({ payload, privateKey: '0x...' })
Functions
Name | Description |
---|---|
PersonalMessage.encode | Encodes a personal sign message in ERC-191 format: 0x19 ‖ "Ethereum Signed Message:\n" + message.length ‖ message . |
PersonalMessage.getSignPayload | Gets the payload to use for signing an ERC-191 formatted personal message. |