-
Notifications
You must be signed in to change notification settings - Fork 14
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
Alternative bytecode_pattern approach #56
Comments
I made a little tool to experiment with this, using these modes:
Example of patternizing AnyHedge input script:
Entering the redeem script, we get:
|
To better illustrate, here's an index (pattern, input_count) of contract fingerprints (STRIP_PUSHES mode) from blocks 0-780,000: https://gist.github.com/A60AB5450353F40E/6b3e525d6e1220328217b9568968d6fc |
Thanks for looking into this @A60AB5450353F40E! This would be a great improvement for scanning contract patterns. I'd love to take a PR introducing this feature! I won't have bandwidth to work on this myself until I make some progress on #29. (Otherwise, I'll try to implement the bytecode_pattern stuff this way when I'm working on the ClickHouse migration.) |
Wrote a little paper about this: https://gitlab.com/0353F40E/smart-contract-fingerprinting and working on extending BCHN RPC with it: https://gitlab.com/0353F40E/bitcoin-cash-node/-/commits/bcpattern If we could get this merged to BCHN then you won't have to calculate it with SQL anymore, can just read the relevant fields from node RPC |
This has been merged to BCHN! https://gitlab.com/bitcoin-cash-node/bitcoin-cash-node/-/merge_requests/1921 With next release you'll be able to get the redeem script, its pattern & fingerprint directly from the node RPC! (also, you get an array of pushed data), see below example for the schema:
|
So I was thinking to split how to store redeem script, how about split it to 3 fields:
One can then use _eq operator on the most general pattern, which should be better performance than regex, it would then be further narrowed down by using regex on push sizes or pushes, but those would be executed only on positive matches for the general template.
Also, the redeem script can be accurately reconstructed from this.
Could even do some more parsing and have a function to filter for the exact value of Nth push or something.
The text was updated successfully, but these errors were encountered: