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

Error Importing Transactions: Address not Found #235

Closed
rossbates opened this issue Apr 3, 2022 · 3 comments
Closed

Error Importing Transactions: Address not Found #235

rossbates opened this issue Apr 3, 2022 · 3 comments

Comments

@rossbates
Copy link

rossbates commented Apr 3, 2022

Hello - I'm trying to import btc transactions into a wallet using a connection to my electrumx server.

The relevant code I'm using is straight forward:

w = Wallet(1)
tx = Transaction.parse(rawtx="...")
w.transaction_import(tx)

I'm certain that the wallet is valid and has an address generated that matches an output in the transaction. Reading the documentation what I'm expecting it to do is import the relevant transaction for the matching address and ignore the others

https://bitcoinlib.readthedocs.io/en/latest/source/bitcoinlib.transactions.html?highlight=transaction_import#bitcoinlib.transactions.Transaction.parse

What's happening when I run the import is that the code errors on the UTXO/addresses for other addresses in the transaction not associated to my wallet.

UTXO %s and key with address %s not found in this wallet

Am I approaching this correctly? Thanks!

@mccwdev
Copy link
Member

mccwdev commented Apr 20, 2022

The code probably fails because the keys of the inputs are not known in the wallet, only the outputs keys.

I'm not sure what your end-goal is, but why not updating the wallet with w.scan(), to import the latest transactions?

@rossbates
Copy link
Author

What I'm trying to accomplish is maintaining multiple offline wallets. In this case offline being no 3rd party services using cold storage wallets.

I have a local electrumx server running and I can query it to get transaction history for any given xpub.

https://electrumx.readthedocs.io/en/latest/protocol-methods.html#blockchain-scripthash-get-history

From there what I was trying to do is iterate through the list getting the raw transaction values

https://electrumx.readthedocs.io/en/latest/protocol-methods.html#blockchain-transaction-get

I think I misinterpreted how the transaction importer worked assuming that it only imported data for the associated addresses in the block.

The reason I haven't gone down the path of setting up a service to talk to the bitcoin node directly is because I assumed electrumx was the easier path for indexing multiple xpubs. I don't want to create/store multiple wallets (and private keys) directly on the btc node.

@mccwdev
Copy link
Member

mccwdev commented Jan 15, 2024

See #234

@mccwdev mccwdev closed this as completed Jan 15, 2024
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