Skip to content

How to get receiver/sender address from utxo or transaction #1205

Closed Answered by orar
orar asked this question in Q&A
Discussion options

You must be logged in to vote

After a little digging and finding from bitcoinjs, I realized I needed to approach it from the address module.

let utxos = wallet.list_unspent()?;

for utxo in utxos {

    let addr = bdk::bitcoin::address::Address::from_script(
        utxo.txout.script_pubkey.as_script(),
        Network::Testnet
    )?;

    println!("Address: {:#?}", addr)
}

Same as from transaction TxIn & TxOut

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by orar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant