# Mining on Windows

Mining on Windows require Windows 10 Pro version 2004 or higher version. (Build 19041 and above or Windows 11 Pro).



**Install WSL**

* Open Command Prompt
* Type `wsl - install` on your CMD, then ENTER

**Install Docker**

* Download it from : [https://desktop.docker.com/win/main/amd64/Docker%20Desktop%20Installer.exe](https://desktop.docker.com/win/main/amd64/Docker%20Desktop%20Installer.exe)
* Install it after download finished



**Variable Declaration**

Execute this script line per line&#x20;

```
cd\
```

```
set CHAIN_NAME=berylbit
```

```
set CHAIN_ID=9012
```

```
set NETWORK_ID=9012
```

```
set WORKING_DIR=%CHAIN_NAME%-docker 
```

```
set CONTAINER_NAME_PREFIX=%CHAIN_NAME%-node 
```

```
set BOOTNODE_URL=enode://6c2cc2b8184b5fd75e7ae6c00ae5bfc64e505089ad8fb018306845f5a4d94bd896a38c065f5ae480e456ff8fea4e4429c1f05640539c98ab6de8439a293370c0@45.63.108.190:30303
```

```
set NODE_ROLE=miner set CONTAINER_IMAGE=berylbit/go-ethereum:0.0.4
```

**Genesis .JSON Initiation**

```
mkdir %WORKING_DIR%
```

```
cd %WORKING_DIR%
```

```
mkdir %NODE_ROLE%
```

```
cd %NODE_ROLE%
```

```
echo {"config": {"chainId": %CHAIN_ID%,"homesteadBlock": 0,"eip150Block": 0,"eip155Block": 0,"eip158Block": 0,"byzantiumBlock": 0,"constantinopleBlock": 0,"petersburgBlock": 0,"istanbulBlock": 0,"berlinBlock": 0,"londonBlock": 0},"alloc": {"0x768A5e67b3E8cf3c5562dd221b12B62438F43184": {"balance": "300000000000000000000000000"}},"coinbase":"0x0000000000000000000000000000000000000000","difficulty": "0x20000","extraData": "","gasLimit": "0x2fefd8","nonce":"0x0000000000000042","mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000","parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000","timestamp": "0x00"} > genesis.json
```

```
docker run -v %cd%:/root --rm -i --platform linux/amd64 %CONTAINER_IMAGE% init /root/genesis.json
```

**Create Mining Wallet Address**

```
docker run -v %cd%:/root --rm -i --platform linux/amd64 %CONTAINER_IMAGE% account new
```

get MINING\_WALLET\_ADDRESS after "Public address of the key:" appear.&#x20;

```
set MINING_WALLET_ADDRESS=xxxxxxxxxxxxxxxxxxxxx
```

**Run the Docker**

```
docker kill %CONTAINER_NAME_PREFIX%-%NODE_ROLE%
```

```
docker rm %CONTAINER_NAME_PREFIX%-%NODE_ROLE%
```

```
docker run -d --name %CONTAINER_NAME_PREFIX%-%NODE_ROLE% -v %cd%:/root --platform linux/amd64 -p 30303:30303 -p 30303:30303/udp %CONTAINER_IMAGE% --port=30303 --mine --miner.threads=1 --miner.etherbase %MINING_WALLET_ADDRESS% --networkid=%NETWORK_ID% --bootnodes=%BOOTNODE_URL%
```

```
docker run -v %cd%:/root --rm -i --platform linux/amd64 %CONTAINER_IMAGE% attach --exec "admin.peers"
```

**Check Mining Balance**

```
docker run -v %cd%:/root --rm -i --platform linux/amd64 %CONTAINER_IMAGE% attach --exec "eth.getBalance('xxxxxxxxxxxxxxxxxxxxxxxx')"
```

_replace with MINING\_WALLET\_ADDRESS you obtained_

**Sync Data**

```
docker run -v %cd%:/root --rm -i --platform linux/amd64 %CONTAINER_IMAGE% attach --exec "eth.Sync"
```

**Import Mining Wallet to Metamask**

Enter into The Docker Desktop CLI. Then open The Terminal

If you don't use this method, type in the previous cmd:&#x20;

```
sudo docker exec -it berylbit-node-miner /bin/sh
```

```
ls /root/.ethereum/keystore/
```

```
cat /root/.ethereum/keystore/UTC...
```

(click TAB button to complete UTC file)

Copy Paste everything from UTC to a new file and rename it with wallet.jsonfile contents should be: `{"address":"57xxxxxxxxxblablabla","crypto":{"cipher":"aes-128-ctr.......}})`

Install Metamask Add-On in the browser.

Create a new Metamask account, then add the BRB Mainnet network.

Add account, by selecting Json File, then upload wallet.json and wait about 5-7 minutes.
