Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

v0 source pure

Package hyperlane is Hyperlane's wire format, byte for byte, for a mailbox on gno.land: the message and its id, the i...

Overview

Package hyperlane is Hyperlane's wire format, byte for byte, for a mailbox on gno.land: the message and its id, the incremental merkle tree the validators checkpoint, the checkpoint digest they sign, a warp route's token message, and the multisig check a destination runs over the signatures. It keeps no state and reads no chain.

Sources (hyperlane-monorepo 3cd9308, 2026-10-10): solidity/contracts/libs/Message.sol, Merkle.sol, CheckpointLib.sol, TypeCasts.sol, token/libs/TokenMessage.sol, isms/libs/MessageIdMultisigIsmMetadata.sol; the vectors in vectors/ are this package's tests.

One departure, and only on the gno side: gno.land has no secp256k1, so the multisig a gno mailbox runs (VerifyMultisig) takes ed25519 signatures over the same checkpoint digest Hyperlane's validators sign with secp256k1, and each signature names its validator in one leading byte (65 bytes a signature, as in Hyperlane's metadata). Messages, ids, the tree and the digest are Hyperlane's exactly, so the other chain's ISM checks a gno checkpoint with its stock code.

Constants 1

const Version, HeaderLen, TreeDepth, MaxLeaves, sigLen, metaLen

 1const (
 2	// Version is the message version every Hyperlane mailbox speaks (Versioned.VERSION).
 3	Version = 3
 4	// HeaderLen is the message header: version 1, nonce 4, origin 4, sender 32, destination 4, recipient 32.
 5	HeaderLen = 77
 6	// TreeDepth is the merkle tree's depth (Merkle.sol TREE_DEPTH).
 7	TreeDepth = 32
 8	// MaxLeaves is how many leaves the tree takes (Merkle.sol MAX_LEAVES, 2^32 - 1).
 9	MaxLeaves = 1<<TreeDepth - 1
10
11	sigLen  = 65 // a signature's slot in multisig metadata: Hyperlane's r‖s‖v, here validator byte ‖ ed25519
12	metaLen = 68 // the metadata's fixed head: merkle tree hook 32, root 32, index 4
13)
source

Functions 13

func AddressToBytes32

1func AddressToBytes32(a address) ([32]byte, error)
source

AddressToBytes32 is a gno address as Hyperlane carries one: twelve zero bytes, then the address's twenty (TypeCasts.addressToBytes32).

func Base58

1func Base58(b []byte) string
source

Base58 writes bytes the way Solana writes a key.

func CheckpointDigest

1func CheckpointDigest(origin uint32, hook, root [32]byte, index uint32, messageID [32]byte) [32]byte
source

CheckpointDigest is what a validator signs for one message: the EIP-191 personal-message hash of keccak256(domainHash ‖ root ‖ index ‖ messageID) (CheckpointLib.digest). root and index are the origin tree's right after messageID went in at index; a message-id ISM does not check them, only the signatures over them.

func DomainHash

1func DomainHash(origin uint32, hook [32]byte) [32]byte
source

DomainHash binds a checkpoint to its origin chain and that chain's merkle tree hook: keccak256(origin ‖ hook ‖ "HYPERLANE"), 45 bytes hashed (CheckpointLib.domainHash). On Solana the hook is the mailbox program's id.

func EthSignedMessageHash

1func EthSignedMessageHash(h [32]byte) [32]byte
source

EthSignedMessageHash is EIP-191's hash of a 32-byte message: keccak256("\x19Ethereum Signed Message:\n32" ‖ h).

func ID

1func ID(raw []byte) [32]byte
source

ID is the id of a message as it came off the wire.

func MultisigMetadata

1func MultisigMetadata(c Checkpoint, sigs []Signature) []byte
source

MultisigMetadata lays out what a relayer hands a gno mailbox: hook 32 ‖ root 32 ‖ index 4, then 65 bytes a signature: the validator's index in the set, then its ed25519 signature over CheckpointDigest. Validator indexes strictly increase, so no validator counts twice.

func ParseKey32

1func ParseKey32(s string) ([32]byte, error)
source

ParseKey32 reads a 32-byte key the way a person types one: 64 hex digits (with or without 0x), or a Solana address in base58.

func ParseMultisigMetadata

1func ParseMultisigMetadata(b []byte) (Checkpoint, []Signature, error)
source

ParseMultisigMetadata reads metadata laid out by MultisigMetadata.

func ParseTokenMessage

1func ParseTokenMessage(b []byte) (recipient [32]byte, amount uint64, metadata []byte, err error)
source

ParseTokenMessage reads a warp route's body. An amount past 2^64 - 1 is refused; trailing metadata (Solana's TransferRemoteWithMemo writes a memo there) is returned, not refused.

func TokenMessage

1func TokenMessage(recipient [32]byte, amount uint64, metadata []byte) []byte
source

TokenMessage is a warp route's body (TokenMessage.sol): the recipient on the destination, the amount as a big-endian uint256, then metadata (usually none).

func VerifyMultisig

1func VerifyMultisig(validators [][]byte, threshold int, metadata, message []byte) error
source

VerifyMultisig is a message-id multisig ISM over ed25519: the first threshold signatures in metadata must be valid signatures, by distinct validators in increasing order, over the checkpoint digest of this message from its own origin. validators are ed25519 public keys of 32 bytes. Signatures past the threshold are not read.

func ParseMessage

1func ParseMessage(b []byte) (Message, error)
source

ParseMessage reads a message off the wire. The body is a copy.

Types 4

type Checkpoint

struct
1type Checkpoint struct {
2	Hook  [32]byte
3	Root  [32]byte
4	Index uint32
5}
source

Checkpoint is the head of multisig metadata: the origin's merkle tree hook, and the root and index the validators signed (MessageIdMultisigIsmMetadata).

type Message

struct
1type Message struct {
2	Version     uint8
3	Nonce       uint32
4	Origin      uint32
5	Sender      [32]byte
6	Destination uint32
7	Recipient   [32]byte
8	Body        []byte
9}
source

Message is a Hyperlane message (Message.sol). Sender and recipient are 32 bytes: a 20-byte address is padded on the left with twelve zero bytes (AddressToBytes32); a Solana pubkey is its 32 bytes as they are.

Methods on Message

func Bytes

method on Message
1func (m Message) Bytes() []byte
source

Bytes is the message on the wire: abi.encodePacked of the fields, big-endian, no length prefixes.

func ID

method on Message
1func (m Message) ID() [32]byte
source

ID is the message's id: keccak256 of the whole message, body included.

type Signature

struct
1type Signature struct {
2	Validator uint8
3	Sig       [64]byte
4}
source

Signature is one validator's ed25519 signature and its place in the validator set.

type Tree

struct
1type Tree struct {
2	Branch [TreeDepth][32]byte
3	Count  uint32
4}
source

Tree is Hyperlane's incremental merkle tree (Merkle.sol, the eth2 deposit contract's): depth 32, nodes keccak256(left ‖ right), leaves the message ids themselves. The zero value is the empty tree.

Methods on Tree

func Insert

method on Tree
1func (t *Tree) Insert(leaf [32]byte)
source

Insert adds a leaf at index Count.

func Root

method on Tree
1func (t *Tree) Root() [32]byte
source

Root is the tree's root now (Merkle.sol root(), with the zero hashes).

Dependencies

Source Files 3