Comments (3)
You need multiple inputs to select from first. You only have txId
and txIdVal
?
In any case
let feeRate = 100 // aka 100 satoshis per byte
let { inputs, outputs, fee } = coinselect([
{
txId: txId,
vout: 1,
value: txIdVal
}
], [{
address: this.state.add, // your desired output?
value: amount
}], feeRate)
if (!inputs) throw new Error('No valid Transaction exists')
outputs.forEach((x) => {
if (x.address) return
x.address = this.state.address // the change address, if required
})
let txb = new bitcoin.TransactionBuilder(testnet)
inputs.forEach(x => txb.addInput(x.txId, x.vout))
outputs.forEach(x => txb.addOutput(x.address, x.value))
inputs.forEach((x, i) => txb.sign(i, keyPair))
txb.build().toHex()
from coinselect.
Thanks for the help! I don't mean to be a bother, but do you know how I can make my app get all the txIds automatically? I'm pretty stuck here.
from coinselect.
but do you know how I can make my app get all the txIds automatically?
The question here, is txIds
... for what?
If you have a list of addresses, you can use a block explorer, of which there are many.
https://blockchain.info/q
https://www.blocktrail.com/api
https://btc.com/api-doc
https://www.blockcypher.com/quickstart/
https://www.smartbit.com.au/api
They come and go.
If you have your own bitcoind
node, you can run something like bitcoinjs/indexd
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.