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

output of utxo_dump/parse_ldb #11

Closed
ubamnow404 opened this issue Jan 14, 2018 · 4 comments
Closed

output of utxo_dump/parse_ldb #11

ubamnow404 opened this issue Jan 14, 2018 · 4 comments

Comments

@ubamnow404
Copy link

Looking at the output of these chainstate tools, I see that the "data" key is the hash160 of the utxo.

I'm curious about the key/tx_id value, e.g. "000000f03ecc02c029184f5dbab0051d1820ecab35b4c8b62a11272bd4dccfea". It's not a transaction id.

Is it just the leveldb key for that utxo?

Is there a way to get the utxo's actual blockchain transaction id (w/o parsing all the blockfiles)?

@sr-gi
Copy link
Owner

sr-gi commented Jan 14, 2018

I'm not sure I get exactly what you asked in the firsts paragraphs, however, if you're using a chainstate for Core 0.15+ the LevelDB key is:

c:tx_id:index

So in order to get the transaction ID for each utxo you just need to parse the whole chainstate.

@sr-gi
Copy link
Owner

sr-gi commented Jan 15, 2018

As an example, for Core version 0.15+ and the following utxo:

tx_id = 0118dd986e59473732239d39cb3b8890bf32677719dd8933b05f6614f4020000

out_index = 0

You will find the following key in the chainstate:

43000002f414665fb03389dd19776732bf90883bcb399d23323747596e98dd180100

That is:

43 = Character c
000002f414665fb03389dd19776732bf90883bcb399d23323747596e98dd1801 = Little endian representation of the tx_id
00 = 1 byte representation of the index (0)

@sr-gi
Copy link
Owner

sr-gi commented Jan 18, 2018

@ubamnow404 did you managed to do it? Do you need some extra help?

@ubamnow404
Copy link
Author

thanks you, I worked it out, and have working prototype. Appreciate your help 🙏

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