Getting started with a hApp

Thanks @hedayat & @guillemcordoba it now passed the test. I think it would be nice to add these steps to https://holochain-gym.github.io/developers/requirements/setup/ to make it more clear what to do for other users.

1 Like

@wwo what steps did you find missing? It says how to install nix-shell on the setup instructions, and on the exercise page it says how to compile the code and run the tests. Is it because itā€™s not clear enough on 5. and 6. that you need to be in the directory from instruction 1.? Maybe Iā€™ve been looking at the screen too long today but I donā€™t see what you missed, so it would help for clarity.

EXERCISE

  1. Go to the developer-exercises/basic/0.entries .
  2. Enter the nix-shell: nix-shell
    running this the first time might take several minutes or longer
  3. Define a new struct for your entry: ā€˜Greetingā€™
  4. Implement the function with unimplemented!()
  5. Compile your code: CARGO_TARGET_DIR=target cargo build --release --target wasm32-unknown-unknown .
  6. Run the test: ./run_tests
  7. Donā€™t stop until the test runs green
1 Like

I think that sum it up :grin: the nix-shell took about 60-80 minutes to compile.
I have installed the nix shell like mentioned here:

https://nixos.wiki/wiki/Nix_Installation_Guide

sudo install -d -m755 -o $(id -u) -g $(id -g) /nix
curl -L https://nixos.org/nix/install | sh
source $HOME/.nix-profile/etc/profile.d/nix.sh
2 Likes

Hello everyone,
I am a part of the team working on a student-project to develop a hApp that @wwo mentioned in the beginning.

As @wwo already mentioned we have successfully set up our Holochain environment and we are currently trying to do the exercises of the GYM.

However we canā€™t seem to solve our main problem. So hereā€™s me trying to explain it:

With the installation of the Holochain loads of folders and files get installed (I would post the holochain directory, but as this is my first post I canā€™t post a pictureā€¦maybe @wwo can post the picture for better understanding).

Now we had a look at these files and we are wondering where our own files - the ones containing our code of the hApp - will fit in?

  • Where do we create our own files so that they will be compiled and we can execute them?
  • Do we have to create a separate folder containing our files and if so do we have to add something to a *.toml file so that our folder will be found?
  • Also how do we create the folder and files? Iā€™m unsure if we can just mkdir <name>/touch <name> the folder and the files or if we have to do it with cargo (i.e. cargo new <name>)

This is our main problem at the moment, as we think once we have this figured out we can start coding our hApp. (Or so we believe :laughing:)

Does anyone know the answer to one of the questions or would anyone like to share how they made their first steps while developing their hApp?

We are immensely grateful for every answer. :slightly_smiling_face:

Thanks in advance!

2 Likes

Doesnā€™t matter! The convention is to create all zomes in a ā€œzomesā€ folder.

Zomes are just cargo projects. So if you are any bit familiar with Rust, then yeah, you create them like normal Rust files, be it via commands, or via your IDE; you add them to your module tree with the mod keyword.

Zomes are just cargo projects. They have their own cargo.toml containing their name, author, and all that rubbish (haha!). The convention that I follow consists of having a root cargo.toml that references all the zomes while also specifying all the Holochain dependenciesā€¦

Root toml:

[workspace]
members = [
ā€œzomes/postā€,
]

ā€¦

