Giter Site home page Giter Site logo

4bytes's Introduction

This is a collection of Ethereum Method signatures. It can be used to get the text-signatures from hex-signatures (with 4-bytes - hence the name)

A real world example:

> curl https://raw.githubusercontent.com/ethereum-lists/4bytes/master/signatures/a9059cbb

will result in this method (from the ERC-20 standard):

transfer(address,uint256)

If there are 2 methods matching this hex-signature they will be separated by semicolon(";").

You can also get signatures with parameter names. Note that collisions will be higher here as people can use different parameter names and the parameter names do not change the signature. In the example before:

> curl https://raw.githubusercontent.com/ethereum-lists/4bytes/master/with_parameter_names/a9059cbb

will result in:

transfer(address _to,uint256 _value);transfer(address to,uint val)

So please also a plea to all smart contract developers. Please try to check if there are methods with similar signatures and think if you could use the same parameter names to have better UX in the consuming side.

To add your own signatures ideally verify your sourcecode via sourcify You can also use the 4ByteBot - or enter them manually on the 4byte.directory. But verified source-code is the preferred option here.

4bytes's People

Contributors

dependabot[bot] avatar evertonfraga avatar holiman avatar ligi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

4bytes's Issues

Event signatures

Are there any plans to add a similar database for event signatures?

Bad duplicate

sig `3ef4f4ca`
 - world(uint256)
 - hello(int16[15],bytes22[5],int176[8])

I think we can drop the second one?

Topics

I understand this is for four-bytes, and I think that's wonderful, but is there something similar for event topics? It would think that it wouldn't be very much more difficult to add that, and it would be just as useful.

One thing to keep in mind, though, is the 'index' keyword. An event can have an identical topic given its name and list of parameter types, but in one case some of the topics are index and in another they are not. Same 32-byte topic, but you have to decode the data differently. The only way I've figured out to handle this case is if the decoding fails without topics, insert them and try again.

Not really an issue, but I wanted to share this. You can close this if you wish.

Import data from Etherface

Hi there ๐Ÿ‘‹
I'm the author of Etherface, which currently hosts around 2.4 million signatures. One goal of Etherface was to provide these collected signatures back to the community at some point and I think now's a good time. Would you be interested in importing these signatures? If so, I'd be happy to provide a database dump.

Ranking for function signatures.

Here's a starting point for how we might objectively rank function signatures.

  • Let C be the set of all contract addresses which contain bytecode matching the pattern used to JUMPDEST based on the first 4 bytes of the message data.

With just C we can establish a basic ranking for signatures. This ranking is however trivial to game.

  • Let T be the set of all transactions who's first 4 bytes match the signature.

With len(T) or sum(t.gas_price * t.gas for t in T) we should have a less easy to game metric. I suspect that this will be suitable until we find someone directly attacking the rankings at which point we can iterate on this.

Question is, how do we easily get these metrics. I think there is a BigQuery database for most of the chain data that I may be able to get access to, otherwise, maybe someone else knows of a relational database with all the chain data?

struct abi not supported

The Airswap ABI uses the experimental struct abi. For example a struct with uint256 and bytes32 passed as an arg would result in a 4byte hash input like swap((uint256,bytes32)) instead of swap(uint256,bytes32).

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.