-
Notifications
You must be signed in to change notification settings - Fork 54
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
Add fees to NUT-02 #126
Add fees to NUT-02 #126
Conversation
unintended side effect: this has a negative effect on privacy measures and offline spending |
Co-authored-by: gandlafbtc <[email protected]>
def fees(inputs: List[Proof]) -> int: | ||
sum_fees = 0 | ||
for proof in inputs: | ||
sum_fees += keysets[proof.id].input_fee_ppk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still missing proof.amount
here:
sum_fees += keysets[proof.id].input_fee_ppk | |
sum_fees += proof.amount * keysets[proof.id].input_fee_ppk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still missing
proof.amount
here:
The fees are not amount-dependent.
merged in nutmix. |
Proposing to add fees to the mandatory part of the spec as I expect most public mints will require fees at some point. If the fees are not set, we should assume it as being 0.
Moved around some existing text. The new part is:
Fees (parts per thousand)
Keysets indicate the fee
input_fee_ppk
that is charged when aProof
of that keyset is spent as an input to a transaction. The fee is given in parts per thousand (ppk) per input measured in theunit
of the keyset and the sum is rounded up to the next larger integer.As an example, we construct a transaction spending 3 inputs (
Proofs
) from a keyset with unitsat
andinput_fee_ppk
of100
. A fee of100 ppk
means0.1 sat
per input. The sum of the fees would be 300 ppk for this transaction and the mint would charge1 sat
in fees (ceil(0.3) == 1
). The fees for spending 1-10 inputs is 1 sat, 11-20 inputs is 2 sat and so on....
Wallet input and output construction
When constructing a transaction with ecash inputs (example:
/v1/swap
or/v1/melt
), wallets MUST add fees to the inputs (or subtract from the outputs) if they spent ecash from a keyset with fees. The mint checks the following equation:The
fees
are calculated for each input individually (by summing the fee from the keyset they are from) and then rounded up to the next integer.Tracking progress
Mints:
Wallets