Skip to content
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

Can the coinSelect recognize that my utxos are from segwit? #61

Closed
bajian opened this issue Dec 28, 2020 · 1 comment
Closed

Can the coinSelect recognize that my utxos are from segwit? #61

bajian opened this issue Dec 28, 2020 · 1 comment

Comments

@bajian
Copy link

bajian commented Dec 28, 2020

Can the coinSelect recognize that my utxos are from segwit? (I think segwit will be lower fee cost?)

Looking forward to your reply!

Here is my test code:

    let coinSelect = require('coinselect');

    let feeRate = 21 // satoshis per byte 
    let utxos = [
        {
            "txid": "a14838af2970d92b3175cbde3bbf158fef8d740fca0d1ba7f74687e2b19c0eae",
            "vout": 0,
            "value": 30000,
            "amount": 0.0003,
            // "address": "3D8UZerWJtKqdWLZc4sFLsXoe9RTrt6nob",
            // "scriptPubKey": "a9147d7a053d8a8ba53b12ef29bef804b83c34a8963487",
        },
        {
            "txid": "abe6dd9b5cca3af9ba1a476b7ef09f0cfde08b04a869e77bf029d564b5b7fd23",
            "vout": 0,
            "value": 2000000,
            "amount": 0.02,
            // "address": "3FAwbExZBpcQ66MQZeEe9naH9j41jrLVHG",
            // "scriptPubKey": "a91493e1aa4fe49ff189f42ac0c54988c34237d090a387",
        },
    ];
    let targets = [
        {
            address: '33w5WjaVmba3qiTcz8ENi1mySHnmrS43M4',
            value: 2000001,
        }
    ];

    let {inputs, outputs, fee} = coinSelect(utxos, targets, feeRate)

// the accumulated fee is always returned for analysis
    console.log('fee', fee)
    console.log('inputs', inputs)
    console.log('outputs', outputs)
@bajian bajian changed the title How can i get the inputs, outputs? Can the coinSelect recognize that my utxos are from segwit? Dec 28, 2020
@junderw
Copy link
Member

junderw commented Dec 28, 2020

No, unfortunately not.

@junderw junderw closed this as completed Dec 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants