Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Prev Previous commit
Next Next commit
add doc
  • Loading branch information
chevdor committed Aug 27, 2021
commit b7f447f6f3007d1274c51bf3676d6afc4d9ef378
10 changes: 2 additions & 8 deletions scripts/docker/staking_miner-injected.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# to build on a linux host:
# cargo build --release --lockec -p staking-miner
# cd target/release
# docker build -t taking-miner -f ../../scripts/docker/staking_miner-injected.Dockerfile .

FROM debian:buster-slim

# metadata
Expand Down Expand Up @@ -30,13 +25,12 @@ ENV RUST_BACKTRACE 1
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
libssl1.1 \
ca-certificates \
curl && \
ca-certificates && \
# apt cleanup
apt-get autoremove -y && \
apt-get clean && \
find /var/lib/apt/lists/ -type f -not -name lock -delete; \
useradd -m -u 1000 -U -s /bin/sh -d /polkadot polkadot
useradd -m -u 1000 -U -s /bin/sh
# && \
# mkdir -p /data /polkadot/.local/share && \
# chown -R polkadot:polkadot /data && \
Expand Down
55 changes: 55 additions & 0 deletions utils/staking-miner/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Staking Miner

The staking miner connects to a specified chains and keeps
listening to new Phragmen elections. When the time comes,
it computes its solution and submit it to the chain. Running
the staking-miner requires passing the seed of a funded
account in order to pay the fees for the transactions that
will be sent. At the moment, submitting solutions is not
rewarded.

You can check the help with:
```
staking-miner --help
```

## Building

You can build from the root of the Polkadot repository using:
```
cargo build --release --locked --package staking-miner
```

## Docker

### Building

You can also use docker on a Linux host from the root of the Polkadot repository after building the binary (see above):
```
docker build -t staking-miner -f scripts/docker/staking_miner-injected.Dockerfile target/release
```

### Running

A Docker container, especially one holding one of your `SEED` should be kept secure. It is recommended running this container in `read-only` mode:

```
docker run --rm -it \
--name staking-miner \
--read-only \
-v /tmp/seed.txt:/seed.txt \
staking-miner \
--account-seed /seed.txt \
--uri wss://your-nodes:9944 \
dry-run
```

There is a [pending PR](https://github.com/paritytech/polkadot/pull/3680) that removes the need to pass the seed as a file. The commend will then become:
```
docker run --rm -it \
--name staking-miner \
--read-only \
-e SEED=0x1234... \
-e URI=wss://your-nodes:9944 \
staking-miner dry-run
```