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

Dynafed block parsing #23

Open
asoltys opened this issue Aug 30, 2021 · 5 comments · May be fixed by #25
Open

Dynafed block parsing #23

asoltys opened this issue Aug 30, 2021 · 5 comments · May be fixed by #25

Comments

@asoltys
Copy link

asoltys commented Aug 30, 2021

With the dynafed upgrade going live soon, we'll need to be able to handle blocks with dynafed headers. @philippem linked me to this example that we could use as a test case: https://github.com/ElementsProject/rust-elements/blob/master/src/block.rs#L655

The Block.fromHex() method seems to have a problem handling it:

RangeError: value out of range

@tiero
Copy link
Member

tiero commented Aug 30, 2021

@asoltys we never touched block (de)serialization when forking from bitcoinjs. So the implementation has be done anyway since is missing also for pre-dynafed blocks.

We implemented that in go-elements tho, could be another reference.

Do you see any use case for browser block parsing? I would wait for neutrino support in Elements before doing any SPV like wallet in the browser

@asoltys
Copy link
Author

asoltys commented Aug 30, 2021

I use it in the coinos nodejs app server to parse Blocks as they get received to check if any of the block transactions pertain to any of the wallet addresses we're tracking and update their confirmed status. Most people would probably use walletnotify in that case but we're tracking some HD wallets outside of elementsd. That said, I could probably use electrs or bwt for this instead, I think they just weren't around when I wrote the code for this.

Anyways, this isn't something I expect you guys to fix. I might try to take it on though so figured it would be good to have an issue for it. I managed to get pre-dynafed blocks parsing a while ago: asoltys/elementsjs-lib@04547ed

@tiero
Copy link
Member

tiero commented Aug 31, 2021

@asoltys very interesting, thanks for the commit!

Let me see if we can allocate some time for it! Definitely interested in see the code you use to check transaction relative to an HD wallet in blocks, is it open source?

@asoltys
Copy link
Author

asoltys commented Sep 1, 2021

Yes it's available here: https://github.com/coinos/coinos-server/blob/master/routes/liquid/receive.js#L190

Essentially it just loops over all the txn's in the block and checks if any were destined to an address that we have in our database which could be either from an HD wallet or our custodial node. If so, we update the payment record and user account in our db.

@tiero
Copy link
Member

tiero commented Sep 2, 2021

Thanks!

We are see to allocate to some resource to update LiquidJS to support blocks as well ( I always assumed nobody was using the block feature anyway, so thanks for heads up)

@sekulicd sekulicd linked a pull request Sep 22, 2021 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants