|
| 1 | +# blob-archiver-rs |
| 2 | +This is a Rust implementation of |
| 3 | +the [Beacon Chain blob archiver](https://github.com/base/blob-archiver) |
| 4 | + |
| 5 | +The Blob Archiver is a service to archive and allow querying of all historical blobs from the beacon chain. It consists |
| 6 | +of two components: |
| 7 | + |
| 8 | +* **Archiver** - Tracks the beacon chain and writes blobs to a storage backend |
| 9 | +* **API** - Implements the blob sidecars [API](https://ethereum.github.io/beacon-APIs/#/Beacon/getBlobSidecars), which |
| 10 | + allows clients to retrieve blobs from the storage backend |
| 11 | + |
| 12 | +### Storage |
| 13 | +There are currently two supported storage options: |
| 14 | + |
| 15 | +* On-disk storage - Blobs are written to disk in a directory |
| 16 | +* S3 storage - Blobs are written to an S3 bucket (or compatible service) |
| 17 | + |
| 18 | +You can control which storage backend is used by setting the `STORAGE_TYPE` to |
| 19 | +either `file` or `s3`. |
| 20 | + |
| 21 | +The `s3` backend will also work with (for example) Google Cloud Storage buckets (instructions [here](https://medium.com/google-cloud/using-google-cloud-storage-with-minio-object-storage-c994fe4aab6b)). |
| 22 | + |
| 23 | +### Development |
| 24 | +```sh |
| 25 | +# Run the tests |
| 26 | +cargo test --workspace --all-features --all-targets --locked |
| 27 | + |
| 28 | +# Lint the project |
| 29 | +cargo clippy --workspace --all-targets --all-features -- -D warnings |
| 30 | + |
| 31 | +# Build the project |
| 32 | +cargo build --workspace --all-targets --all-features |
| 33 | + |
| 34 | +``` |
| 35 | + |
| 36 | +#### Run Locally |
| 37 | +To run the project locally, you should first copy `.env.template` to `.env` and then modify the environment variables |
| 38 | +to your beacon client and storage backend of choice. Then you can run the project with: |
| 39 | + |
| 40 | +```sh |
| 41 | +docker compose up |
| 42 | +``` |
| 43 | + |
| 44 | +## Options |
| 45 | + |
| 46 | +### `verbose` |
| 47 | + |
| 48 | + |
| 49 | +```shell |
| 50 | +--verbose=<VERBOSE> |
| 51 | +``` |
| 52 | + |
| 53 | +```shell |
| 54 | +--verbose=2 |
| 55 | +``` |
| 56 | + |
| 57 | +### `log_dir` |
| 58 | + |
| 59 | +```shell |
| 60 | +--log_dir=<LOG_DIR> |
| 61 | +``` |
| 62 | +```shell |
| 63 | +--log_dir=/var/log/blob-archiver |
| 64 | +``` |
| 65 | + |
| 66 | +### `log_rotation` |
| 67 | + |
| 68 | +```shell |
| 69 | +--log_rotation=<LOG_ROTATION> |
| 70 | +``` |
| 71 | +```shell |
| 72 | +--log_rotation=DAILY |
| 73 | +``` |
| 74 | +### `beacon_endpoint` |
| 75 | + |
| 76 | +```shell |
| 77 | +--beacon_endpoint=<BEACON_ENDPOINT> |
| 78 | +``` |
| 79 | +```shell |
| 80 | +--beacon_endpoint=http://localhost:5052 |
| 81 | +``` |
| 82 | + |
| 83 | +### `beacon_client_timeout` |
| 84 | + |
| 85 | +```shell |
| 86 | +--beacon_client_timeout=<BEACON_CLIENT_TIMEOUT> |
| 87 | +``` |
| 88 | +```shell |
| 89 | +--beacon_client_timeout=10 |
| 90 | +``` |
| 91 | + |
| 92 | +### `poll_interval` |
| 93 | + |
| 94 | +```shell |
| 95 | +--poll_interval=<POLL_INTERVAL> |
| 96 | +``` |
| 97 | +```shell |
| 98 | +--poll_interval=6 |
| 99 | +``` |
| 100 | + |
| 101 | +### `listen_addr` |
| 102 | + |
| 103 | +```shell |
| 104 | +--listen_addr=<LISTEN_ADDR> |
| 105 | +``` |
| 106 | +```shell |
| 107 | +--listen_addr=0.0.0.0:8000 |
| 108 | +``` |
| 109 | + |
| 110 | +### `origin_block` |
| 111 | + |
| 112 | +```shell |
| 113 | +--origin_block=<ORIGIN_BLOCK> |
| 114 | +``` |
| 115 | +```shell |
| 116 | +--origin_block="0x0" |
| 117 | +``` |
| 118 | + |
| 119 | +### `storage_type` |
| 120 | + |
| 121 | +```shell |
| 122 | +--storage_type=<STORAGE_TYPE> |
| 123 | +``` |
| 124 | +```shell |
| 125 | +--storage_type="s3" |
| 126 | +``` |
| 127 | + |
| 128 | +### `s3_endpoint` |
| 129 | + |
| 130 | +```shell |
| 131 | +--s3_endpoint=<S3_ENDPOINT> |
| 132 | +``` |
| 133 | +```shell |
| 134 | +--s3_endpoint="http://localhost:9000" |
| 135 | +``` |
| 136 | + |
| 137 | +### `s3_bucket` |
| 138 | +```shell |
| 139 | +--s3_bucket=<S3_BUCKET> |
| 140 | +``` |
| 141 | +```shell |
| 142 | +--s3_bucket="blobs" |
| 143 | +``` |
| 144 | + |
| 145 | +### `s3_path` |
| 146 | + |
| 147 | +```shell |
| 148 | +--s3_path=<S3_PATH> |
| 149 | +``` |
| 150 | +```shell |
| 151 | +--s3_path=/blobs |
| 152 | +``` |
| 153 | + |
| 154 | +### `s3_compress` |
| 155 | + |
| 156 | +```shell |
| 157 | +--s3_compress=<S3_COMPRESS> |
| 158 | +``` |
| 159 | +```shell |
| 160 | +--s3_compress=false |
| 161 | +``` |
| 162 | + |
| 163 | +### `fs_dir` |
| 164 | + |
| 165 | +```shell |
| 166 | +--fs_dir=<FS_DIR> |
| 167 | +``` |
| 168 | +```shell |
| 169 | +--fs_dir=/blobs |
| 170 | +``` |
| 171 | + |
0 commit comments