Quick Start

Last updated: Aug 21, 2019

Check prerequisites


Select your operating system


Install Holochain tools


Now that you have installed Nix, you can run a development shell that contains all the prerequisites, including the correct Rust version and the Holochain tools. This shell won’t interfere with your current Rust installation. Run this command:

nix-shell https://holochain.love

The first time you run this command it will take some time to download and build, but it will be much faster the next time. When it’s complete, you will see a new prompt starting with:

[nix-shell:

Test that Holochain is working by running:

[nix-shell:hc --version

and:

[nix-shell:holochain --version

You should see something like:

[nix-shell: hc 0.0.29-alpha2

[nix-shell: holochain 0.0.29-alpha2


Update/Uninstall

With nix-shell, you don’t need to worry about updating or uninstalling; when you enter the nix-shell, everything is the latest release and is then cleaned up when you exit.


Editor

In most cases you can run your editor as normal. However, if you are using an integrated developer environment or IDE that needs to communicate with the Holochain dependencies then you should launch it from inside the nix-shell.

To do this just open your editor while you are in the nix-shell like: [nix-shell:vim my_file.rs



Build your first DNA


Your first app

The hc tool can generate the basics of a new Holochain app.
hc is available from the previous step.

If you are using nix-shell, enter it before continuing.

The command to generate a new app is hc init.
Let’s create a new app called my_first_app.

To do this with hc, run:

hc init my_first_app

Note: If you get this Error: directory is not empty, it’s because the my_first_app directory already exists. To remove it, simply run rm -fr my_first_app.

The basic structure of a Holochain project is now in the “my_first_app” folder. Explore it in a file browser or text editor.

Once you have a feel for what was created, try generating a "zome."
A “zome” is what we call the source code of a Holochain app.

First, make sure your terminal is working from the my_first_app folder.

Run the following to move to the apps directory:

cd my_first_app

To generate a zome, run the following command:

hc generate zomes/my_zome

This will add a Rust project into the zomes/my_zome sub-folder.
You can now open the generated code in a text editor and start building!

The generated zomes come with a simple automated test suite.
The tests can be found in my_first_app/test/index.js.
The tests can be run with the test command:

hc test

To learn more about the hc tool, run the help command:

hc help



Next Steps

  1. Learn more about Holochain development in the Guidebook.
  2. Learn more about Rust in Holochain API Reference Documentation, Crates.io, and the Rust book.
  3. Learn more about Nix as a dev dependency and why we’re using it in the Holonix documentation.
  4. Checkout all the resources at the Developer Home.