Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a7785fd
fix: refactored state
Mikelle Nov 28, 2024
47f15ca
feat: add relayer/member nodes implementation
Mikelle Dec 8, 2024
a8b5a65
fix: state refactoring
Mikelle Dec 9, 2024
ebac428
fix: deleted vs code settings
Mikelle Dec 9, 2024
64c0383
fix: readme
Mikelle Dec 9, 2024
aeeac1f
Merge branch 'main' into feat/499/member-nodes
Mikelle Dec 9, 2024
d7826c7
fix: fixed fmt
Mikelle Dec 9, 2024
c900aaf
fix: workspace sync
Mikelle Dec 9, 2024
7cc5d6c
fix: lint errors
Mikelle Dec 9, 2024
70ccfff
fix: fixed go race
Mikelle Dec 9, 2024
7fd9e7e
Merge branch 'main' into feat/499/member-nodes
Mikelle Dec 9, 2024
29dd768
Merge branch 'main' into feat/499/member-nodes
Mikelle Dec 10, 2024
74f9b77
feat: rename relayer to streamer
Mikelle Dec 10, 2024
23bb2c9
Merge branch 'main' into feat/499/member-nodes
Mikelle Dec 12, 2024
c361a57
Merge branch 'main' into feat/499/member-nodes
Mikelle Dec 19, 2024
0773a9d
Merge branch 'main' into feat/499/member-nodes
Mikelle Dec 20, 2024
b9f1fdf
Merge branch 'main' into feat/499/member-nodes
Mikelle Jan 9, 2025
5e74201
Merge branch 'main' into feat/499/member-nodes
Mikelle Jan 10, 2025
53b9264
Merge branch 'main' into feat/499/member-nodes
Mikelle Jan 13, 2025
22fe2a5
Merge branch 'main' into feat/499/member-nodes
Mikelle Jan 23, 2025
a170994
Merge branch 'main' into feat/499/member-nodes
Mikelle Jan 29, 2025
f00b4ca
Merge branch 'main' into feat/499/member-nodes
Mikelle Feb 3, 2025
2f6ade3
Merge branch 'main' into feat/499/member-nodes
Mikelle Feb 5, 2025
da35c46
Merge branch 'main' into feat/499/member-nodes
Mikelle Feb 12, 2025
2326215
Merge branch 'main' into feat/499/member-nodes
Mikelle Feb 18, 2025
c389954
Merge branch 'main' into feat/499/member-nodes
Mikelle Mar 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
170 changes: 142 additions & 28 deletions cl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,24 +105,6 @@ geth --verbosity 5 \
- `--syncmode full`: Synchronization mode.
- `--miner.recommit`: Frequency of miner recommit.

### Obtaining the Genesis Block Hash

You can obtain the genesis block hash by querying the latest block after initializing your node:

```bash
cast block latest -r http://localhost:8545
```

Look for the `hash` field in the output, which represents the latest block hash. Since the chain is just initialized, this will be the genesis block hash.

Alternatively, you can use `curl` to get the genesis block hash:

```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x0", false],"id":1}' -H "Content-Type: application/json" http://localhost:8545
```

Extract the `hash` value from the response and use it without `0x`.

## Running Redis

We will use Docker Compose to run Redis.
Expand Down Expand Up @@ -163,29 +145,27 @@ Ensure all dependencies are installed and build the application:

```bash
go mod tidy
go build -o consensus-client main.go
go build -o consensus-client cmd/redisapp/main.go
```

### Configuration
### Consensus Client Configuration

The consensus client can be configured via command-line flags, environment variables, or a YAML configuration file.

#### Command-Line Flags
#### Command-Line Flags for Streamer

- `--instance-id`: **(Required)** Unique instance ID for this node.
- `--eth-client-url`: Ethereum client URL (default: `http://localhost:8551`).
- `--jwt-secret`: JWT secret for Ethereum client.
- `--genesis-block-hash`: Genesis block hash.
- `--redis-addr`: Redis address (default: `127.0.0.1:7001`).
- `--evm-build-delay`: EVM build delay (default: `1s`).
- `--config`: Path to a YAML configuration file.

#### Environment Variables
#### Environment Variables for Consensus Client

