Comments (9)
I think what’s confusing is the term ‘matched’. If input == (matches) output then fee = 0. Do you mean ‘reached’?
Don’t get me wrong, cs works great in my app. No issues with it.
from coinselect.
I'm confusing myself. Of course, 'matched' is the correct term for Blackjack (like the game), not reached.
What I should have focussed on was the term 'target value'. This refers to the output + pre-calculated fee, is that right?
var fee = feeRate * (bytesAccum + inputBytes)
Whereas I was reading 'target value' == THE output value, as in
let targets = [{ address: payToAddr, value: amount }]
from coinselect.
From the inputs?
fee = input - output
, where input >= output
.
If you have 3 unspents (90 + 50 + 25), and 1 output (100), and you do a basic accumulative strategy, you'll probably end up with 2 inputs (90 + 50) and 1 output (100), with fee (40).
I'll update the README example to be copy-pastable.
from coinselect.
Yes, reached.
PR accepted.
from coinselect.
It does say reached
https://github.com/bitcoinjs/coinselect/blame/11e0e925ccc939c2b0889b43020a590e89a66b20/README.md#L15
If you are referring to blackjack
:
Line 16 in 11e0e92
Then, it is matched
.
Lines 22 to 33 in 11e0e92
Where target value is outAccum + fee
.
from coinselect.
What I should have focussed on was the term 'target value'. This refers to the output + pre-calculated fee, is that right?
Yes, the "target value" refers to outAccum + fee
, and is variable in that it increases as the fee
increases (as inputs are added).
from coinselect.
Do you have another suggestion for the term?
You are right in that it is ambiguous and could be better.
from coinselect.
I think 'target value' is fine if referring to the actual amount you want the target address to receive and fits with the terms already used when constructing the 'targets' array. I would only add '+ fees' and leave it for people to read the code to see how the fees are dynamically determined and included.
from coinselect.
See #35
from coinselect.
Related Issues (20)
- TransactionBuilder is now deprecated HOT 5
- No inputs or outputs generated HOT 6
- Consider Output Address Types HOT 5
- Proposal For Segwit Update PR HOT 5
- PR #49 + npm HOT 1
- What is the best way to handle user selection of virtual bytes in coinselect? HOT 1
- BIP 125 selection for replacement HOT 2
- No solution found if many inputs HOT 3
- Can the coinSelect recognize that my utxos are from segwit? HOT 1
- inputs and outputs returning unidefined when pending balance HOT 5
- CoinSelect using multiple small UTXOs instead of one big HOT 3
- Segwit workaround safe to use? HOT 2
- "coinselect" always expose the largest UTXO no matter how small the payment is because it sorts by descending value. HOT 5
- Inputs nor outputs are returned when a certain condition is met HOT 4
- type error in typescript project HOT 1
- Is this project dead? HOT 1
- Check out trezor/trezor-suite/packages/utxo-lib/src/coinselect for any ideas HOT 1
- Module cannot be found , npm I —dev-save @types/coinselect HOT 2
- Reevaluating 'Dust' Considerations When Adding Change in Transactions HOT 5
- Library breaks with float feeRate
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coinselect.