Bonds on Stellar

Setting up this smart contract in Stellar will involve some of the more advanced features of the Stellar protocol. So before you dig in please first read: time bounds on transactions, accounts with multiple signers, and batched operations.


Imagine it is December 2016… Yoyodyne wants to issue a bond to raise money for “research.” It will sell this bond at an auction. The bond will pay $1000 every month for a year. After getting approval from appropriate regulatory bodies, Yoyodyne wisely decides to issue the bond on the Stellar distributed network.

Yoyodyne has a publicly known Stellar account, yoyoAccount with signing key keyA.
To issue the bond, it also creates a new bondAccount.

Yoyodyne adds yoyoKey as a signer on bondAccount. It sets the weight of the bondAccount master key to 0. Now only yoyoKey can sign transactions for bondAccount.

Yoyodyne now creates 12 transactions that look like this:

  • Source Account ID : bondAccount
  • Sequence Number: 1
  • Time Bounds: anytime after 1st Jan 2016
  • Operations: yoyoAccount sends $1000 to bondAccount
  • Source Account ID : bondAccount
  • Sequence Number: 2
  • Time Bounds: anytime after 1st Feb 2016
  • Operations: yoyoAccount sends $1000 to bondAccount
  • Source Account ID : bondAccount
  • Sequence Number: 3
  • Time Bounds: anytime after 1st Mar 2016
  • Operations: yoyoAccount sends $1000 to bondAccount

Yoyodyne signs all these transactions with keyA and makes them publicly available. None of the transactions are valid yet: They need to be signed by bondAccount, and the time bounds haven’t been reached yet.

Now Yoyodyne starts its bond auction. It requests transactions from bidders of the form:

  • AccountID: accountBuyer
  • Operations:
    • bondAccount addSigner(keyBuyer,1)
    • bondAccount addSigner(yoyoKey,0)
    • accountBuyer sends $X to yoyoAccount
  • Signers: keyBuyer

Yoyodyne collects these transactions from people for the duration of the auction. Once the auction is over, it signs the transaction with the highest value of $X and submits it to the Stellar network.

Let’s say Veronica is the highest bidder and buys the bond for $10,000. Yoyodyne receives $10,000 dollars and Veronica is now the only signer on the bondAccount. Veronica also has the transactions that were pre-signed by Yoyodyne. When a coupon date passes, Veronica can add her signature to the appropriate transaction and issue it into the Stellar network.

If Veronica wants to, she can also resell the bond using a similar transaction as above:

  • AccountID: accountBuyer
  • Operations:
    • bondAccount addSigner(keyBuyer,1)
    • bondAccount addSigner(keyVeronica,0)
    • accountBuyer sends $X to accountVeronica
  • Signers: keyBuyer, keyVeronica

Summary

The interesting thing is that bondAccount itself becomes an asset that can be traded between accounts and it will continue to issue the bond interests payments to whatever the current account that owns it is.
It is obviously possible to make more complicated schemes. This should just give you some ideas about what is possible.

Published by

Jed McCaleb

Jed McCaleb believes in consciously leveraging technology to reduce inefficiency and improve the human condition. He created eDonkey, one of the largest file-sharing networks of its time, as well as Mt. Gox, the first Bitcoin exchange. Recognizing that the world’s financial infrastructure is broken and that too many people are left without resources, Jed cofounded Stellar in 2014. He also advises MIRI, which researches AI for positive impact.