Message: CreateBTCStaking
This message can be invoked by any user.
The following parameter can be controlled by the calling user:
StakingTx
— This is a raw Bitcoin transaction provided by the user.
This message takes in a raw Bitcoin transaction and validates it to mint stBTC to the user.
The raw transaction provided by the user is hashed and queried against the Bitcoin light client. It is checked if a staking record already exists with this hash. In this case, the transaction is aborted to avoid double minting. It then verifies that the transaction is valid by performing a Merkle proof.
The address of the receiver is extracted from the transaction, and it is validated that it is equal to the receiving Bitcoin address set in the params. Then it extracts the BTC amount and mint address from the transaction and mints the same amount of stBTC to the mint address.
A staking record with the transaction hash gets added to the module state to prevent double minting.