Minaprotocol: Docker based install on a Mac

peloclick
4 min readApr 18, 2021

--

Some people on the minaprotocol discord are struggling to get Mina running on a Mac, so I decided to help them out with some little guidance, so here it goes. Mind that, whenever the mina packages get updated, some instructions might change accordingly:

First download and install docker for mac:

https://docs.docker.com/docker-for-mac/install/

Once installed, we launch docker go to settings and inside of resources we set the following:

Then, we click on Apply & Restart

Now docker is installed and ready to go.

Then we open a Terminal and type:

mkdir keys (ENTER)
cd ~ (ENTER)

Now, we have to create our keys. To do so, we will run the following command:

docker run — interactive — tty — rm — volume $(pwd)/keys:/keys minaprotocol/generate-keypair:0.2.12–718eba4 -privkey-path /keys/my-wallet (ENTER)

Then we will see a message like this, asking for the password that we want to use for that key pair:

Then we will see that the keypair has been generated:

If we type ls -lah keys/ like this we will see that the keys are in our mac:

MyMac:~ user$ ls -lah keys/
total 16
drwxr-xr-x 4 user staff 128B 18 abr 00:32 .
drwxr-xr-x+ 71 user staff 2,2K 18 abr 00:30 ..
-rw — — — — 1 user staff 263B 18 abr 00:32 my-wallet
-rw-r — r — 1 user staff 56B 18 abr 00:32 my-wallet.pub
Mymac:~ user$

Ok, now let’s run mina for the first time.

First we run inside of the terminal these 3 commands:

cd ~ (ENTER)
chmod 700 ~/keys (ENTER)
chmod 600 ~/keys/my-wallet (ENTER)
mkdir ~/.mina-config (ENTER

and then we will run:

docker run — name mina -d \
-p 8302:8302 \
— restart=always \
— mount “type=bind,source=`pwd`/keys,dst=/keys,readonly” \
— mount “type=bind,source=`pwd`/.mina-config,dst=/root/.mina-config” \
-e CODA_PRIVKEY_PASS=”mypaswordgoesinhere” \
minaprotocol/mina-daemon-baked:1.1.5-a42bdee \
daemon \
— block-producer-key /keys/my-wallet \
— insecure-rest-server \
— file-log-level Debug \
— log-level Info \
— peer-list-url https://storage.googleapis.com/mina-seed-lists/mainnet_seeds.txt

Of course we can add other parameters depending on other things like snarks, snark fees, different folders being used, etc.

Now, we can check how mina is running with:

docker logs -f mina

That will give us a view (live) of the output of the mina daemon. To exit we can just press Control-C

To check the status of the client we can just type:

docker exec -it mina mina client status

We can of course import the account into mina as well if we want with:

docker exec -it mina mina accounts import -privkey-path /keys/my-wallet

Or unlock it with:

docker exec -it mina mina accounts unlock -public-key B62qkHjXXSmvpjyXtPzTf3xLnQu……….

This key number can be seen as well with:

docker exec -it mina cat /keys/my-wallet.pub

Once the node is synced we can check our funds with:

docker exec -it mina mina accounts list

Or we can delegate one key to another with:

docker exec -it mina mina client delegate-stake -receiver destinationpubkey -sender originpubkey -fee 0.01

To stop the container we can use:

docker stop mina

Mind though that it takes a while to stop… 

Finally, if you want to set up snarks for that node, then the starting command would look like the following (includes block production, but that part might be removed if no block production is needed/wanted):

docker run — name mina -d \
-p 8302:8302 \
— restart=always \
— mount “type=bind,source=`pwd`/keys,dst=/keys,readonly” \
— mount “type=bind,source=`pwd`/.mina-config,dst=/root/.mina-config” \
-e CODA_PRIVKEY_PASS=”mypaswordgoesinhere” \
minaprotocol/mina-daemon-baked:1.1.5-a42bdee \
daemon \
— block-producer-key /keys/my-wallet \
— insecure-rest-server \
— file-log-level Debug \
— log-level Info \
— peer-list-url
https://storage.googleapis.com/mina-seed-lists/mainnet_seeds.txt \
— run-snark-worker yourpublickeygoesinhere \
— snark-worker-fee 0.001

So that’s it, hope you’ve been able to set up your node with these instructions. Have fun!

--

--