- `RAPP_INSTANCE_ID`
- `RAPP_ETH_CLIENT_URL`
- `RAPP_JWT_SECRET`
- `RAPP_GENESIS_BLOCK_HASH`
- `RAPP_REDIS_ADDR`
- `RAPP_EVM_BUILD_DELAY`
- `RAPP_CONFIG`
Expand All @@ -199,25 +179,22 @@ Run the client using command-line flags:
--instance-id "node1" \
--eth-client-url "http://localhost:8551" \
--jwt-secret "your_jwt_secret" \
--genesis-block-hash "your_genesis_block_hash" \
--redis-addr "127.0.0.1:7001" \
--evm-build-delay "1s"
```

**Note**:

- Replace `"your_jwt_secret"` with the actual JWT secret you used earlier.
- Replace `"your_genesis_block_hash"` with the genesis block hash obtained earlier.

### Using a Configuration File
### Using a Configuration File for Consensus Client

Create a `config.yaml` file:

```yaml
instance-id: "node1"
eth-client-url: "http://localhost:8551"
jwt-secret: "your_jwt_secret"
genesis-block-hash: "your_genesis_block_hash"
redis-addr: "127.0.0.1:7001"
evm-build-delay: "1s"
```
Expand All @@ -232,6 +209,143 @@ Run the client with the configuration file:

- **Multiple Instances**: You can run multiple instances of the consensus client by changing the `--instance-id` and `--eth-client-url` parameters.

## Running the Streamer

The Streamer is responsible for streaming payloads to member nodes, allowing them to apply these payloads to their respective Geth instances.

### Build the Streamer

Ensure all dependencies are installed and build the Streamer application:

```bash
go mod tidy
go build -o streamer cmd/streamer/main.go
```

### Streamer Configuration

The Streamer can be configured via command-line flags, environment variables, or a YAML configuration file.

#### Command-Line Flags

- `--config`: Path to config file.
- `--redis-addr`: Redis address (default: 127.0.0.1:7001).
- `--listen-addr`: Streamer listen address (default: :50051).
- `--log-fmt`: Log format to use, options are text or json (default: text).
- `--log-level`: Log level to use, options are debug, info, warn, error (default: info).

#### Environment Variables

- `STREAMER_CONFIG`
- `STREAMER_REDIS_ADDR`
- `STREAMER_LISTEN_ADDR`
- `STREAMER_LOG_FMT`
- `STREAMER_LOG_LEVEL`

#### Run the Streamer

Run the Streamer using command-line flags:

```bash
./streamer start \
--config "config.yaml" \
--redis-addr "127.0.0.1:7001" \
--listen-addr ":50051" \
--log-fmt "json" \
--log-level "info"
```

#### Using a Configuration File for Streamer

Create a `streamer_config.yaml` file:

```yaml
redis-addr: "127.0.0.1:7001"
listen-addr: ":50051"
log-fmt: "json"
log-level: "info"
```

Run the Streamer with the configuration file:

```bash
./streamer start --config streamer_config.yaml
```

## Running member nodes

Member nodes connect to the Streamer to receive payloads from the stream and apply them to their Geth instances.

### Build the Member Client

Ensure all dependencies are installed and build the Member Client application:

```bash
go mod tidy
go build -o memberclient cmd/member/main.go
```

### Configuration

The Member Client can be configured via command-line flags, environment variables, or a YAML configuration file.

### Command-Line Flags for Member Client

- `--config`: Path to config file.
- `--client-id`: (Required) Unique client ID for this member.
- `--streamer-addr`: (Required) Streamer address.
- `--eth-client-url`: Ethereum client URL (default: <http://localhost:8551>).
- `--jwt-secret`: JWT secret for Ethereum client.
- `--log-fmt`: Log format to use, options are text or json (default: text).
- `--log-level`: Log level to use, options are debug, info, warn, error (default: info).

### Environment Variables for Member Client

- `MEMBER_CONFIG`
- `MEMBER_CLIENT_ID`
- `MEMBER_STREAMER_ADDR`
- `MEMBER_ETH_CLIENT_URL`
- `MEMBER_JWT_SECRET`
- `MEMBER_LOG_FMT`
- `MEMBER_LOG_LEVEL`

### Run the Member Client

Run the Member Client using command-line flags:

```bash
./memberclient start \
--client-id "member1" \
--streamer-addr "http://localhost:50051" \
--eth-client-url "http://localhost:8551" \
--jwt-secret "your_jwt_secret" \
--log-fmt "json" \
--log-level "info"
```

Note:

Replace "your_jwt_secret" with the actual JWT secret you used earlier.

### Using a Configuration File

Create a member_config.yaml file:

```yaml
client-id: "member1"
streamer-addr: "http://localhost:50051"
eth-client-url: "http://localhost:8551"
jwt-secret: "your_jwt_secret"
log-fmt: "json"
log-level: "info"
```

Run the Member Client with the configuration file:

```bash
./memberclient start --config member_config.yaml
```

## Conclusion

You now have a local Ethereum environment with Geth nodes, Redis, and a consensus client.
Loading
Loading