-
Notifications
You must be signed in to change notification settings - Fork 286
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
4 changed files
with
224 additions
and
15 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
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,122 @@ | ||
# Celestia `txsim` Docker Image Usage Guide | ||
|
||
The `txsim` binary is a tool that can be used to simulate transactions on the Celestia network. It can be used to test the performance of the Celestia network. | ||
This guide provides instructions on how to use the Celestia `txsim` Docker image. The `txsim` Docker image is designed to run the `txsim` binary with a variety of configurable options. | ||
|
||
# Table of Contents | ||
|
||
1. [Prerequisites](#prerequisites) | ||
2. [Running the Docker Image](#running-the-docker-image) | ||
- [Docker Run](#docker-run) | ||
- [Docker Compose](#docker-compose) | ||
- [Kubernetes Deployment](#kubernetes-deployment) | ||
3. [Flag Breakdown](#flag-breakdown) | ||
|
||
## Prerequisites | ||
|
||
Before you can use the `txsim` Docker image, you must have a prefunded account set up. The `txsim` binary requires a prefunded account to function correctly. The keyring for this account should be stored in a file that can be accessed by the Docker container. | ||
|
||
## Running the Docker Image | ||
|
||
### Docker Run | ||
|
||
You can run the `txsim` Docker image using the `docker run` command. Here's an example: | ||
|
||
```bash | ||
docker run -it -v /Users/txsimp/.celestia-app:/home/celestia ghcr.io/celestiaorg/txsim -k 0 -r http://consensus-validator-robusta-rc6.celestia-robusta.com:26657,http://consensus-full-robusta-rc6.celestia-robusta.com:26657 -g consensus-validator-robusta-rc6.celestia-robusta.com:9090 -t 10s -b 10 -d 100 -e 10 | ||
``` | ||
|
||
In this command, the `-v` option is used to mount the `/Users/txsimp/.celestia-app` directory from the host to the `/home/celestia` directory in the Docker container. This allows the `txsim` binary to access the keyring for the prefunded account. | ||
|
||
### Docker Compose | ||
|
||
You can also run the `txsim` Docker image using Docker Compose. Here's an example `docker-compose.yml` file: | ||
|
||
```yaml | ||
version: '3' | ||
services: | ||
txsim: | ||
image: ghcr.io/celestiaorg/txsim | ||
command: > | ||
-k 0 | ||
-r http://consensus-validator-robusta-rc6.celestia-robusta.com:26657,http://consensus-full-robusta-rc6.celestia-robusta.com:26657 | ||
-g consensus-validator-robusta-rc6.celestia-robusta.com:9090 | ||
-t 10s | ||
-b 10 | ||
-d 100 | ||
-e 10 | ||
volumes: | ||
- /Users/txsimp/.celestia-app:/home/celestia | ||
``` | ||
In this file, the `volumes` key is used to mount the `/Users/txsimp/.celestia-app` directory from the host to the `/home/celestia` directory in the Docker container. | ||
|
||
### Kubernetes Deployment | ||
|
||
Finally, you can run the `txsim` Docker image in a Kubernetes cluster. Here's an example `deployment.yaml` file: | ||
|
||
```yaml | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: txsim-deployment | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: txsim | ||
template: | ||
metadata: | ||
labels: | ||
app: txsim | ||
spec: | ||
containers: | ||
- name: txsim | ||
image: ghcr.io/celestiaorg/txsim | ||
args: | ||
- "-k" | ||
- "0" | ||
- "-r" | ||
- "http://consensus-validator-robusta-rc6.celestia-robusta.com:26657,http://consensus-full-robusta-rc6.celestia-robusta.com:26657" | ||
- "-g" | ||
- "consensus-validator-robusta-rc6.celestia-robusta.com:9090" | ||
- "-t" | ||
- "10s" | ||
- "-b" | ||
- "10" | ||
- "-d" | ||
- "100" | ||
- "-e" | ||
- "10" | ||
volumeMounts: | ||
- name: keyring-volume | ||
mountPath: /home/celestia | ||
volumes: | ||
- name: keyring-volume | ||
hostPath: | ||
path: /Users/txsimp/.celestia-app | ||
``` | ||
|
||
In this file, the `volumeMounts` and `volumes` keys are used to mount the `/Users/txsimp/.celestia-app` directory from the host to the `/home/celestia` directory in the Docker container. | ||
|
||
## Flag Breakdown | ||
|
||
Here's a breakdown of what each flag means: | ||
|
||
- `-k`: Whether a new key should be created (1 for yes, 0 for no) | ||
- `-p`: The path to the keyring for the prefunded account | ||
- `-r`: The RPC endpoints for the `txsim` binary | ||
- `-g`: The gRPC endpoints for the `txsim` binary | ||
- `-t`: The poll time for the `txsim` binary | ||
- `-b`: The number of blob sequences to run | ||
- `-a`: The range of blobs to send per PFB in a sequence | ||
- `-s`: The range of blob sizes to send | ||
- `-m`: The mnemonic for the keyring | ||
- `-d`: The seed for the random number generator | ||
- `-e`: The number of send sequences to run | ||
- `-i`: The amount to send from one account to another | ||
- `-v`: The number of send iterations to run per sequence | ||
- `-u`: The number of stake sequences to run | ||
- `-w`: The amount of initial stake per sequence | ||
|
||
Please replace the placeholders in the examples with the actual values you want to use. |
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,15 +1,98 @@ | ||
#!/bin/bash | ||
|
||
if [ "$1" = 'create-key' ]; then | ||
CREATE_KEY=0 | ||
KEY_PATH="/home/celestia" | ||
RPC_ENDPOINTS="" | ||
GRPC_ENDPOINTS="" | ||
POLL_TIME="" | ||
BLOB=0 | ||
BLOB_AMOUNTS="1" | ||
BLOB_SIZES="100-1000" | ||
KEY_MNEMONIC="" | ||
SEED=0 | ||
SEND=0 | ||
SEND_AMOUNT=1000 | ||
SEND_ITERATIONS=1000 | ||
STAKE=0 | ||
STAKE_VALUE=1000 | ||
|
||
while getopts "k:p:r:g:t:b:a:s:m:d:e:i:v:u:w:" opt; do | ||
case ${opt} in | ||
k ) | ||
CREATE_KEY=$OPTARG | ||
;; | ||
p ) | ||
KEY_PATH=$OPTARG | ||
;; | ||
r ) | ||
RPC_ENDPOINTS=$OPTARG | ||
;; | ||
g ) | ||
GRPC_ENDPOINTS=$OPTARG | ||
;; | ||
t ) | ||
POLL_TIME=$OPTARG | ||
;; | ||
b ) | ||
BLOB=$OPTARG | ||
;; | ||
a ) | ||
BLOB_AMOUNTS=$OPTARG | ||
;; | ||
s ) | ||
BLOB_SIZES=$OPTARG | ||
;; | ||
m ) | ||
KEY_MNEMONIC=$OPTARG | ||
;; | ||
d ) | ||
SEED=$OPTARG | ||
;; | ||
e ) | ||
SEND=$OPTARG | ||
;; | ||
i ) | ||
SEND_AMOUNT=$OPTARG | ||
;; | ||
v ) | ||
SEND_ITERATIONS=$OPTARG | ||
;; | ||
u ) | ||
STAKE=$OPTARG | ||
;; | ||
w ) | ||
STAKE_VALUE=$OPTARG | ||
;; | ||
\? ) | ||
echo "Invalid option: $OPTARG" 1>&2 | ||
exit 1 | ||
;; | ||
: ) | ||
echo "Invalid option: $OPTARG requires an argument" 1>&2 | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
shift $((OPTIND -1)) | ||
|
||
if [ "$CREATE_KEY" -eq 1 ]; then | ||
echo "Creating a new keyring-test for the txsim" | ||
exec /bin/celestia-appd keys add sim --keyring-backend test --home /home/celestia | ||
/bin/celestia-appd keys add sim --keyring-backend test --home $KEY_PATH | ||
sleep 5 | ||
fi | ||
|
||
# TODO: This is a temporary solution to get the txsim working | ||
# Please define your own entrypoint.sh when running a txsim's dockerimage | ||
txsim --help | ||
|
||
# example of running a txsim on robusta chain | ||
# txsim --key-path /home/celestia \ | ||
# --rpc-endpoints http://consensus-validator-robusta-rc6.celestia-robusta.com:26657,http://consensus-full-robusta-rc6.celestia-robusta.com:26657 \ | ||
# --grpc-endpoints consensus-validator-robusta-rc6.celestia-robusta.com:9090 --poll-time 10s --blob 10 --seed 100 --send 10 --stake 2 | ||
# Running a txsim on robusta chain | ||
txsim --key-path $KEY_PATH \ | ||
--rpc-endpoints $RPC_ENDPOINTS \ | ||
--grpc-endpoints $GRPC_ENDPOINTS \ | ||
--poll-time $POLL_TIME \ | ||
--blob $BLOB \ | ||
--blob-amounts $BLOB_AMOUNTS \ | ||
--blob-sizes $BLOB_SIZES \ | ||
--key-mnemonic "$KEY_MNEMONIC" \ | ||
--seed $SEED \ | ||
--send $SEND \ | ||
--send-amount $SEND_AMOUNT \ | ||
--send-iterations $SEND_ITERATIONS \ | ||
--stake $STAKE \ | ||
--stake-value $STAKE_VALUE |