Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time
MIP: 9
Title: Token exchange
Author: Jason Chavannes <>
Status: Final (v2)
Created: 2019-06-05
V2: 2019-06-21


List tokens for sale. Make purchase offers. Accept purchase offers and transfer using an atomic transaction.


Decentralized way to exchange tokens.


Prefix Action Values
List sale
<prefix: 0x6d30> (2 bytes)
Make offer
<prefix: 0x6d31> (2 bytes)
<list_sale_hash> (30 bytes)
Attach signature
<prefix: 0x6d32> (2 bytes)
<sale/offer_hash> (30 bytes)
<signature_1> (72 bytes)
<pk_data_1> (34 bytes)
<signature_n> (72 bytes)
<pk_data_n> (34 bytes)

Input / output types

Type In/Out Type Values
1 Input
<type: 1> (1 byte)
<tx_hash> (30 bytes)
<index> (2 bytes)
2 Token Output - Self
<type: 2> (1 byte)
<quantity> (8 bytes, integer)
3 Bitcoin Output - Self
<type: 3> (1 byte)
<quantity> (8 bytes, integer)
4 Token Output - P2PKH
<type: 4> (1 byte)
<address> (35 bytes)
<quantity> (8 bytes, integer)
5 Bitcoin Output - P2PKH
<type: 5> (1 byte)
<address> (35 bytes)
<quantity> (8 bytes, integer)
6 Token Output - P2SH
<type: 6> (1 byte)
<address> (35 bytes)
<quantity> (8 bytes, integer)
7 Bitcoin Output - P2SH
<type: 7> (1 byte)
<address> (35 bytes)
<quantity> (8 bytes, integer)

Generated 2-part transaction

Using the list sale and make offer a deterministic transaction can be generated.

Inputs 1. List sale inputs
2. Make offer inputs
Outputs 1. OP_RETURN
2. List sale outputs
3. Make offer outputs

Instant transaction

When making a typical offer there is 1 input and 1 output. The input is the tokens for sale and the output is the purchase price.

Input Output
UTXO of tokens for sale X satoshis to seller

Using a SIGHASH_SINGLE | SIGHASH_ANYONECANPAY signature, just this input/output pair can be signed. The purchaser can then create their own sale tx of their choosing, as long as it includes this pair.

The removes the middle step from the 2-part transaction. The purchaser can sign and purchase token instantly.

The final transaction would look like this:

Index Input Output
0 UTXO of buyer payment OP_RETURN for SLP SEND
1 UTXO of tokens for sale Payment to seller
2 - Tokens to buyer

The buyer signs input 0 using normal SIGHASH_ALL . The seller SIGHASH_SINGLE | SIGHASH_ANYONECANPAY signature is used for input 1.

When generating the transaction and input/output pair use:

  • P2PKH output
  • TX version 1
  • Input sequence 0xffffffff
  • Seller pair must have same input/output index. Use index 1 since SLP requires OP_RETURN as output index 0.

Alternative offer to purchase mechanism

Instead of a seller posting the 0x6d30 list sale tx, a potentially buyer could post referring to specific UTXO with an offer price.

For a seller to accept the offer they can just post the 0x6d32 signature.

Payments will be made to the address used as the first input in the signature transaction. For regular purchases this same payment address should be used from the signature transaction.

Accepting an offer

Accept the offer by signing and broadcasting the transaction

Declining an offer

Decline an offer or remove a listing by:

  • Never accepting the offer
  • Accepting another offer
  • Moving the token(s)
  • Replacing with a newer listing

Reference Implementation

See Also