Help Needed: Unclear Build Instructions for Cloned Repository

Hi @community,

I have cloned this repository and I am trying to build the code using make, but the commands are not explained clearly. Could you please suggest how to build this repository?

Link :- GitHub - MinaProtocol/mina: Mina is a new cryptocurrency with a constant size blockchain, improving scaling while maintaining decentralization and security.

Thanks in advance.

1 Like

Hey @firebeefaizul! I work at Granola. We are heavily involved in security work and implemented on-chain voting. Currently, we’re working on an indexer. More to come!

By far, the easiest way to build mina is by using nix. I highly recommend enabling flakes and adding the mina registry entry as described in the instructions.

Once you have all that in place, do ./nix/pin.sh and enter a dev shell via nix develop mina (this will take like 15 minutes to complete the first time because nix has to download all relevant derivations, also requires tens of GBs of disk space!). This sets up your dev environment. Once you’re in, you should be able to do any of the make commands you want.

Alternatively, you can build the source code with the OCaml build system dune (don’t worry, nix has already provided this). I’m going to assume you want to build the CLI for mainnet.

The first thing is you need to be on the right git branch. For mainnet, this is master or compatible (more features than master and compatible with mainnet). For berkeley, this is berkeley or rampup (more features than berkeley and compatible with the current berkeley testnet). Checkout your desired branch.

Again, assuming you want a mainnet CLI, you would do

dune build --profile=mainnet src/app/cli/src/mina.exe

That will put the CLI binary in the _build/default directory. Then you can run it and display the help menu via

./_build/default/src/app/cli/src/mina.exe --help

Building without nix is significantly more involved! Getting the right version of every tool is not fun. For a clue, you can basically recreate what the dockerfiles do just on your local machine. I highly highly recommend using nix.

Hope this helps! Happy building!

1 Like