How to Create a Counterparty Memo Transaction

There is a tutorial on create_send so this post will only highlight memo-related differences.

create_send can contain a memo (reference, note to recipient) to reference a transaction to off-blockchain data such as the sender’s account at a crypto-exchange or member’s account in an online game.

Required non-default inputs to create_send are:

  • use_enhanced_send: true or false (default: false)
  • memo_is_hex: true or false
  • memo: unique content provided by the recipient (note the emphasis)

Knowing this, the operator needs to provide this information to the user and the user has to use the provided memo string in “Memo” field when funding his account.

Let’s say Alice is a gamer known as FragKingLord at her favorite online game provider C-Gaming. She logs in and requests a funding address. The provider generates a funding address mhannsH8oupuQYen3AxbUebhWFVz2c9ams and memo string FragKingLord. She wants to fund her account with 1000 CTOKENs. (Note that it may seem that Alice could later make repeated transactions the same way, but she should not assume the funding address has not changed, so it is a good practice to use a random hex string to not give the user the impression that the funding address and memo are valid for repeated transactions)

Alice next logs in to her Counterparty wallet where she enters the destination address, memo string, and the amount of 1000 CTOKENs. Her wallet creates a transaction that looks like this (source is the wallet address from which she’s sending).

{
  "method": "create_send",
  "params": {"source": "mzJAEHoho8ddcRoByPRnpHRLnW5r4D2UmN", 
  "destination": "mhannsH8oupuQYen3AxbUebhWFVz2c9ams", 
  "asset": "CTOKEN", 
  "quantity": 1000, 
  "memo_is_hex": "False", 
  "use_enhanced_send": "True", 
  "memo": "FragKingLord"},
  "jsonrpc": "2.0",
  "id": 1
}

Counterparty API returns unsigned Bitcoin transaction with this information:

{
    "jsonrpc": "2.0",
    "result": "0100000001f08d873eabf4acc142206e6f6eec2a8be7c146cef1a6a0a156504190503bc2b0020000001976a914cdfef2006bdf3b413e208f8562c89195c657312888acffffffff0336150000000000001976a91416a9fb873b216d385ab023daf551cdc701af5af588ac00000000000000001e6a1c464e1b851b0e7c918f707ed24481774ceabb882a0c0cac94207cd27ae57dc100000000001976a914cdfef2006bdf3b413e208f8562c89195c657312888ac00000000",
    "id": 1
}

Normally (say, in Counterwallet), the wallet will ask for a confirmation to Send, after which this transaction will be locally (in the wallet) signed with the private key of the source address and then sent to the Bitcoin network.

Once this transaction has received enough confirmations, C-Gaming will credit FragKingLord’s account with 1000 CTOKENs.

Additional details

https://counterparty.io/docs/exchange_integration/