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

Guidance on Handling Balances from Multiple Cryptocurrencies in MST #2

Open
yagnadeepxo opened this issue Feb 26, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@yagnadeepxo
Copy link
Collaborator

yagnadeepxo commented Feb 26, 2024

Summary

This issue seeks to clarify and request documentation or utility functions for handling balances from multiple cryptocurrencies when constructing a Merkle Sum Tree (MST) within the Summa Solvency Protocol. The goal is to ensure that developers understand how to correctly normalize, convert, and map balances from various sources to the field Fp
of the bn256 curve, a critical step for leveraging the protocol across diverse assets.

Background

Exchanges and platforms dealing with multiple cryptocurrencies need to accurately represent user balances in a unified format suitable for cryptographic operations, specifically when building an MST. The process typically involves:

  1. Normalizing balances to a common base unit.
  2. Converting balances to strings, if they are not already in this format.
  3. Parsing these strings into BigUint.
  4. Mapping BigUint balances to the field Fp of the bn256 curve.

Challenges

Normalization: Different cryptocurrencies use different base units (e.g., wei for Ethereum, sathoshi for Bitcoin, lamport for Solana). A clear standard for normalization across currencies within the Summa context is needed.

String Conversion and Parsing: Not all balances are initially in string format. Guidance on handling various formats and precision concerns is required.

Mapping to Fp: The conversion process from BigUint to an element of Fp is crucial and must ensure no loss of precision or value.

Request

Documentation: Detailed documentation on each step of the process, with examples for common cryptocurrencies. This should include best practices for normalization and dealing with precision.

Utility Functions: It would be highly beneficial to provide utility functions within the Summa library that abstract some of these steps, particularly normalization and mapping to Fp to minimize potential errors.

Examples: Real-world examples or case studies of integrating multiple cryptocurrencies into the MST, highlighting any edge cases or common pitfalls.

@yagnadeepxo yagnadeepxo added the enhancement New feature or request label Feb 26, 2024
@alxkzmn
Copy link
Contributor

alxkzmn commented Mar 31, 2024

Summa performs all the calculations on each currency separately so there's no need for a common denomination. We can have different precision per currency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants