Skip to content

Benchmark of different API providers on how fast they get a new block

License

Notifications You must be signed in to change notification settings

tomasbanik/block-speed-comparison

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Get new block - ETH benchmark

Simple benchmark of different API endpoints on how fast they get a new block.

Installing dependencies

Execute command:

npm install

Setting up the environment

To run this project, make sure you have set correct API keys for endoints in your .env file. Execute the following command:

cat <<EOT >> .env
ZMOK_PROVIDER_URL=https://api.zmok.io/mainnet/<ZMOK_APP_ID>
ZMOK_WS_PROVIDER_URL=wss://api.zmok.io/mainnet/<ZMOK_APP_ID>
ZMOK_FR_PROVIDER_URL=https://api.zmok.io/fr/<ZMOK_APP_ID>
ZMOK_FR_WS_PROVIDER_URL=wss://api.zmok.io/fr/<ZMOK_APP_ID>
INFURA_PROVIDER_URL=https://mainnet.infura.io/v3/<INFURA_API_KEY>
INFURA_WS_PROVIDER_URL=wss://mainnet.infura.io/ws/v3/<INFURA_API_KEY>
ALCHEMY_PROVIDER_URL=https://eth-mainnet.alchemyapi.io/v2/<ALCHEMY_API_KEY>
ALCHEMY_WS_PROVIDER_URL=wss://eth-mainnet.ws.alchemyapi.io/v2/<ALCHEMY_API_KEY>
MORALIS_PROVIDER_URL=https://speedy-nodes-nyc.moralis.io/<MORALIS_API_KEY>/eth/mainnet
MORALIS_WS_PROVIDER_URL=wss://speedy-nodes-nyc.moralis.io/<MORALIS_API_KEY>/eth/mainnet/ws
EOT

Running the benchmark

To run bechmark, start following command:

npm start

Sample result:

$ npm start
> block-speed-coparison@1.0.0 start
> node start.js

Waiting ...
------------------------------------------------------
New block from ZMOK-WS #12801720 -> WINNER
Waiting ...
Received block from INFURA #12801720, LAG time: 0.095 sec
Received block from ZMOK-FR-WS #12801720, LAG time: 0.129 sec
Received block from ZMOK #12801720, LAG time: 0.177 sec
Received block from ZMOK-FR #12801720, LAG time: 0.333 sec
Waiting ...
Received block from INFURA-WS #12801720, LAG time: 1.173 sec
Waiting ...
Received block from ALCHEMY-WS #12801720, LAG time: 2.123 sec
Waiting ...
Waiting ...
Waiting ...
Waiting ...
Waiting ...
Waiting ...
Waiting ...
Waiting ...
Waiting ...
Waiting ...
Waiting ...
------------------------------------------------------
New block from ZMOK-WS #12801721 -> WINNER
Received block from ZMOK-FR-WS #12801721, LAG time: 0.209 sec
Waiting ...
Received block from INFURA #12801721, LAG time: 0.752 sec
Received block from ZMOK #12801721, LAG time: 0.761 sec
Received block from ZMOK-FR #12801721, LAG time: 0.817 sec
Waiting ...
Received block from ALCHEMY-WS #12801721, LAG time: 2.282 sec
Received block from INFURA-WS #12801721, LAG time: 2.397 sec
Waiting ...
Waiting ...
Waiting ...
Waiting ...
------------------------------------------------------
New block from ZMOK-WS #12801722 -> WINNER
Waiting ...
Received block from INFURA #12801722, LAG time: 0.659 sec
Received block from ZMOK #12801722, LAG time: 0.66 sec
Received block from ZMOK-FR #12801722, LAG time: 0.702 sec
Received block from ZMOK-FR-WS #12801722, LAG time: 1.449 sec
Waiting ...
Received block from INFURA-WS #12801722, LAG time: 1.896 sec
Waiting ...
Received block from ALCHEMY-WS #12801722, LAG time: 2.76 sec
Waiting ...
Waiting ...
Waiting ...

About

Benchmark of different API providers on how fast they get a new block

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 97.2%
  • HTML 2.8%