Understanding how messages from Bitcoin (and potentially Solana) are parsed in our ZetaChain integration
Our system integrates with ZetaChain to enable cross-chain functionality, particularly for messages originating from Bitcoin/Evms (with plans to include Solana in the future). This document explains the pattern used to parse these cross-chain messages.
The cross-chain messages follow a specific structure:
This structure allows for efficient parsing and extraction of key parameters.
The message begins with three numbers separated by commas, indicating the end positions of key components:
toTokenEnd
: End position of the destination token addressreceiverEnd
: End position of the receiver addresspathEnd
: End position of the swap pathAfter parsing the end positions, the message is split into its components:
toToken
: Destination token addressreceiver
: Receiver addresswithdraw
: Boolean flag for withdrawalpath
: Swap pathminAmountOut
: Minimum amount to receivetoToken
: Parsed as an Ethereum addressreceiver
: Kept as raw byteswithdraw
: Parsed as a booleanpath
: Kept as raw bytesminAmountOut
: Decoded as a uint256End Position Parsing
Component Extraction
Structure Population
CrossChainParams
structure with the parsed dataUnderstanding how messages from Bitcoin (and potentially Solana) are parsed in our ZetaChain integration
Our system integrates with ZetaChain to enable cross-chain functionality, particularly for messages originating from Bitcoin/Evms (with plans to include Solana in the future). This document explains the pattern used to parse these cross-chain messages.
The cross-chain messages follow a specific structure:
This structure allows for efficient parsing and extraction of key parameters.
The message begins with three numbers separated by commas, indicating the end positions of key components:
toTokenEnd
: End position of the destination token addressreceiverEnd
: End position of the receiver addresspathEnd
: End position of the swap pathAfter parsing the end positions, the message is split into its components:
toToken
: Destination token addressreceiver
: Receiver addresswithdraw
: Boolean flag for withdrawalpath
: Swap pathminAmountOut
: Minimum amount to receivetoToken
: Parsed as an Ethereum addressreceiver
: Kept as raw byteswithdraw
: Parsed as a booleanpath
: Kept as raw bytesminAmountOut
: Decoded as a uint256End Position Parsing
Component Extraction
Structure Population
CrossChainParams
structure with the parsed data