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-???? | Coin Selection Including Native Tokens #609

Closed
wants to merge 5 commits into from
Closed
Changes from all 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-0002/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
CPS: 2
Copy link
Collaborator

@rphair rphair Oct 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
CPS: 2
CPS: ?

Please @SIDANWhatever you will also need to rename the containing directory from CPS-0002 to something non-numerical (like CPS-XXXX or CPS-token-selection.

Title: Coin Selection Approach for Post Native Tokens Era in Cardano
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Title: Coin Selection Approach for Post Native Tokens Era in Cardano
Title: Coin Selection Including Native Tokens

If author & editors are in agreement that this is more specific and less redundant ("era", "Cardano") then let's please change the document title to the current PR title.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p.s. also @SIDANWhatever for fixing little things like this we recommend that your PR branch be set to "Allow edits by maintainers" (the general default when submitting a PR, and helpful to keep track of who recommended the changes behind each commit).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p.s. also @SIDANWhatever for fixing little things like this we recommend that your PR branch be set to "Allow edits by maintainers" (the general default when submitting a PR, and helpful to keep track of who recommended the changes behind each commit).

Seems its only work for PR from feature branch, should I close this PR and create a new one?

Copy link
Collaborator

@rphair rphair Oct 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to create a new PR... you should be able to extend the permissions by following these instructions (i.e. when you view this PR's branch in the repository which pushed it, with write permission in that repository) 🤓 https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork#enabling-repository-maintainer-permissions-on-existing-pull-requests

Status: Open
Category: Wallets
Authors:
- Hinson Wong <wongkahinhinson@gmail.com>
- Tsz Wai Wu <wu.tszwai@outlook.com>
Proposed Solutions:
- []
Discussions:
- https://github.com/sidan-lab/CIPs/discussions
- https://discord.gg/uznpyACq
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?