You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### 🕓 Changelog
This PR adds a complete [Docker](https://www.docker.com) setup, allowing
the script to be run in a _containerised_ environment. It includes a
hardened
[`compose.yaml`](https://docs.docker.com/compose/intro/compose-application-model/#the-compose-file)
file for easy, secure, and reproducible runs.
#### Building the Docker Image
Build the [Docker](https://www.docker.com) image using [Docker
Compose](https://docs.docker.com/compose/):
```console
docker-compose build
```
#### Basic Usage
To run the
[script](https://github.com/pcaversaccio/safe-tx-hashes-util/blob/main/safe_hashes.sh)
using [Docker Compose](https://docs.docker.com/compose/), use the
`compose.yaml` file provided in the repository. The container is named
`safe-tx-hashes-util`.
Example displaying help:
```console
docker-compose run --rm safe-tx-hashes-util --help
```
Example calculating the Safe transaction hashes:
```console
docker-compose run --rm safe-tx-hashes-util --network arbitrum --address 0x111CEEee040739fD91D29C34C33E6B3E112F2177 --nonce 234
```
#### Using Message Files
When calculating off-chain message hashes, you need to provide a local
directory containing your message file. The included `compose.yaml`
configuration mounts the `./data` directory by default.
```console
# First, create a `data` directory and add your message file.
~$ mkdir -p data
~$ echo "Your message content here" > data/message.txt
# Run the container with the mounted directory.
~$ docker-compose run --rm safe-tx-hashes-util \
--network sepolia \
--address 0x657ff0D4eC65D82b2bC1247b0a558bcd2f80A0f1 \
--message /data/message.txt
```
#### With Environment Variables
You can pass environment variables directly via [Docker
Compose](https://docs.docker.com/compose/):
```console
# Disable all formatting.
docker-compose run --rm -e NO_COLOR=true safe-tx-hashes-util \
--network arbitrum \
--address 0x111CEEee040739fD91D29C34C33E6B3E112F2177 \
--nonce 234
```
---------
Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
Co-authored-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
@@ -81,7 +86,7 @@ This Bash [script](./safe_hashes.sh) calculates the Safe transaction hashes by r
81
86
> Ensure that [`cast`](https://github.com/foundry-rs/foundry/tree/master/crates/cast) and [`chisel`](https://github.com/foundry-rs/foundry/tree/master/crates/chisel) are installed locally. For installation instructions, refer to this [guide](https://getfoundry.sh/introduction/installation/). This [script](./safe_hashes.sh) is designed to work with the latest _stable_ versions of [`cast`](https://github.com/foundry-rs/foundry/tree/master/crates/cast) and [`chisel`](https://github.com/foundry-rs/foundry/tree/master/crates/chisel), starting from version [`1.3.5`](https://github.com/foundry-rs/foundry/releases/tag/v1.3.5).
82
87
83
88
> [!TIP]
84
-
> For macOS users, please refer to the [macOS Users: Upgrading Bash](#macos-users-upgrading-bash) section.
89
+
> For macOS users, please refer to the [macOS Users: Upgrading Bash](#macos-users-upgrading-bash) section. Alternatively, you can use the Docker container, which comes pre-installed with all required dependencies. For details, see the [Docker Usage](#docker-usage) section below.
Make sure to replace `BASH_PATH` with the actual path you retrieved in step 1.
201
206
207
+
### Docker Usage
208
+
209
+
Using [Docker](https://www.docker.com), you can run the [script](./safe_hashes.sh) in a containerised environment with all dependencies pre-installed. This is useful if you do not wish to install the required tools locally, or if you are on a system where installation is difficult.
210
+
211
+
#### Building the Docker Image
212
+
213
+
Build the [Docker](https://www.docker.com) image using [Docker Compose](https://docs.docker.com/compose/):
214
+
215
+
```console
216
+
docker-compose build
217
+
```
218
+
219
+
#### Basic Usage
220
+
221
+
To run the [script](./safe_hashes.sh) using [Docker Compose](https://docs.docker.com/compose/), use the [`compose.yaml`](./compose.yaml) file provided in the repository. The container is named `safe-tx-hashes-util`.
222
+
223
+
Example displaying help:
224
+
225
+
```console
226
+
docker-compose run --rm safe-tx-hashes-util --help
227
+
```
228
+
229
+
Example calculating the Safe transaction hashes:
230
+
231
+
```console
232
+
docker-compose run --rm safe-tx-hashes-util --network arbitrum --address 0x111CEEee040739fD91D29C34C33E6B3E112F2177 --nonce 234
233
+
```
234
+
235
+
#### Using Message Files
236
+
237
+
When calculating off-chain message hashes, you need to provide a local directory containing your message file. The included [`compose.yaml`](./compose.yaml) configuration mounts the `./data` directory by default.
238
+
239
+
```console
240
+
# First, create a `data` directory and add your message file.
> Running in a [Docker](https://www.docker.com) container offers isolation, but it is important to always follow the [Security Best Practices](#security-best-practices-for-using-this-script).
265
+
202
266
## Safe Transaction Hashes
203
267
204
268
To calculate the Safe transaction hashes for a specific transaction, you need to specify the `network`, `address`, and `nonce` parameters. An example:
0 commit comments