Flow: Observing incoming cross-chain transactions from the Bitcoin chain
Observation and processing of incoming cross-chain transactions starts in the observeInTx()
function. This function runs every five seconds (configurable).
The logic in this function is very similar to the EVM client. One issue here is that the BTC client does not wait for a certain amount of blocks (i.e., block confirmations) like the EVM client does. This leads to a double-spending issue where a malicious attacker (or even users accidentally) are able to send BTC across chains without actually spending any BTC (see ).
The code then loops through all transactions in all recent unobserved blocks, filters for the ones that are destined for the BTC TSS address, takes the value of the transaction and multiplies it by 1e8, and then creates and broadcasts a MsgVoteOnObservedInboundTx
message to the x/crosschain
module with that amount. The coin type is set to CoinType_Gas
in this instance.