Holochain Forum

Embedded Holochain Runner lets you run Holochain as a library in your binary for a given DNA

I have taken a preference for moving as much holochain related code out of javascript and typescript and into Rust as possible, given the ability to pin dependencies in Rust, via Cargo.toml, and utilize the Holochain Rust types and code hints in IDEs to ease my development workflow, and confidence.

With the right knowledge of Rust, it can prove easier to utilize Holochain, but I know this knowledge isn’t available to everyone. During Acorn development, I replaced use of the holochain binary with my own library style use of the Holochain “Conductor”. I wrote it as a library so I and others could reuse it within other applications. I wanted to make the api much much simpler, and also strip down the configuration to just the few variables the app developer really cares about at this point.

In order to provide a delightful application launch experience, I provided an interface for listening to signals indicating what state of readiness the library is in as well. In particular, the developer usually wants to know ‘when are my websocket connections open’ so that you can load a UI, or tell a UI, to connect.


Hey @Connoropolous,

Ought to say, this has been one of the best things to have ever happened to Holochain. Basically, if I understand correctly, given I want to build a Windows (h)app: with Holochain as a crate now, I should be able to write a Rust program that uses your crate and fires up the conductor and haves it listen on some port, copy-paste my .happ file (which has the DNAs build for WASM which, thankfully, is platform-independent) into the local file-path location that your crate expects the .happ files to be at, write a bunch of my own code that says “when the conductor has run the happ in a sandbox with the given port successfully opened, fire up …/ui.exe”, then cross-build this rust code for windows, and given the UI at ui.exe property talks back and forth to the same port, when my users run the happ.exe file, it would: start the conductor, listen at the port, fire up the UI, and finally gracefully shut the conductor down when the user closes the happ.exe window. This way, I’d (and so would my users) avoid the pain of running the happ in WSL and port-forwarding to the UI running natively in windows. I’d be writing that rust code once my UI is ready; would PM you if I get stuck. Have I got this right? Did I misunderstand anything? Shouldn’t your embedded Holochain rust crate make something like this possible?

1 Like