|
1 | 1 | # Test Application |
2 | 2 |
|
3 | | -This application serves as an example to help you understand how to create your own application using this framework. It provides a basic implementation that you can use as a reference when building your own solution. |
| 3 | +Reference implementation of a key-value store rollup using ev-node. Includes a KV executor, HTTP server for transaction submission, and a stress test tool targeting 10M req/s. |
4 | 4 |
|
5 | | -## Important Note |
| 5 | +## Build |
6 | 6 |
|
7 | | -When implementing your own application, it's your responsibility to provide the appropriate Executor dependency. This is a crucial component that needs to be properly implemented according to your specific requirements. |
| 7 | +```bash |
| 8 | +# Build the testapp binary |
| 9 | +go build -o testapp . |
| 10 | + |
| 11 | +# Build the stress test tool |
| 12 | +go build -o stress-test ./kv/bench/ |
| 13 | +``` |
8 | 14 |
|
9 | | -## Installation |
| 15 | +## Quick Start |
10 | 16 |
|
11 | | -To install and test the application, you can use the following command: |
| 17 | +You need 3 terminals: one for the local DA, one for the testapp node, and one for the stress test. |
12 | 18 |
|
13 | 19 | ```bash |
14 | | -go build . |
| 20 | +# Terminal 1: Start local DA (defaults to localhost:7980) |
| 21 | +go run ../../tools/local-da |
| 22 | + |
| 23 | +# Terminal 2: Initialize and start the testapp |
| 24 | +./testapp init --evnode.node.aggregator --evnode.signer.passphrase_file examples/passphrase.txt |
| 25 | +./testapp start --kv-endpoint localhost:9090 --evnode.node.aggregator --evnode.signer.passphrase_file examples/passphrase.txt |
| 26 | + |
| 27 | +# Terminal 3: Run the stress test |
| 28 | +./stress-test --addr localhost:9090 --duration 10s --workers 10000 |
15 | 29 | ``` |
16 | 30 |
|
17 | | -This will build and install all necessary dependencies for running the test application. |
| 31 | +## Commands |
| 32 | + |
| 33 | +| Command | Description | |
| 34 | +| ------------------ | ------------------------------------- | |
| 35 | +| `testapp init` | Initialize configuration and genesis | |
| 36 | +| `testapp start` | Run the node (aliases: `run`, `node`) | |
| 37 | +| `testapp rollback` | Rollback state by one height | |
| 38 | +| `testapp version` | Show version info | |
| 39 | +| `testapp keys` | Manage signing keys | |
| 40 | +| `testapp net-info` | Get info from a running node via RPC | |
| 41 | + |
| 42 | +### Key Flags for `start` |
18 | 43 |
|
19 | | -## Usage |
| 44 | +| Flag | Description | |
| 45 | +| -------------------------- | ------------------------------------------------- | |
| 46 | +| `--kv-endpoint <addr>` | Enable the KV HTTP server (e.g. `localhost:9090`) | |
| 47 | +| `--evnode.node.aggregator` | Run as aggregator (block producer) | |
| 48 | +| `--evnode.node.block_time` | Block interval (default `1s`) | |
| 49 | +| `--evnode.da.address` | DA layer address | |
| 50 | +| `--home <dir>` | Data directory (default `~/.testapp`) | |
20 | 51 |
|
21 | | -This is a reference implementation. Feel free to explore the code and use it as a starting point for your own application. Make sure to: |
| 52 | +## HTTP Endpoints |
| 53 | + |
| 54 | +When `--kv-endpoint` is set, the following endpoints are available: |
| 55 | + |
| 56 | +| Method | Path | Description | |
| 57 | +| ------ | --------------- | --------------------------------------------------- | |
| 58 | +| POST | `/tx` | Submit a transaction (`key=value` body) | |
| 59 | +| GET | `/kv?key=<key>` | Retrieve latest value for a key | |
| 60 | +| GET | `/store` | List all key-value pairs | |
| 61 | +| GET | `/stats` | Get injected/executed tx counts and blocks produced | |
| 62 | + |
| 63 | +## Stress Test |
| 64 | + |
| 65 | +```bash |
| 66 | +./stress-test --addr localhost:9090 --duration 10s --workers 1000 |
| 67 | +``` |
22 | 68 |
|
23 | | -1. Review the existing code structure |
24 | | -2. Understand how the Executor is implemented |
25 | | -3. Adapt the implementation to your specific needs |
| 69 | +| Flag | Default | Description | |
| 70 | +| ----------- | ---------------- | ---------------------- | |
| 71 | +| `-addr` | `localhost:9090` | Server host:port | |
| 72 | +| `-duration` | `10s` | Test duration | |
| 73 | +| `-workers` | `1000` | Concurrent TCP workers | |
26 | 74 |
|
27 | | -Remember that this is just an example, and your actual implementation might require different approaches depending on your use case. |
| 75 | +The test sends transactions via raw persistent TCP connections, reports live RPS, and prints a summary table with avg/peak req/s, server-side block stats, and whether the 10M req/s goal was reached. |
0 commit comments