How to Trade KRC-20
Last updated
Last updated
With the support for Partially Signed Kaspa Transactions (PSKT), it becomes possible to swap KRC-20 tokens for Kaspa's native cryptocurrency, $KAS. You can get more information by reading this:
P2SH-LIST for placing orders and P2SH-SEND for buying orders are generated based on the public key of the token holding address.
The operation for placing an order (OP) is 'list':
The 'Reveal' output corresponds to the buying operation OP, which is P2SH-SEND:
After successfully executing the placing order OP, the corresponding amount of tokens will be bound to the UTXO of the buying OP
The indexer will track the spending of the buying UTXO to automatically trigger buying or cancellation operations.
When spending P2SH-SEND but there is no output 2, it is defined as a cancellation operation, and the tokens will be returned to the original address
Requirements for the P2SH-SEND script:
No P1 parameter
JSON in fixed order
No spaces
The 'tick' name should be in lowercase, all other characters in lowercase.
The seller sets the selling price and the address to receive KAS in the market system.
The market system automatically constructs and stores PSKT transaction data where Input 1 is the UTXO from the buy order, and the amount of KAS for Output 1 is the selling price.
Input 1 uses the signature mode SIG_HASH_SINGLE | SIG_HASH_ANY_ONE_CAN_PAY for signing.
The buyer selects an order in the market system to proceed with payment.
The market system constructs a complete transaction based on the PSKT data of the order (adding the necessary additional inputs and outputs), and requests the buyer to sign it.
Input 2 and any other inputs are signed using the standard SIG_HASH_ALL mode.
Output 2 is the address where the buyer will receive the tokens.