Coder Social home page Coder Social logo

henrykash / block_simulation_script Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 138 KB

- Have you ever wondered how transactions are ordered in a block when miners gets them from the mempool ? Dont worry I was also curious and this script helps us do some digging...

TypeScript 100.00%

block_simulation_script's Introduction

block_simulation_script

  • Have you ever wondered how transactions are ordered in a block when miners gets them from the mempool ? Dont worry I was also curious and this script helps us do some digging. This project is for learning purposes especially if you are exploring MEV and transactions ordering. The project has to files:
    1. Getting a new block through a JSON_RPC provider

    2. Getting a block by listening to new block using websockest provider...

Exploration on transaction ordering in a BLOCK in blockchain

  • Getting all transactions on a particular block
  • Ordering the transactions on the basis of highest to lowest gas
  • Getting the hash of each transaction on the block and decode to extract useful information i.e token, amount, router etc

We use the provider to access the following function which returns a promise with all transactions in the block

provider.getBlockWithTransactions( block ) โ‡’ Promise< BlockWithTransactions >source Get the block from the network, where the result.transactions is an Array of TransactionResponse objects.

Project Setup & Installation

  • to install dependencies run npm install
  • to run the script use command npm run start

block_simulation_script's People

Contributors

henrykash avatar

Stargazers

TheRealinvisible avatar 0x2c3a452039ebb9ae053a692510221d46716c553caac178b9a37d330586a433ae avatar

Watchers

 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.