Sent to first input
This example sends an amount of STX to the sender of a bitcoin transaction using p2pkh addresses. It exists in two version, one using the header object (send-to-first-input.clar
), the other the header buffer (send-to-first-input-compact
).
Deploy all contracts
Call btc deployment plan to send 0.1 BTC
Confirm to continue
Copy the tx hex from the Transaction
Press N to mine the block in the clarinet dashboard
Generate deployment plan for the stacks transaction by running the following command with the copied tx hex (replace
01..txhex
). (The generation script takes care of reversing the properties of the block header.)
Call deployment plan to send STX to the bitcoin sender. The conversion from btc to stx in this example happens as a fixed rate of 1000 sats/stx. (It is possible to use stx-oracle that calcualtes a conversion rate based on the miner commits of the 10 last blocks.)
Check the stacks explorer at http://localhost:8001 about the result for the transactions of the two versions
Last updated