πŸ“¦ Packet Flow: Send & Receive Messages

Discover how data flows between IBC-enabled chains

Enable inter-blockchain communication protocols

Packet Flow

**IBC packets** are the fundamental unit of cross-chain communication. When an application wants to send data to another chain, it calls `SendPacket` which creates a commitment proof. Relayers then carry these packets between chains, submitting cryptographic proofs that the packet was committed on the source chain.

Packets can timeout if not delivered within specified height/timestamp, enabling rollback of state changes. This guarantees **exactly-once delivery** or timeoutβ€”packets are never lost or duplicated.

Interactive: Packet Flow Simulator

Watch a token transfer packet flow from source to destination chain.

πŸ“€

SendPacket

Source Chain

Application calls SendPacket, packet commitment stored in state

Packet includes: sequence, ports, channels, data, timeout
πŸ”„

RelayPacket

Relayer

Relayer monitors source chain, fetches merkle proof of commitment

Proof includes: packet data, height, merkle path to state root
πŸ“₯

RecvPacket

Dest Chain

Destination chain verifies proof, calls application onRecvPacket

Light client verifies merkle proof against trusted state root
βœ“

Acknowledgement

Source Chain

Destination writes ack, relayer submits to source, calls onAcknowledgePacket

Ack can be success or error, used for cleanup/state updates

Performance Analysis

Adjust transfer amount to see how it affects gas costs and relay time.

10 ATOM1000 ATOM
Relay Time
7s
Block confirmations
Source Gas
105,000
SendPacket tx
Dest Gas
157,500
RecvPacket tx

⏱️ Packet Timeouts

Every packet has a timeout height or timestamp. If not delivered before timeout, the packet can be proven as timed out and state rolled back on the source chain.

Height-Based Timeout
timeoutHeight: { revisionNumber: 1, revisionHeight: 1000000 }
Timestamp-Based Timeout
timeoutTimestamp: 1699999999000000000 (nanoseconds)
Timeout Handling
Application's onTimeoutPacket callback reverses state changes (unlock tokens, refund)

Relayer Economics

πŸ’° ICS-29 Fee Middleware

Optional fees incentivize relayers to submit packets. Users pay recvFee, ackFee, and timeoutFee.

recvFee: 1000uatom, ackFee: 500uatom

⚑ Permissionless Relay

Anyone can run a relayerβ€”no special permissions needed. Competitive relayer market ensures fast delivery.

Popular relayers: Hermes, Go Relayer, ts-relayer

Packet Ordering

Channels can be **ORDERED** (packets must be received in order) or **UNORDERED** (any order accepted).

PropertyORDEREDUNORDERED
DeliverySequential (1, 2, 3...)Any order
Use CaseStateful protocolsToken transfers (ICS-20)
Timeout HandlingChannel closes on timeoutSkip and continue
PerformanceSlower (blocking)Faster (parallel)