GithubHelp home page GithubHelp logo

wdshin / starknet_tendermint_sequencer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lambdaclass/starknet_tendermint_sequencer

0.0 0.0 0.0 48.93 MB

Starknet sequencer built with Tendermint Core

License: Apache License 2.0

Shell 0.25% Python 49.20% Go 1.90% Rust 45.17% Makefile 3.04% Cairo 0.44%

starknet_tendermint_sequencer's Introduction

Note: main branch contains the development version of the sequencer, for rollups integration please check branch rollups

Tendermint-based Starknet sequencer

Sequencer for Starknet based in CometBFT (formerly Tendermint Core) and starknet-in-rust.

Getting started

First, install CometBFT:

make consensus_install

This will install CometBFT and leave the binary in bin/comebft. Additionally, it will run cometbft init which creates the required configuration file and stores it in ~/.cometbft/.

You can now run the sequencer ABCI with CometBFT by just running those two binaries.

Run CometBFT node on a terminal:

make node

Run the ABCI sequencer application:

make abci

In order to reset CometBFT's state before rerunning it, make sure you run make reset

Sending a transaction

To send executions to the sequencer you need to have a compiled Cairo program (*.json files in the repo). Then you can send them like so:

cargo run --release execute sequencer/programs/fibonacci.json main

Running Tendermint Core instead of CometBFT

Current code can be run with both Tendermint and CometBFT (up to version 0.34.27). In order to use Tendermint Core the make command should include the CONSENSUS variable:

make node CONSENSUS=tendermint

This will run Tendermint Core instead of CometBFT (and also will install and configure it if not present).

Benchmark

You can run a benchmark with

cd sequencer
cargo run --release --bin bench -- --nodes "{list-of-nodes}" --threads 4 --transactions-per-thread 1000

Where list-of-nodes is a list of addresses that are part of the Tendermint network (in the form of ipaddr:socket). The benchmark runs fibonacci.json (fib(500)), where requests are sent with a round-robin fashion to the list of nodes, through the number of threads you specify, with the amount of transactions per thread you desire.

Example run

> cargo run --release --bin bench -- --nodes "127.0.0.1:26157 127.0.0.1:26057"

Time it took for all transactions to be delivered: 1308 ms

Note that this is the time for all transactions to return (ie; validation that they have entered the mempool), but no assumptions can be made in terms of transaction finality.

Benchmarking with Tendermint Load Testing Framework

There is an alternate way to benchmark the app: using tm-load-test. In order to do that there is a load_test command written in go in /bench directory. This needs Go v1.12 at least to be built.

To build it:

cd bench
go build -o ./build/load_test ./cmd/load_test/main.go

and once built move back to root directory and use

./bench/build/load_test -c 10 -T 10 -r 1000 -s 250 --broadcast-tx-method async --endpoints ws://localhost:26657/websocket --stats-output result.csv

to run it against a local tendermint+abci node.

-c is the amount of connectios per endpoint

-T is the amount of seconds to run the test

-r is the rate of tx per second to send

-s is the maximum size of a transaction to be sent.

Run

./bench/build/load_test -h

to get further information.

In result.csv there will be a summary of the operation. eg:

> cat result.csv
Parameter,Value,Units
total_time,10.875,seconds
total_txs,55249,count
total_bytes,1242747923,bytes
avg_tx_rate,5080.169436,transactions per second
avg_data_rate,114271208.808144,bytes per second

To run it against a cluster, several nodes can be provided in --endpoints parameter. eg:

./bench/build/load_test -c 5 -T 10 -r 1000 -s 250 --broadcast-tx-method async --endpoints ws://5.9.57.45:26657/websocket,ws://5.9.57.44:26657/websocket,ws://5.9.57.89:26657/websocket --stats-output result.csv

Check tm-load-test and Tendermint Load Testing Framework and for more information.

Reference links

Starknet

starknet_tendermint_sequencer's People

Contributors

aminarria avatar elfantasma avatar igamigo avatar klaus993 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.