Holochain Forum

Is there a hello world or simple chat app for RSM?

Hi, anyone know of any simple happs for getting started which are using RSM? Or a branch on existing apps (eg simple chat, simple microblog) which use RSM?

Sure there are some:

From holochain org:

From Acorn (get in touch with @Connoropolous for this):

From Kizuna:

From the community / holochain-open-dev (this is mostly what I’m working on right now):

Maybe I’m missing some examples already on RSM, and there are some other projects beginning migration.

If you are looking at getting started with some developing with RSM, we actually could use some help with the development with the stuff in the holochain-open-dev (there are more building blocks to come!). If you want we could coordinate, I could offer guidance and help through the learning process :slight_smile:

1 Like

Thanks very much! The chat app will get me started nicely.

Thanks for offering to onboard me in the building blocks. I will reach out if I’m able to make time to take you up on that!

3 Likes

Coming back around to this: I cloned https://github.com/holochain/elemental-chat, followed the readme and ran tests, which passed.

Next I tried to start up a server/conductor, but without success. I tried:

$ hc run
Reading DNA from /Users/harlan/code/elemental-chat/dist/elemental-chat.dna.json
thread 'main' panicked at 'Could not load DNA file /Users/harlan/code/elemental-chat/dist/elemental-chat.dna.json', crates/cli/src/cli/run.rs:158:9
stack backtrace:
   0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
   1: core::fmt::write
   2: std::io::Write::write_fmt
   3: std::panicking::default_hook::{{closure}}
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::continue_panic_fmt
   6: std::panicking::begin_panic_fmt
   7: hc::run
   8: hc::main
   9: std::rt::lang_start::{{closure}}
  10: main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
$ hc run -d elemental-chat.dna.workdir/dna.json
Reading DNA from elemental-chat.dna.workdir/dna.json
thread 'main' panicked at 'Could not load DNA file elemental-chat.dna.workdir/dna.json', crates/cli/src/cli/run.rs:158:9
stack backtrace:
   0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
   1: core::fmt::write
   2: std::io::Write::write_fmt
   3: std::panicking::default_hook::{{closure}}
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::continue_panic_fmt
   6: std::panicking::begin_panic_fmt
   7: hc::run
   8: hc::main
   9: std::rt::lang_start::{{closure}}
  10: main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
$ hc package
Error: Couldn't traverse DNA in directory "/Users/harlan/code/elemental-chat": Error Packaging DNA: Multiple files with extension .json were found in the root of the project, ["/Users/harlan/code/elemental-chat/tests/package-lock.json", "/Users/harlan/code/elemental-chat/tests/package.json", "/Users/harlan/code/elemental-chat/tests/tsconfig.json"].This is ambiguous as the packager is unable to tell which should be used as the base for the .dna.json

Any advice much appreciated. Sorry if I’m missing something fundamental here!

Hm, maybe this is what is needed here:

If you are running Holochain using your own setup, you’ll have to have a deeper understanding of Holochain than is in scope for this tutorial. Roughly speaking, you’ll need to:

  • make sure holochain is running with a configuration that includes an admin interface websocket port
  • send a properly encoded InstallApp command over the websocket
  • be sure to ActivateApp and AttachAppInterface as well.

( – from https://github.com/holochain/holochain/blob/develop/docs/build_tutorial.md#4-use-the-conductors-admin-interface-to-install-your-dna )

buuuut I think I’m lacking in the “deeper understanding of Holochain” that is referenced here :wink:

Anyone willing to spell this out a bit more for me?

I tried one more thing – I added a package.json inspired by https://github.com/h-be/acorn-hc/blob/master/package.json

{
  "scripts": {
    "start": "npx @holochain-open-dev/holochain-run-dna elemental-chat.dna.gz"
  },
  "dependencies": {
    "@holochain-open-dev/holochain-run-dna": "0.1.22"
  }
}

Then I ran it and got:

$ npm install
$ npm start

> @ start /Users/harlan/code/elemental-chat
> npx @holochain-open-dev/holochain-run-dna elemental-chat.dna.gz

Error: ProcessAlreadyExists
Conductor ready.
(node:98156) UnhandledPromiseRejectionWarning: #<Object>
(node:98156) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:98156) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Hi! So yeah, actually hc run and hc package are holochain redux things - they don’t work at all in RSM.

{
  "scripts": {
    "start": "holochain-run-dna elemental-chat.dna.gz"
  },
  "dependencies": {
    "@holochain-open-dev/holochain-run-dna": "0.2.1"
  }
}
1 Like

Thanks, I’ll try that! Once the server is running, my next question would be how do I interact with it? Can I do an HTTP POST (or websocket command) with the exact payload that I would have used in holochain redux? If not, could you spell it out as a CURL command, or point me to a UI or script (or docs) for a simple server API call?

Thanks for all the great help! :pray:

As far as I know everything is websockets, and I’d say it’s quite difficult to do from the command line alone.

I think the best think for you to do is look over the conductor api repo (https://github.com/holochain/holochain-conductor-api) and look at examples from the UI code from other projects (I think all the ones listed above contain some of that). Careful about which version of the conductor api library they are using though because that has changed quite a lot lately.

1 Like

Hm, with the latest version of @holochain-open-dev/holochain-run-dna (0.2.1) I get this:

$ npm start

> @ start /Users/harlan/code/elemental-chat
> npx @holochain-open-dev/holochain-run-dna elemental-chat.dna.gz

Error: ProcessAlreadyExists
Error: could not connect to holochain conductor, please check that a conductor service is running and available at ws://localhost:1234
    at WebSocket.socket.onerror (/Users/harlan/code/elemental-chat/node_modules/@holochain-open-dev/holochain-run-dna/dist/main.js:7996:28)
    at WebSocket.onError (/Users/harlan/code/elemental-chat/node_modules/ws/lib/event-target.js:140:16)
    at WebSocket.emit (events.js:210:5)
    at ClientRequest.<anonymous> (/Users/harlan/code/elemental-chat/node_modules/ws/lib/websocket.js:579:15)
    at ClientRequest.emit (events.js:210:5)
    at Socket.socketErrorListener (_http_client.js:406:9)
    at Socket.emit (events.js:210:5)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
Conductor ready.

Hum yeah… What git commit have you compiled your holochain binary with?