Swapping
Swapping requires 2 roles: The maker who initiates the swap and the taker who fills the open swap.
There are a few types of swap we can do.
- STAS for STAS where we swap one STAS token for another.
- P2PKH for STAS which is swapping BSV for STAS
- STAS for P2PKH swaps STAS for BSV
The maker creates a partial transaction
Index | Input | Output |
---|---|---|
0 | Maker offered UTXO | Maker wanted output |
The offered UTXO is one the maker owns and the wanted output is a script that pays the maker.
The taker then completes the transaction adding the payment and change.
Index | Input | Output |
---|---|---|
0 | Maker offered UTXO | Maker wanted output |
1 | Taker UTXO | Taker output |
2 | Funding UTXO | Change output |
The swap can be done in 2 or 3 steps depending on the need to validate the taker UTXO. If the taker UTXO is a token then this token should be validated by the maker before he signs the transaction.
- 1.The maker creates a partial transaction and signs it using sighash single | anyone can pay. The partial transaction is then offered for completion.
- 2.The taker then adds his inputs and outputs and signs the transaction then submits it to the blockchain.
- 1.The maker creates a partial transaction and offers it for completion.
- 2.The taker then adds his inputs and outputs and signs the transaction then returns it to the maker.
- 3.The maker then signs the transaction and submits it to the blockchain.
Last modified 1yr ago