-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
1,213 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
aiohttp==3.6.2 | ||
websockets==8.1 | ||
pyhumps==1.6.1 | ||
web3==5.10.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# Compare On Block Feeds | ||
|
||
compare_eth_on_block_feed.py is a script that compares the performance of the bloXroute ethOnBlock feed | ||
offered by the bloXroute Gateway or Cloud API against custom implementation with an Ethereum node's feeds. | ||
|
||
Example statistics output: | ||
|
||
```` | ||
Started feed comparison. Duration: 600s | ||
Start: 2020-10-11 18:02:03.410172, End: 2020-10-11 18:12:05.430070 | ||
Blocks seen in duration: 47 | ||
Number of blocks with results: 46 | ||
Number of results from Blxr first: 42 | ||
Number of results from Eth first: 4 | ||
Percentage of results seen first from gateway: 91.30% | ||
Average time difference for results received first from Blxr (ms): 2067.04 | ||
Average time difference for results received first from Eth (ms): 1285.99 | ||
```` | ||
|
||
# Installing and setting up | ||
|
||
Install bloxroute-cli with the following command: | ||
```` | ||
pip install bloxroute-cli | ||
```` | ||
|
||
To enable websocket RPC on your Gateway, use the following parameters: | ||
``` | ||
--ws True --ws-host <IP address of client application> --ws-port 28333 | ||
``` | ||
|
||
Add the following parameter to have your Gateway connect to your Ethereum | ||
node's websocket server: | ||
``` | ||
--eth-ws-uri ws://<eth node IP address>:8546 | ||
``` | ||
|
||
To enable websocket RPC on your Ethereum node, use the following parameters: | ||
``` | ||
--ws --wsaddr <gateway IP address> --wsapi eth --wsport 8546 | ||
``` | ||
|
||
Ensure you are running with Python 3.7 or later. | ||
|
||
# Arguments | ||
|
||
Example command: | ||
|
||
``` | ||
python compare_eth_on_block_feed.py --gateway ws://127.0.0.1:28333 --eth ws://127.0.0.1:8546 --duration 600 | ||
``` | ||
|
||
Use `--gateway` to specify URL of the Gateway running with websocket RPC enabled. | ||
|
||
Default: ws://127.0.0.1:28333 | ||
|
||
Use `--eth` to specify URL of an Ethereum node running with websocket RPC enabled. | ||
|
||
Default: ws://127.0.0.1:8546 | ||
|
||
Use `--duration` to set the total duration of the test in seconds. | ||
|
||
Default: 600 | ||
|
||
Use `--gateway-type` to indicate if you would like to use the bloXroute Cloud API websocket endpoint or | ||
a local bloXroute Gateway endpoint. If set to Cloud, you must also use the --ssl-dir argument. | ||
|
||
Options: Cloud, Local | ||
|
||
Default: Cloud | ||
|
||
Use `--ssl-dir` to specify the path to your bloXroute certificates if `--gateway-type` is Cloud. | ||
|
||
Example: --ssl-dir /home/user/ssl/external_gateway/registration_only | ||
|
||
Use `--call-params-file` to specify the EthCall commands source file to be executed by the subscription. | ||
It is recommended to run with the `--debug` flag, in order to verify that the commands are valid. | ||
|
||
Default: on_block_feed_call_params_example.json | ||
|
||
Use the `--verbose` flag to print extra information. | ||
|
||
Use the `--debug` flag to log debug information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Compare Transaction Speed | ||
|
||
`compare_tx_speed.py` is a script that compares the performance of sending raw transactions with bloXroute Cloud-API and | ||
other service providers -- Alchemy and Infura. | ||
|
||
Example statistics output: | ||
``` | ||
Initial check completed. Sleeping 30 sec. | ||
Sending tx group 1. | ||
2020-10-20 23:27:24.255892 - Sending transaction to https://mainnet.infura.io/v3/XXXXXXXXXX. TX Hash: XXXXXXXXXX | ||
2020-10-20 23:27:24.257892 - Sending transaction to https://eth-mainnet.alchemyapi.io/v2/XXXXXXXXXX. TX Hash: XXXXXXXXXX | ||
2020-10-20 23:27:24.258892 - Sending transaction to bloXroute Cloud-API. TX Hash: XXXXXXXXXX | ||
Sleeping 30 sec. | ||
Sending tx group 2. | ||
2020-10-20 23:27:54.417183 - Sending transaction to https://mainnet.infura.io/v3/XXXXXXXXXX. TX Hash: XXXXXXXXXX | ||
2020-10-20 23:27:54.418183 - Sending transaction to https://eth-mainnet.alchemyapi.io/v2/XXXXXXXXXX. TX Hash: XXXXXXXXXX | ||
2020-10-20 23:27:54.419183 - Sending transaction to bloXroute Cloud-API. TX Hash: XXXXXXXXXX | ||
Sleeping 1 min before checking transaction status. | ||
--------------------------------------------------------------------------------------------------------- | ||
Summary: | ||
Sent 2 groups of transactions to bloXroute Cloud-API and other providers, 2 of them have been confirmed: | ||
Number of Alchemy transactions mined: 0 | ||
Number of Infura transactions mined: 0 | ||
Number of bloXrotue transactions mined: 2 | ||
``` | ||
|
||
# Installation | ||
Install bloxroute-cli with the following command: | ||
```` | ||
pip install bloxroute-cli | ||
```` | ||
|
||
Example startup command: | ||
``` | ||
python compare_tx_speed.py --alchemy-api-key XXXXXXXX --infura-api-key XXXXXXXXX --blxr-auth-header XXXXXXXXXX \ | ||
--sender-private-key 0xabcdXXXX --receiver-address 0xabcdXXXX --gas-price 33 --num-tx-groups 2 | ||
``` | ||
|
||
# Arguments | ||
`--alchemy-api-key`: Alchemy API key. Please visit https://alchemyapi.io/ for more information. | ||
|
||
`--infura-api-key`: Infura API key / project ID. Please visit https://infura.io/ for more information. | ||
|
||
`--blxr-auth-header`: bloXroute authorization header. Use base64 encoded value of account_id:secret_hash for Cloud-API. | ||
Please visit https://bloxroute.com/docs/bloxroute-documentation/cloud-api/overview/ for more information. | ||
|
||
`--sender-private-key`: Private key of the Ethereum sender, which is required in order to sign transactions. | ||
|
||
`--receiver-address`: Address of the transaction receiver. | ||
|
||
`--gas-price`: Gas price (in Gwei) of the transactions. | ||
|
||
`--num-tx-groups`: Number of groups of transactions to be sent. Default: 1. | ||
|
||
`--delay`: Time (in sec) to sleep between two consecutive groups. Default: 30. |
Oops, something went wrong.