This documentation is for the prototype version of Holochain, written in Go.
There is a new version under development, for which there is new documentation and a Developer Preview pre-release.
View the future of Holochain here.
The documentation for the holochain-proto version will remain available online.

Knowing the commands mentioned in those use cases will get you a long ways, and learning the rest of the commands will come with time as you get into more advanced use cases. Now that the command line tools are more familiar, you can get into the details of configuring, and understanding, the "DNA" of your application.

Command Documentation

hcadmin

The hcadmin is a command line tool for administering Holochain applications.

This command initializes the Holochain environment, and must be run before you install or run chains. You must provide a unique agent identification, usually an e-mail, as an argument to this command.

This command initializes the system with a default identity and generates default public/private keys for interacting with other networked peers. You provide a single string of identifying information which will be provided to the application as your agent_name. This is often an email address.

This command creates a ~/.holochain directory (by default, which you can override with the --path flag) where all your holochain data will be stored.

hcdev

The hcdev command is a tool for Holochain application development. It provides developers a convenient way to run tests and serve chains while in development. You should be inside the directory of the application you want to run in dev mode when you use the hcdev command.

The hcdev command doesn't use the ~/.holochain directory used by hcd and hcadmin, instead it runs your chain by default in ~/.holochaindev. You can override this behavior by specifying a different path in the HOLOPATHDEV environment variable or with the --execpath flag.

The --debug flag turns on low-level holochain debugging output during all commands. Note that when runing hcdev web any calls to debug() in your application code will be printed out to stdout regardless of this flag.

If you think that you are having networking difficulties, or want to configure your networking, check out the Networking page.

Initialize a holochain app directory: from a appPackage file or clone from another app. This will create an empty directory hierarchy with a minimal DNA file in dna/dna.json. Note that you can supply a path for `<app-name>` and the base of the path will be used as the app's name.

OPTIONS:
--test initialize built-in testing app
--clone value path from which to clone the app
--package value path to an app package file from which to initialize the app
--cloneExample="value" example from github.com/holochain to clone from
--fromBranch value specify branch to use with cloneExample
--fromDevelop specify that cloneExample should use the 'develop' branch

--package - Initialize from package: hcdev init

The --package flag lets you specify file produced by hcdev package or generated by the hc-scaffold to pre-populate your DNA.

This command runs all the stand-alone tests in the test subdirectory for the holochain in the current working directory. You can also optionally just specify a single test file to test. Please see theTest Driven Developmentsection for documentation on how to write tests.

When you need to bridge in your scenarios add a bridge_specs.json file in the root directory of the app. You can also use the -bridgeSpecs flag to specify a bridge specs file by path, or you can use the value "_" disable bridging.

The format of the bridge_specs.json file is an array of objects of this form:

{
Path: string // path to the app to bridge to/from
Side: int// what side of the bridge the dev app is (Bridge.Caller or Bridge.Callee)
BridgeGenesisCallerData: string // genesis data for the caller side
BridgeGenesisCalleeData: string // genesis data for the callee side
Port: string // only used if side == BridgeCallee
BridgeZome: string // only used if side == BridgeCaller
}

This command runs the multi-node scenario testing harness. <scenario-name> should be a scenario from your test directory. Please see the Test Driven Development section for documentation on how to write scenario tests.

When you need to bridge in your scenarios you can:

add a bridge_specs.json file in the root directory of the app or you can use the -bridgeSpecs flag to override this behavior and either give it a path to the file, or the value "_" which will then not do the bridging

create per-role bridge specs in the scenario's directory using the folloowing naming convention: _<role>_bridge_specs.json The scenrio will use that file (instead of the default bridge specs) for setting up bridging for the given role (and all it's clones) if it exists.

The format of a bridge_specs.json file is an array of objects of this form:

{
Path: string // path to the app to bridge to/from
Side: int// what side of the bridge the dev app is (Bridge.Caller or Bridge.Callee)
BridgeGenesisCallerData: string // genesis data for the caller side
BridgeGenesisCalleeData: string // genesis data for the callee side
Port: string // only used if side == BridgeCallee
BridgeZome: string // only used if side == BridgeCaller
}

Launches an http-POST based, or websockets API, which provides access to exposed application functions. The default port is 4141. Any files in the UI folder of the application will be exposed by a static file web server and accessible at http://localhost:4141, or whichever port you ran the web server at. You can read more in the UI Development article.

There are a number of Environment variables that can change the behavior of the command line utilites and the core Holochain code base:

Logging/Debugging

HCLOG_APP_ENABLE=1: Enables logging of application calls to debug(). This is enabled by default by hcdev but not enabled by hcd

HCLOG_DHT_ENABLE=1 -- Enables logging of DHT communications which is really helpful to understand what goes on between agents/nodes.

HCLOG_GOSSIP_ENABLE=1 -- Enables logging of gossip output.

HCLOG_DEBUG_ENABLE=1 -- Enables low-level holochain debugging output.

HCLOG_PREFIX="a prefix:" -- Adds a prefix to all log output. Primarily used internally by scenario and testing, so that you can tell which role the log entry comes from.

HCDEBUG=1 enables debugging output of the hcdev, hcadmin and hcd command line utilities (as distinc from the Holochain core codebase).

Gossip/World Model

HC_GOSSIP_INTERVAL=<seconds>: determines the gossip interval. Defaults to 2. To dissable gossip set this value to 0.

HC_HOLDING_INTERVAL=<seconds>: determines the world-model holding check interval. Set to 0 by default in Alpha 1.

Defaults

When you first run hcadmin init a number of system defaults for creating application config files are stored in ~/.holochain/system.conf These default values will be used later when hcadmin join creates the conf.json file for the app as it is added. The following environment variables override the default defaults. You can, of course, also manually edit the ~/.holochain/system.conf file after the fact if you want to change that.