Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPS-0009? | Coin Selection Including Native Tokens #611

Merged
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions CPS-????/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
CPS: ?
HinsonSIDAN marked this conversation as resolved.
Show resolved Hide resolved
Title: Coin Selection Approach for Post Native Tokens Era
rphair marked this conversation as resolved.
Show resolved Hide resolved
Status: Open
Category: Wallets
Authors:
- Hinson Wong <[email protected]>
- Tsz Wai Wu <[email protected]>
Proposed Solutions:
- []
rphair marked this conversation as resolved.
Show resolved Hide resolved
Discussions:
- https://github.com/sidan-lab/CIPs/discussions
- https://discord.gg/uznpyACq
rphair marked this conversation as resolved.
Show resolved Hide resolved
Created: 2023-10-20
---

## Abstract

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.

## Problem

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.

### 1. Need for Efficient Coin Selection

Cardano transactions involving native tokens often 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.

### 2. Prioritizing Necessary Tokens

To improve the efficiency of Cardano transactions, there is a need to prioritize the selection of necessary tokens while excluding unnecessary ones. This prioritization will help reduce the inflation of transaction sizes, making them more streamlined and cost-effective.

### 3. Streamlining the Selection Process

In addition to token prioritization, 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.

### 4. Compatibility with Serialization Libraries

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.

## Use Cases

### Native Token Transactions

Users and applications frequently engage in native token transactions, making efficient coin selection essential to minimize transaction costs and network congestion.

### DApps and DeFi

Decentralized applications and DeFi projects require efficient coin selection to maintain the performance and cost-effectiveness of their transactions.

### Network Scalability

Efficient coin selection contributes to network scalability by reducing the size and complexity of transactions, ensuring smooth and rapid processing.

## Goals

### Specialized Coin Selection Approach

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.

### Streamlined Transactions

By optimizing coin selection, we aim to streamline Cardano transactions, reducing their size and complexity while preserving the integrity of native token operations.

### Cross-Compatibility

The proposed approach should remain compatible with existing off-chain serialization libraries and protocols, ensuring accessibility to a wide range of developers and projects.

### Improved Network Performance

Efficient coin selection contributes to overall network performance, making Cardano more scalable and reliable for users, DApps, and DeFi.

## Open Questions

### Implementation

1. How can we effectively implement and promote the specialized coin selection approach?
2. What changes, enhancements, or protocols need to be adopted within the Cardano ecosystem to achieve this?
3. Is there any community collective intelligence could gather for this area? Particularly, would engineers from Emurgo (who maintain the `cardano-serialization-lib`) and developer of `cardano-cardano-multiplatform-lib` got any form of insight to push forth the community progress?

### Developer Education

1. Is there any changes on application code itself with the improvement on coin selection algorithm?
2. If so, how can developers be educated and informed about the new coin selection approach to ensure its successful adoption and integration into their projects?

### Community Consensus

1. How can we gather and build consensus within the Cardano community regarding the proposed coin selection approach?
2. Do we need any support from academia with formal proof to impose the standard?
3. What methods can be employed to ensure widespread acceptance and adoption? Do we need endorsement from any of IOHK, CF or Emurgo?
4. If academic formal research is not needed for this consensus, how can we set the bar for acceptable algorithm? Would there be core committee making the decision?