[patch.crates-io]
hc_utils = {git = ā€œhttps://github.com/holochain/hc-utilsā€, branch = ā€œdevelopā€, package = ā€œhc_utilsā€}
hdk3 = {git = ā€œhttps://github.com/holochain/holochainā€, rev = ā€œ3675b58ā€, package = ā€œhdk3ā€}
holo_hash = {git = ā€œhttps://github.com/holochain/holochainā€, rev = ā€œ3675b58ā€, package = ā€œholo_hashā€}

So that the zomesā€™ tomls just have to contain:

ā€¦
[dependencies]
#hdk3 = { path = ā€œā€¦/ā€¦/ā€¦/holochain/crates/hdkā€ }
serde = ā€œ=1.0.104ā€
chrono = { version = ā€œ0.4ā€, features = [ā€˜allocā€™, ā€˜stdā€™]}
derive_more = ā€œ0.99.9ā€
thiserror = ā€œ1.0.20ā€
hc_utils = "0"
hdk3 = "0"
holo_hash = "0"

Pretty neat, no?


Found by whom? The Holochain conductor or the CLI tools donā€™t give a damn to where your ā€œfoldersā€ are! All your zomes are just native Rust projects; you build them the way you build Rust projects; nobody builds them for you! All that a DNA does (meaning the DNA utils) is that they assemble (or like, ā€œmergeā€) all the WASM compiles of your zomes into one pack which you call your applicationā€™s DNA. Simple! The core team has been very clever in doing things this way; neither did they have to invent extensive tooling, nor do you and I have to ask extensive questions about building/compiling here on this forum; itā€™s all Rust specific, meaning Rust-forums cover these concerns, not Holochain.


Anyway, @guillemcordoba didnā€™t respond yesterday so I thought I might give it a try! :ā€“)
Wait for him to returnā€¦

I donā€™t know if anything has changed substantially; would be jumping back to programming next week anyway.

Anyway, whatā€™s up with holochain.love @guillemcordoba? At one point I thought love was ready, but then I heard weā€™re back to cloning the Holochain repository and all the nix files locally?

2 Likes

Thank you so much for your answer @The-A-Man!
Now a lot of things make sense to us that didnā€™t before :smiley:

2 Likes

Hey guys,

Sorry I am only just catching up on the forumā€¦ I have been working flat out on STAR ODK (which evolved from the .NET HDK) and is getting close nowā€¦ today made a breakthrough upgrading HoloNET (.NET/Unity Holochain Client) to RSM.

So thought Iā€™ll celebrate by coming out of my bunker for a while to catch up with the good old hc tribeā€¦ my familyā€¦ :slight_smile: :heart:

I missed you guys! :wink: I also just signed up for DevCamp 8 (think is my 4th one now).

I agree with you @carolyn, I wasted years networking on calls, messages, telegram groups trying to get help for my project Our World/OASIS API/HoloNET/HoloUnity/.NET HDK but sadly I did not get anyā€¦ I put too much faith in humanity. I learnt the hard way that I could only count on myself but I guess its because these days people are not interested in ideas, even when they would help so many people. HoloNET and .NET HDK would have really helped accelerate hc adoption by taking it mainstream into the massive .NET and Unity ecosystems as well as the enterprise sectors.

But its cool, I understand it all happens in Divine Timing and everything happens for a reason so I stopped pushing and went inwards instead and did more inner work as well as just got my head down to build it myself! :slight_smile: :heart:

All of this helped me level up and do intense inner work (Iā€™m autistic too) and I find yoga helps me the most to slow down and ground. :slight_smile:

I was more like pqcdev and had to learn LOTS of patience! :wink: lol I also needed to keep surrendering deeper and deeper and learning LOTS of TRUST and Divine Timing and to be just in the flow rather than trying to force things before they were meant to happenā€¦ so I now have stopped communicating and focused on building it all myself and now tbh I am MUCH happier because of it, and feel much more in flow and empowered! :slight_smile: :heart:

But now I am very close to finally delivering STAR ODK/HDK, which is also a Low Code Generator and will REALLY help the hc community as well as bridge to Ethereum, EOSIO, Telos, ActivityPub, Seeds, MongoDB, Neo4j and many moreā€¦ to help create a migration path to Holochain and to help increase exposureā€¦ It also allows you to debug your hApp, something you cannot do with Rust and give you the best of both worlds by giving you access to both Rust and .NET libraries. It dynamically generates both C# and Rust code from templates. It will massively help speed up development of hAppsā€¦ :slight_smile:

This is why I have been quiet for a whileā€¦ just getting it builtā€¦ as the saying goesā€¦ BUILD IT AND THEY WILL COME! :wink:

So just wanted to say I really feel you @carolyn about focusing more on building rather than everything elseā€¦ we are all nearly thereā€¦ just got to keep going a little longer and it will all be worth it in the end! :slight_smile: :heart:

I also feel you @stephenpurkiss and yes can relate to everything you saidā€¦ not been easy fitting into society being on the spectrumā€¦ but as I said the best thing I found is daily yoga to help slow down, calm down the nervous system and to ground. :slight_smile:

This is why I created Yoga4Autism to help share what I had discoveredā€¦
http://www.yoga4autism.com

I think my brother pqcdev got banned? Really sorry to hear this guys, what happened? I canā€™t tell from this thread why that was? All I can say is that I sincerely apologise on his behalfā€¦ please bare in mind he is on the spectrum and reminds me a bit like a younger version of myself before I spent a LONG time working hard on myself with my daily yoga, meditation, mindfulness practise, etc.

I hope I can help him and share with others so they do not have to go through what I haveā€¦ He is a GREAT guy with a GIANT heart as many people on the spectrum are. Please understand that we are often mis-understood because we have trouble expressing ourselvesā€¦ :heart:

I know he meant no harm, and sometimes his passion can get the better of him (just like it has with me in the past). We are all SUPER passionate about Holochain and we all REALLY want to see it succeed, because we can see the massive value it can bring to a world in need right nowā€¦

We are all part of the same teamā€¦ so lets please forgive and forget and work togetherā€¦

TOGETHER WE CAN CREATE A BETTER WORLDā€¦

Much love, light & blessings,
David. :heart: :heart: :heart: :heart: :heart: :heart:

3 Likes