The Groundwork for the WASM Conductor and Light Client
Holochain Dev Pulse 30
This has been a week of breaking changes and adding important features. In this version, links gain a new capacity that will open up possibilities for indexing, speed improvements, and more. We’ve also made progress towards Holochain in the browser with the beginnings of a new, WebAssembly-based conductor.
- API/Breaking Change: Link Tag Property Name Change and Added Dynamic Link Content
- Standardization/Breaking Change: Conductor Now Persists Config in User’s Config Root
- API: App Properties Global Added to HDK
- Networking: Default Network Mode Just Got ‘Real’
- Web/Holo: WASM Conductor Skeleton
- Binaries/Breaking Change: Cargo Root Changed
- Zome Explorer Tool from the Community
1. API/Breaking Change: Link Tag Property Name Change and Added Dynamic Link Content
As you may know, each type of link must have the nature of its relationship described in a `tag` value, which is defined beforehand as part of the `define_zome!` block. New values can’t be made up at runtime. This property has been renamed to `link_type` to reflect its true use as part of your app’s data schema definition.
Links can now store arbitrary string content, called a ‘tag.’ This means that you can use it to build simple search indexes, create ‘folksonomies’ for categorization, store basic information about a link target to speed up data retrieval, create ‘smart anchors,’ and more. This was also possible in the Go-based prototype.
This is an important breaking change, because we’re renaming an existing property and repurposing the property’s original name simultaneously. Make sure you do a global search-and-replace on your codebase before you start using the new tag feature!
Breaking changes and new functionality:
- Link definition macros `link!`, `to!`, and `from!` now have their type specified as `link_type` rather than `tag`.
- Link retrieval functions `get_links`, `get_links_with_options`, `get_links_result`, `get_links_and_load`, and `get_links_and_load_type` all still take the link type as the second argument, but it’s now an `Option<String>` rather than a `String`, which allows you to get links of all types or by tag only. (Internally, it’s now called `link_type`.)
- The aforementioned link retrieval functions now take a third optional argument called `tag`, which bumps all subsequent arguments by one position. If `tag` is `None`, all links with any tag are returned. If it is `Some(String)`, only links with the specified tag are returned.
- `link_entries`, `link_entries_bidir`, `commit_and_link`, and `remove_link` now take tags as their last arguments. This tag needs to be given, but can be an empty string. For link removal, only links with matching `link_type` and `tag` will be removed. (Once again, the parameters previously called `tag` are now called `link_type` internally.)
- Links results now include their tag in the `tag` property.
2. Standardization/Breaking Change: Conductor Now Persists Config in User’s Config Root
Until now, the Holochain ‘Production Conductor’ — which is used by end-users to run real hApps with a persistent identity and source chain — saved its configuration into a `.holochain` directory in the user’s home directory. Now, it respects your operating system’s conventions, storing the config in the place where you’d normally expect your installed apps to do so.
This means you’ll need to copy any existing config to the proper directory:
- macOS: <user home>/Library/Preferences/holochain/conductor
- Windows: <user roaming app data>\holochain\holochain\conductor\
- Linux: <user home>/.config/holochain/conductor
3. API: App Properties Global Added to HDK
Your DNA’s ‘Properties’ object is now available to your DNA, accessible through both a global static `PROPERTIES` object and a `property` getter function. The values are available as JsonStrings and can be either deserialized or converted directly into a struct that you’ve defined in your app. This is another feature that existed in the Go-based prototype and is finally available in Holochain-Rust.
Why is this useful? Your DNA file can contain an arbitrary JSON object called `properties` that can hold any keys and values you like. These can be used as environment variables for a running instance. Additionally, because changes to the properties results in a new DNA hash, you can use it to create mini-DHTs with different parameters from a single ‘DNA template.’
4. Networking: Default Network Mode Just Got ‘Real’
Holochain now defaults to ‘real mode’ in n3h, which is our prototype networking library. Along with pinning to the newest n3h release v0.0.13-alpha, this should bring more reliability and configurability for the test networks you create.
Currently, n3h has a few DHT networking modes. The details aren’t terribly important, but real mode is currently now the closest to our planned DHT design. It also features mDNS discovery so that you can create test networks in a LAN or VPN.
5. Web/Holo: WASM Conductor Skeleton
These are the first steps on the path to Holochain light client. The Holochain repo now has a skeleton for the future WASM Conductor, which will allow Holochain to be run directly on the browser in the future. Currently, this doesn’t have any real functionality, but will give us the framework we need to build upon in the future. We’re also now shipping installation scripts for better WASM generation and debugging tools.
There’s more information for developers on “wasm bindgen” that can be found in the WASM/Rust Book online.
6. Binaries/Breaking Change: Cargo Root Changed
Recently, the main causes of confusion and conflict in people’s local development setups have been existing installations of Rust, etc. Up until now we’ve used the current user’s “home directory” for all our Rust compiling, which exacerbates this issue.
This week, however, we are moving all our compilation directly into the Holochain folder. Most people will not be impacted, but if you are manually compiling things, this may impact your workflow. If you think this might be you, be sure to run `which` to see if your binaries are in the home folder or the main repo.
7. Zome Explorer Tool from the Community
Our clever friends at Hylo — an open-source community-in-a-box app that is being refactored to use Holochain/Holo as a backend — have generously shared a useful tool.
This ‘zome explorer’ GUI lets you test your zome functions from the comfort of your web browser.
All you need to do is point it at your DNA file and a running conductor websocket and it’ll build a GUI for you. If you’ve used Swagger or OpenAPI, this will feel quite familiar.
Zome Explorer Tool Demo:
- 0.0.17-alpha2 Released
- Next: 0.0.18-alpha1
Building an App/Platform on Holochain? We want to hear from you! Are you building on Holochain? We would love to connect and hear more about your app/platform. Please, take a few moments to fill out this survey! Our goal is to list all the projects building on Holochain on our website.
Stack Overflow: Expand the Holochain Knowledge Base
Help us grow the Holochain knowledge base on Stack Overflow!
Submit your Holochain question.
Submit your Holochain Rust question.
Contribute to Documentation
Lastly, to all of our readers — we’d like to encourage you to submit an issue or a pull request if you are interested in contributing to code. If you have a passion for, or would like to see, improvements made to the documentation, submit a new issue or add a suggestion to the Holochain Guidebook.