Skip to content

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

NameDescription
PersonalMessage.encodeEncodes a personal sign message in ERC-191 format: 0x19 ‖ "Ethereum Signed Message:\n" + message.length ‖ message.
PersonalMessage.getSignPayloadGets the payload to use for signing an ERC-191 formatted personal message.