The layerzero.messages table contains all cross-chain messages sent through the LayerZero protocol. Each message represents a cross-chain communication event between source and destination chains.

Table Schema

Column NameData TypeDescription
timestampUpdatedtimestampTimestamp of the last update
primary_keystringUnique identifier for the message
transfer_foreign_keystringForeign key reference to the transfer
tx_hash_sourcestringTransaction hash on the source chain
tx_hash_destinationstringTransaction hash on the destination chain
ts_sourcetimestampTimestamp of the message on source chain
ts_destinationtimestampTimestamp of the message on destination chain
block_number_sourcedecimal(38,0)Block number on the source chain
block_number_destinationdecimal(38,0)Block number on the destination chain
addr_fromstringAddress of the message sender
usd_dvn_feedoubleUSD value of the DVN fee
usd_executor_feedoubleUSD value of the executor fee
usd_valuedoubleTotal USD value of the message
source_contractstringContract address on the source chain
source_chainstringSource chain identifier
source_chain_keystringSource chain key
source_layerstringSource chain layer
destination_contractstringContract address on the destination chain
destination_chainstringDestination chain identifier
destination_chain_keystringDestination chain key
destination_layerstringDestination chain layer
projectstringProject identifier
statestringCurrent state of the message
layerzero_versionstringVersion of LayerZero protocol used
uln_versionstringVersion of ULN used
_updated_attimestampLast update timestamp
_ingested_attimestampIngestion timestamp

Sample Query

-- Get the total number of messages and total value transferred per chain pair
SELECT 
    source_chain,
    destination_chain,
    COUNT(*) as message_count,
    SUM(usd_value) as total_value_usd
FROM layerzero.messages
WHERE ts_source >= NOW() - INTERVAL '7' DAY
GROUP BY source_chain, destination_chain
ORDER BY total_value_usd DESC
LIMIT 10;