Skip to content

Instantly share code, notes, and snippets.

@erikd
Last active July 12, 2023 22:51
Show Gist options
  • Save erikd/9e3a37c51aff569c9dffca6f7bef5679 to your computer and use it in GitHub Desktop.
Save erikd/9e3a37c51aff569c9dffca6f7bef5679 to your computer and use it in GitHub Desktop.
Random thoughts on Maya Protocol supporting Cardano/ADA

Maya Protocol and Implications of a Cardano/ADA Liquidity Pool

This document explores the factors that will need to be taken into account if the Maya Protocol decides to provide an ADA/CACAO liquidity pool.

Rationale

The Cardano network for the ADA token provides an incredibly simple and well designed staking and stake delegation mechanism that is trust-less, non-custodial, permission-less and carries a risk that is basically limited to the risk of holding ADA itself.

Obviously, providing ADA to a Maya Protocol LP is a higher risk than just holding ADA in one's own wallet. Since providing ADA liquidity is riskier, the reward should be higher. Ideally, people providing ADA liquidity should be getting ADA staking rewards as well as getting returns from providing liquidity.

Currently the ADA staking reward is about 3.5% per annum. Staking rewards are a combination of transaction fees and a slowly decaying amount from the protocol reserves.

High Level View of Cardano/ADA.

Cardano is the name of the network and ADA is the name of the token native to the Cardano network. The Cardano network allows secondary tokens to be minted, transacted and burned on the Cardano network.

The Cardano network uses a Proof-of-Stake consensus protocol. Staking of the ADA native token on the Cardano network contributes to the security of the network. In order to maximise the proportion of total ADA supply being staked, the staking mechanism was designed to be as simple as possible so that even unsophisticated users can stake.

ADA staking is non-custodial (the ownership of the ADA remains with the person delegating their stake), trust-less (only need to trust the protocol), permission-less, allows delegation and is fully liquid.

Delegation means that a holder of a small amount of ADA does not need to run a stake pool, they can delegate their ADA in a trust-less and non-custodial way to a stake pool and get staking rewards from the pool, with the rewards automatically distributed by the protocol. They do not need to trust the stake pool operator.

Liquid staking is a fundamental part of the protocol. Liquid staking means that ADA staking or delegated for the purpose of staking has no lock in period. Staked ADA can added to or subtracted from at any time. ADA added to a staked wallet will be added staked balance of the wallet and ADA subtracted from a wallet will be removed.

The mechanism that allows this liquid staking is due to time in the Cardano system being split into epochs, each of which is 5 days. At the end of each epoch a snapshot is taken of the ADA balance associated with each staking credential. If the snapshot is taken for epoch N, that balance is used as the basis for determining rewards earned for epoch N+2 and these rewards are spendable in epoch N+4.

Specific Relevant Details of Cardano/ADA.

  • Cardano/ADA uses an extended UTxO accounting model like Bitcoin rather than an account based model like Ethereum.

  • ADA addresses have two components, a spending part and a stake credential, which are basically concatenated together. There is a N to 1 relationship between the former and the later. For instance, most standard Cardano wallets will have a huge number of spending parts and a single (ie per wallet) staking credential. It is pretty trivial to extract the staking credential from a full Cardano/ADA address or construct a valid Cardano/ADA address containing an arbitrary stake credential.

  • Per-epoch rewards compound (ie rewards earned in epoch N will automatically be eligible for earning new rewards in epoch N+2) in a per stake credential account. The next time any UTxO address which includes the staking credential is spend, the stake credential account will be drained as part of the transaction.

  • The staking incentivisation scheme is designed to disincentivise stake pool centralisation. It does this my specifying in the protocol and minimum number (N) of stake pools. For the rewards per pool, per epoch is designed to be linear with the amount of stake and delegated stake each pool has, up to the point where a pool has more than 1/N of the total staked ADA (ie pool becomes saturated). Above this 1/N point rewards decrease proportionally to how far above the 1/N point it is. Currently N is set to 500 by the protocol, but recently at least 1000 different stake pools have been producing blocks in each epoch.

  • Each stake pool can set the percentage of rewards earned my the pool which goes to people who delegate to the pool. This is usually 97% or more but can be set to 0% in which case all the rewards earned go to the stake pool owner (which in this case could be the Maya Protocol).

Possible Mechanisms for Providing ADA Staking Rewards

There are at least two possible mechanisms for Maya to provide ADA liquidity providers with staking rewards as well as LP return. These mechanisms are:

  • The Maya node system runs one or more Cardano/ADA stake pools with 100% of the rewards going back to the Maya system which then distributes the ADA to the liquidity providers. This is obviously more complex, but also more fool proof than the option below.

  • The Maya node systems each use their individual spending addresses in conjunction with a common staking credential. The staking redential will only need to be registered once even though it is used by all the Maya nodes. Similarly, a this staking credential will only need to be delegated once to an existing Cardano stake pool. Since all Maya nodes are using the same stake credential, the fact that the Maya protocol churns its active nodes every three days is irrelevant. The main complication here is that if the amount of pooled ADA becomes significant, delegating to an existing stake pool might be enough to push the total stake for that pool above the saturation point where staking rewards get reduced. This would be bad for the Maya ADA LPs and bad for the people already delegated to the pool that Maya decides to delegate to.

Specific Questions

  • What is minimum amount of ADA needed in order to be profitable?

    The minimum amount of ADA that can be staked is really tiny. In order to delegate stake one needs issue two transactions, one to register the stake credential and one to delegate to a stake pool (a transaction currently costs about 0.17 ADA and the current ADA price is about US$0.30). Personally I would not bother staking less than about 10 ADA.

    When running a stake pool, for the pool to get about one block per epoch (its probabilistic) would require about 1/21600 the of staked ADA to be delegated to the pool. According to https://pool.pm, there is currently 34.7 billion ADA staked. So a well run stake pool to get one block per epoch, would require about 16 million ADA to be delegated to it. Depending on the way the pool is set up it may attract delegation from people unconnected to Maya.

  • How would the management of ADA staking interact with the the node churn on the Maya network?

    The Maya network has a concept of active and inactive nodes. Approximately every three days, some previously active nodes becoming inactive and some inactive nodes become active.

    In the case where Maya is not running its own stake pool, a spending credential would be generated using the Maya Threshold Signature Scheme and that would then be combined with the stake credential to generated a two part ADA address. The Cardano/ADA staking machinery does not care about the spending credential, only the staking credential.

    In the case where Maya is running its own stake pools, all Maya nodes would delegate to these pools and get rewards from these pools which is obviously easy to manage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment