Holochain Forum

Holochain-in-action session №2: holo-layer project and test scaffolding from the scratch

In this video we will walk you through:
00:00​ Intro
00:56​ What is PeerShare hApp?
02:10​ Reviewing PeerShare Architecture & Layers
09:19​ Creating Holo-layer and Default.nix
14:33​ what is zome? and creating peershare zome
23:49​ creating and explaining Holo-layer cargo.toml root configuration
26:06​ Implementing first zome function: who_am_i
32:52​ DNA package explanation
36:19​ creating workdir/dna as container folder for DNA
37:48​ dna.yaml explanation and configuration
40:20​ scaffolding tests and installing required packages and configuring test scripts
44:50​ where to get default.nix? holonix for MAC QA
49:43​ implementing who_am_i as the first test scenario
58:48​ run and debug test

Github Repository [https://github.com/holochain-in-action/peer-share]


1- Create holo-layer folder

2- Create default.nix and run nix-shell on folder

3- create zomes folder

4- cd zomes run cargo new peershare --lib

5- update cargo.toml inside peershare

6- create Cargo.toml in room of holo-layer/Cargo.toml

  1. add who_am_i to lib.rs in peershare zome

  2. CARGO_TARGET_DIR=target cargo build --release --target wasm32-unknown-unknown

  3. we need to write a test, to do so, we need to create DNA

    hc dna init workdir/dna

10- update zomes section in dna.yaml.

11 - Package the WASM into a DNA file.
hc dna pack workdir/dna

12- create tests folder,

13- npm init --yes
14- npm install typescript
15- add “tsc”: “tsc” to scripts section.
16- npm run tsc – --init
17- npm i @holochain/tryorama
18- npm i @holochain/conductor-api
19- npm i @types/lodash
20- npm i @types/node
21- npm i lodash
22- npm i tape
23- npm i ts-node

24- update “scripts” section with main file.

25- create index.ts common.ts who_am_i.ts

26- finish common.ts

27- finish who_am_i.ts

28- npm test ==> throw error

29- change tsconfig.json

“resolveJsonModule”: true,
“noImplicitAny”: false,

30- run npm test

These sessions are mostly suitable for programmers and designers, so if you would like to participate you need to fill-out this application in advance.

Apply for “Holochain in Action” meetings!