-
Notifications
You must be signed in to change notification settings - Fork 3
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
add: track P2A inputs and outputs in backend #18
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me modulo the rawtx-rs dependency.
I'll fix the frontend CI job. (edit: done in #19)
feel free to upgrade to rawtx-rs |
@0xB10C done! |
Thanks! I'll re-run the backend with this and then look into setting up a frontend chart. (#22) |
Seems to be working for the outputs:
But P2A input detection seem to be weird:
|
This is related to these custom blocks https://mempool.space/de/block/00000000000000000001c3fbc76a7efe7a320a8236ea6250bc15e4f7a67e727d. They used empty inputs: https://mempool.space/de/tx/e0c7e627793bb9da1003fd86323f94fdd02a1513a4ac62a573287dc0ae92ce17 |
Right, there's no way to really differentiate p2a inputs from other non-standard txs that don't have script sigs or witnesses. |
What do you recommend? |
I think just leaving a note on potential charts that P2A inputs don't have a distinct signature and there are known false-positives is fine. |
Would it perhaps be possible to keep track of P2A outputs and detect P2A inputs per them spending P2A outputs? |
That's essentially what fetching prevouts does. The outputs are stored in bitcoind. If there's lots that will be a lot of duplicate data in postgres. |
Yeah, that'd essentially be like keeping an index for P2A outputs, which transactionfee-info currently does not do and can't do with it's current architecture (as it processes blocks in multiple threads and possibly out of order). |
One option would be to fetch the block as JSON via the However, the REST interface is faster, is easier to set up as it doesn't require authentication, and we don't need to parse JSON transactions, convert the hex values in JSON to binary, and then deserialize these to rust-bitcoin transactions. |
We could fetch and parse the tx that contains the prevout via REST, only for inputs that are potential P2As. Oh, but that would require |
Oh, since bitcoin/bitcoin#22918 the JSON response from REST has the prevout information as well. So, we can get the prevouts using REST. It will be slower, but we can still do it using REST and in parallel. Perhaps if we encounter a possible P2A input, we can then fetch the block using |
Oh, indeed! Cool. Then it probably makes sense to only have a transactionfee-info/backend/src/rest.rs Lines 93 to 100 in 5e2dc02
which deserializes it into a lightweight Transaction and InputPrevOut type similar to: #[derive(Deserialize)]
pub struct Transaction {
pub txid: String,
pub hex: String,
pub fee: f64,
pub inputs: Vec<InputPrevOut>,
}
#[derive(Deserialize)]
pub struct InputPrevOut {
pub height: u64,
pub value: f64,
pub script: String, // hex
} This would allow us to:
|
Or possibly even better: implement verbosity 3 for https://crates.io/crates/corepc-types similar to https://docs.rs/corepc-types/0.5.0/corepc_types/v28/struct.GetBlockVerbosityOne.html |
Could be useful to track mining pools upgrading to v28.