GithubHelp home page GithubHelp logo

bridge-decoder's Introduction

How to run

Standard Golang code (installation and so); For the code to work download dataset from https://alphamev.ai and extract it to ./dataset folder.

It has to be structured as so:

  • Polygon:
block,transaction,trace
...
  • Ethereum:
txHash,txData,txTrace
...

Then you can run the code with go run .

How decoder works (currently, not in the future)

It tried to decode each transaction on its own. It parses the csv line by line (to avoid hude memory usage issue).

For each transaction it loads the trace as a recursive struct and checks every bridge on its own. This is the part where the actual decoder kicks in.

Decoder tries to recursively match a certain fingerprint trace on every level. For example I know how the Polygon Bridge Deposit transaction looks like on a trace level. It is unique because the same bridge smart contract code always creates the same trace. If it finds the correct trace fingerprint of any bridge method on any level it then further processes the transaction and checks the status and amount and so on. If everything goes through it then saves this transaction to the database with gorm.

Adding a new bridge

Should be as straight forward as duplicating the PolygonPOS Goland file and replacing the trace checker with the correct fingerprint.

TODO

Make this step a little more automatic -> make helper functions which take correct trace fingerprint as input and all other params as well (contract addresses, method and so on).

bridge-decoder's People

Contributors

gregpr07 avatar

Watchers

James Cloos avatar  avatar Kaihua avatar Zhe Ye avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.