New Tools for Holoscape Development: hApp Bundles, Debug Functions, and Instance Aliases

Holochain Dev Pulse 43

Summary

On the heels of the release of Holoscape, which we discussed in the last Dev Pulse, we have another new feature that will help developers take advantage of Holoscape’s user-friendly design — hApp bundles. hApp bundles will make development for Holoscape much easier. Additionally, new debugging functions and the ability to add aliases to interface instances both bring us closer than ever to putting Holochain in the hands of end users.

Highlights

1. How hApp bundles benefit developers

2. Debug functions added to Conductor API

3. Interface instance aliases added

Details

Holochain Dev Pulse August 19–August 26, 2019

1. How hApp bundles benefit developers

Holoscape is a deployment of Holochain that’s focused specifically on end users. The goal is for people to download Holoscape onto their devices and start installing hApps with just a few clicks. To get there, however, all the moving parts of a hApp need to be sorted out so that everything is configured correctly. Your Conductor needs to know, for example, where DNAs are located and what their hashes are. Once a DNA instance is running, you need a way to connect it to a UI so that the DNA is usable. Currently, conductor configuration files specify an interface, which defines a means for a UI to talk to specific DNA instances via WebSocket or HTTP. You can then start up your UI and connect it to your preferred DNA via the interface.

Holoscape

The problem? All of this was done manually. Specifically, a UI had to be hard-coded to include the name or ID of the instances it wanted to talk to. That’s not so bad when it’s just a developer working on their hApp, but once hApps are out in the wild under user control, any changes made to the Conductor configuration on their end could conflict with the UI code.

The solution is Holochain hApp bundles. They’re a bit like Conductor configurations, but are structured such that every UI has its own dedicated interface in which DNA instances are named in predictable ways from the UI’s perspective. This means that when Holoscape (or any other Holochain deployment) scans the bundle, it will adjust its own Conductor configuration accordingly. It’s basically a full container runtime for any app.

*Check out this example of a working bundle to learn more about how they work.

hApp bundles will make development in Holoscape, or anywhere in the Holochain ecosystem, much easier. Rather than worry about dependencies breaking your hApp when it gets into users’ hands, you can now deploy a hApp with just a toml file — or package it with all DNAs and UIs in a self-contained archive — and be assured that it will work as you expect it to.

In the near future, anyone will be able to download Holoscape and easily install a Holochain app. A public release can be expected in the next few weeks.

2. Debug functions added to Conductor API (#1661)

hApp bundles are just one of the ways in which we are improving the Holoscape developer experience. Another is this new change, which adds three API functions to Conductors, allowing developers to inspect Conductor and application state.

`debug/running_instances` gives you an array of running instance IDs.

`debug/state_dump` gives you the same state dump for a given instance that we previously added as a log.

`debug/fetch_cas` gives you the content of a locally stored entry, in order to see what’s really going on in an agent’s source chain or DHT shard.

Holochain Instance Debug View

Holoscape shows this information in a debug window. You can also incorporate the output of these functions into debugging tools of your own, set up a watcher using command-line tools, or build them into a debug version of your app.

These functions will give developers a much better picture of what is happening under the hood of an instance. If you can write an app in which you can see the running DNA, everything happening inside Holochain Core, and how that affects the source chain and the DHT, you can better identify the source of any potential troubles.

Good debugging tools are especially important as we prepare for the next round of network field testing and the expansion of the number of users testing Holoscape. As an app developer, you’ll appreciate having these tools to test your app in the real world on a real network.

3. Interface instance aliases added (#1676)

As we’ve already shared, our motivation for rolling out hApp bundles is to decouple UI code from Conductor configurations and avoid hard-coding DNA instance IDs. Making Holoscape accessible to end users wouldn’t be possible without it. The change helps implement our goal — you now have an optional `alias` field in the Conductor configuration’s `InstanceReferenceConfiguration` setting. When it’s set, the DNA instance will be mounted under the given aliases, as well as the default instance ID.

Holochain Conductor Config

With this feature, you can name your DNA instance as you prefer. You can then give it multiple aliases appropriate for the UI of one hApp or another. This is exactly what Holoscape is doing in an automatic install — it reads the bundle configuration, finds out how the UI wants to refer to an instance, and uses that as the alias for the instance. The bundle directs the Conductor to install the DNA and creates an instance with the agent ID of the person who’s installing the bundle. It then uses the alias as the default instance ID, including downloading the DNA from the provided URL.

Together with hApp bundles and debugging functions, interface instance aliases will enable us to release Holoscape and be sure that anyone, developer or not, can do a one-click bundle install of Holochain applications.

Holochain Development Status:

For all changes related to this release, please see the changelog.

Dev Pulse — Vol 43: hApp Bundles

Learn more about Holochain and join our community!

Website | Holochain Developer Forum| Youtube | Medium | Twitter