butaneprotocol / translucent-compat

Deprecated in favour of blaze https://github.com/butaneprotocol/blaze-cardano
https://github.com/butaneprotocol/blaze-cardano
Other
15 stars 8 forks source link

Add change splitting #17

Open joacohoyos opened 7 months ago

joacohoyos commented 7 months ago

Using lucid does not allow change splitting. This could be problematic sometimse cause you end up pushing all the change to a single UTxO that could lead to contention issues and also is not ideal even when doing transaction chaining as you could avoid long chains if your UTxO are optimized/splitted

micahkendall commented 7 months ago

Are there CIPs for change splitting or should the users wallet just be reasonably sharded?

joacohoyos commented 7 months ago

No it just a requirement we had in jpg back in the day. We try to avoid putting everything into a single utxo. When creating txs we parametrized the change splitting to something like

ADA_VALUE: 100 MAX_AMOUNT_OF_TOKENS: 20.

So each utxo will have up to 20 tokens and 100 ada. But both values are configurable.

This is what I have in my lucid fork.

export const defaultConfig: Configuration = {
  enableChangeSplitting: true,
  changeCollateral: '5000000',
  changeMinUtxo: '100000000',
  changeNativeAssetChunkSize: 20,
};

This is set when instantiating Tranlucent and then it's used on complete to handle the change