CPS | Title | Status | Category | Authors | Proposed Solutions | Discussions | Created | ||
---|---|---|---|---|---|---|---|---|---|
9 |
Coin Selection Including Native Tokens |
Open |
Wallets |
|
2023-10-20 |
The introduction of native tokens in Cardano has introduced unique challenges related to coin selection and transaction efficiency. This Cardano Problem Statement (CPS) addresses the need for a specialized coin selection approach to optimize transactions involving native tokens while minimizing transaction size and complexity.
The integration of native tokens in Cardano transactions has brought both opportunities and challenges. One of the significant challenges is associated with coin selection when dealing with native tokens.
Cardano transactions involving native tokens require attaching a minUTxO value (lovelace) to the transaction. In scenarios where multiple tokens are associated with a single UTxO, selecting such UTxOs as inputs can lead to inefficient transactions. This inefficiency arises from the increased transaction size due to token information, potentially impacting the decentralized applications and network performance.
Streamlining the selection process is crucial. Enhancements should be made to the selection algorithms to ensure that, even in complex scenarios, the coin selection process remains efficient and doesn't compromise the user experience.
The largest off-chain serialization library, cardano-serialization-lib
, still follows a modified version of the CIP-2 standard, which was established in the pre-native token era. There's a need to ensure that the proposed coin selection approach remains compatible with existing serialization libraries, making it accessible to a wider range of developers and applications.
While CIP-2 certainly works well in an environment where native assets such as tokens and NFTs don't exist, it has been expanded upon differently by each serialization library, with their own custom solutions to select for tokens. It would be useful to once again have some standard for coin selection that is trusted by the community.
CIP-2 doesn't consider minUTxOValue
in the change output with tokens, if a pure ADA change output cannot be created that reaches the minUTxOValue
, it is possible to simply increase the fees paid for the transaction by that small amount to balance the transaction. This, however, doesn't work when tokens are involved, any tokens in the transaction inputs MUST be included in the change output.
Users and applications frequently engage in native token transactions, making efficient coin selection essential to minimize transaction costs and network congestion.
Decentralized applications and DeFi projects require efficient coin selection to maintain the performance and cost-effectiveness of their transactions.
Some real world use cases of coin selection algorithms taking Native Tokens into account are listed below:
Efficient coin selection contributes to network scalability by reducing the size and complexity of transactions, ensuring smooth and rapid processing.
The primary goal of this CPS is to establish a specialized coin selection approach for transactions involving native tokens in Cardano. This approach should prioritize necessary tokens, improve transaction efficiency, and minimize the impact of native token inclusion on transaction size.
In Cardano, there is somewhat of a cyclic dependency between UTxO selection, change output and fees. It would be extremely helpful if some consensus was reached on how to handle this part of transaction building. Since the most naïve approach essentially requires rebuilding the transaction several times, there is potential to significantly reduce latency in DApps with a more efficient approach.
CIP-2 also selects inputs in order to generate "useful" change outputs. This will be a significantly more complex problem when native tokens are considered, but will significantly improve the collective efficiency of transaction generation in wallets.
By optimizing coin selection, we aim to streamline Cardano transactions, reducing their size and complexity while preserving the integrity of native token operations.
The proposed approach should remain compatible with existing off-chain serialization libraries and protocols, ensuring accessibility to a wide range of developers and projects.
Efficient coin selection contributes to overall network performance, making Cardano more scalable and reliable for users, DApps, and DeFi.
- How can we effectively implement and promote the specialized coin selection approach?
- What changes, enhancements, or protocols need to be adopted within the Cardano ecosystem to achieve this?
- Is there any community collective intelligence could gather for this area? Particularly, would engineers from Emurgo (who maintain
cardano-serialization-lib
) and developers ofcardano-multiplatform-lib
have any form of insight to push forth community progress?
- Are there any changes on application code itself with improvements on coin selection algorithms?
- If so, how can developers be educated and informed about any new coin selection approach to ensure its successful adoption and integration into their projects?
- How can we gather and build consensus within the Cardano community regarding any proposed coin selection approach?
- Do we need any support from academia with formal proof to impose the standard?
- What methods can be employed to ensure widespread acceptance and adoption? Do we need endorsement from any of IOHK, CF or Emurgo?
- If academic formal research is not needed for this consensus, how can we set the bar for an acceptable algorithm? Would there be a core committee making the decision?