GithubHelp home page GithubHelp logo

storage-layout's Introduction

storage layout

a tool to get readable state diffs and enumerate complete contract storage

🚧 status: proof of concept 🚧

usage

  • storage-layout storage <contract> print all slots and values
  • storage-layout layout <txhash> print a decoded state diff

how it works

  1. get storage layout of a contract, which comes as one of compiler output format. here i use a modified vyper compiler with a test contract.
  2. get storage diff, here i use trace_replayTransaction in stateDiff mode. this is not strictly necessary since you can get all SSTORE from vmTrace.
  3. extract preimages from a trace. we look for all SHA3 calls which hash two words and write down key and slot.
  4. then we unwrap storage slots using preimages we have collected until we reach basic storage indexes we have in the layout. for exmaple, a slot value for mapping could be among preimages, we record a path we traversed to construct nested keys.
  5. decode abi types using metadata from contract storage layout.

further research

how to dump the complete contract storage and print it in a readable way.

this tool can already dump the entire storage using parity_listStorageKeys, but to decode it we need to collect all preimages.

for this we can find all calls to the address using trace_filter and then vmTrace all transactions and record all preimages.

related work

storage-layout's People

Contributors

banteg avatar

Stargazers

omnifient avatar  avatar Mojtaba Eshghie avatar Philip Glazman avatar Rahmat avatar Junho Yeo avatar  avatar  avatar Fre avatar  avatar GorrilaObserver avatar EulerLagrange.eth avatar geoffhorwitz.eth  avatar sam bacha avatar  avatar Roman Sivakov avatar Vinh Quốc Nguyễn avatar Jonny Dubowsky avatar Philippe Gonday avatar xiaodao avatar Alex avatar  avatar Max Amanshauser avatar bin avatar plotchy avatar didadi avatar s7v7nislands avatar Etch avatar Nick Beattie avatar 0xhatsume avatar clandestine.eth avatar Steve Ellis avatar Yixun Chen avatar MeTony avatar ljmanini avatar Rinor Hoxha avatar Keshav Mundhra avatar hanhx avatar yashwant.eth avatar wiasliaw avatar Pavel avatar emma avatar  avatar  avatar Mark Milner avatar  avatar eli krenzke avatar Pran avatar Nikolay avatar Aleksei Potapkin avatar KRogLA avatar Wei Wu avatar andnasnd avatar Haile avatar indigo avatar green avatar jiangplus avatar Varun Srinivasan avatar  avatar  avatar Aliaksei avatar Vasiliy Yorkin avatar  avatar Roman Böhringer avatar Sebastian T F avatar amanusk avatar Sean Luke avatar 0xYYY avatar Gilgameš avatar  avatar Stephen Byrne avatar  avatar evalir avatar kaden avatar Brett Henderson avatar nicolas avatar FoolishEddy avatar Andrej avatar Richard Guan avatar lIlIly avatar DeGatchi avatar Will Pankiewicz avatar Less avatar 0xicingdeath avatar Alessio Delmonti avatar Orland0x avatar Async avatar  avatar Luigi avatar 8x4 avatar natzuu avatar michael1011 avatar Francesco avatar chalex.eth avatar Emiliano Bonassi avatar Paco avatar Sabnock avatar Stan Chang Khin Boon avatar Micha Hernandez van Leuffen avatar  avatar

Watchers

Rinor Hoxha avatar  avatar  avatar  avatar

storage-layout's Issues

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.