-
Notifications
You must be signed in to change notification settings - Fork 317
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
CIP-0030: Enhance API by adding a 'balanceTx' function #170
CIP-0030: Enhance API by adding a 'balanceTx' function #170
Conversation
Should the |
What exactly would that function do? After reading it twice it's not clear to me what behaviour is expected. |
I second that it's not 100% obvious what is to be done. If this is just to add inputs (does it add witnesses too?) to match needed outputs? It also talks about outputs - is it only for change? Does it do either depending on if there's enough already? e.g. if there's not enough inputs it adds them (and possible adds a change output to return the excess), and if there's enough already it returns the rest as a change output. I also don't understand why this is needed as part of the bridge communication spec. It seems like this could all be done on the dApp side using the available endpoints ( If I'm understanding this correctly I think this belongs at the dApp ecosystem library level, and not as part of the communication spec. |
I agree that it is not obvious :) Here's some context: I've been working on integrating the Nami browser wallet (which follows the communication protocol defined in CIP-0030) and the Plutus Application Backend (PAB). The PAB will try to create a transaction I agree that I can simply use The same reasoning can be applied with |
1Balancing a partially constructed a transaction, in the context of Plutus / PAB typically requires more than just the transaction. What would work nicely I reckon would be to stick to the same communication interface / approach that the PAB uses with the wallet (namely: https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/balanceTransaction). That is, wallets typically need two extra arguments for balancing a partially constructed transactions:
2On a different note, transaction balancing is far from being trivial, especially when considering a generic solution which work nicely for all cases. Having this as part of the base API for CIP-0030 raises the bar for implementors quite significantly. While useful, I would strongly suggest to make this a separate CIP working on top of CIP-0030, as an extension which is optionally, albeit recommended, implemented by wallet providers. |
Thanks @KtorZ for the detailed comment! Totally makes sense to create a separate CIP. I'll close this PR, and start working on the other CIP. |
Adds an additionnal API function called
balanceTx
which balances an unbalanced (or partial) transaction.@rooooooooob