Giter VIP home page Giter VIP logo

telosevm-translator's Introduction

telosevm translator

Consume nodeos state history endpoint and take and EVM dump.

code "map":

  • src/main.ts - Command line entry point, build main TEVMIndexer object instance from config file or envoinrment vars.
  • src/indexer.ts - Main indexer class file, consumes unordered native block + evm transaction feed and produces an ordered evm block feed with valid hashes.
  • src/ship.ts - State history connector, opens a websocket client to a nodeos state history endpoint and deserializes the raw feed, produces unordered native block feed + evm transactions.
  • src/publisher.ts - Websocket server used to support eth ws rpc calls like newHeads, once a block is assembled in order and written to db we push it on a websocket broadcast.
  • src/handlers.ts - When ship client finds a native transaction that generates an ethereum transaction it calls one of these "handlers" can be one of three.
  • database - Elasticsearch connector with all custom queries we use, like fast gap checking.
  • workers - Implementations of workers used to paralelize deserialization.
  • utils - All kinds of evm, eosio, ship, logging utils.
  • abis - Standard native abis used to deserialize incoming get_block responses.

install & run:

launch elastic:

docker run \
    -itd \
    --rm \
    --network=host \
    --mount type=bind,source="$(pwd)"/elastic,target=/usr/share/elasticsearch/data \
    --env "elastic_username=elastic" \
    --env "elastic_password=password" \
    --env "xpack.security.enabled=false" \
    telosevm-indexer:elastic

launch indexer (manually):

requirements:

node 16

install dependencies

yarn install

compile and run:

npx tsc && node build/main.js

to run via PM2, give it a unique name that makes sense (first install PM2 if not already installed):

npx tsc && pm2 start build/main.js --name telostest-evm15-translator

launch indexer (through docker):

build telosevm-translator docker:

docker build --tag telosevm-indexer:$VERSION .

docker run \
    -it \
    --rm \
    --network=host \
    --env "CHAIN_NAME=telos-testnet" \
    --env "CHAIN_ID=41" \
    --env "TELOS_ENDPOINT=http://mainnet.telos.net" \
    --env "TELOS_WS_ENDPOINT=ws://api2.hosts.caleos.io:8999" \
    --env "EVM_DEPLOY_BLOCK=180841000" \
    --env "EVM_DELTA=57" \
    --env "INDEXER_START_BLOCK=180841000" \
    --env "INDEXER_STOP_BLOCK=4294967295" \
    --env "BROADCAST_HOST=127.0.0.1" \
    --env "BROADCAST_PORT=7300" \
    --env "ELASTIC_NODE=http://localhost:9200" \
    --env "ELASTIC_USERNAME=username" \
    --env "ELASTIC_PASSWORD=password" \
    telosevm-indexer:$VERSION

launch kibana (OPTIONAL):

docker run \
    -itd \
    --rm \
    --network=host \
    --env "ELASTICSEARCH_HOSTS=http://localhost:9200" \
    --env "ELASTICSEARCH_USERNAME=elastic" \
    --env "ELASTICSEARCH_PASSWORD=password" \
    docker.elastic.co/kibana/kibana:7.17.4

telosevm-translator's People

Contributors

aamirpashaa avatar bab3nk0v avatar guilledk avatar igorls avatar jbuice avatar karynemayer avatar poplexity 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.