---
# System prepended metadata

title: Group DNA cloning
tags: [Kizuna-architecture]

---

# Group DNA cloning
###### tags: `Kizuna-architecture`
<style> .ui-infobar, #doc.markdown-body { max-width: 1000px; } </style>

### Cliff notes
- currently, `createCloneCell` is not yet available in the Holochain conductor Admin interface. This forces us to instantiate the DNA through a fresh Happ. The architecture below has attempted to minimize the migration to `createCloneCell` once it is available.

## Entry Relationship Diagram
```mermaid
graph TD
  subgraph group_meta_zome
    subgraph meta
        group_dna_meta
        group_dna_meta==>group_dna_meta_v2
        group_dna_meta==>group_dna_meta_v3
    end
    subgraph group_members
        member1
        member2
        member3
    end
    subgraph path
        meta_path-->group_dna_meta
        members_path-->member1
        members_path-->member2
        members_path-->member3
    end
  end
```

## Data Structures
```rust=
struct GroupDnaMeta {
    creator: AgentPubKey,
    created: Timestamp,
    name: String,
    passphrase: String,
    avatar: Option<EntryHash>
}

struct Member {
    address: AgentPubKey
}

struct groupAvatar(SerializedBytes)
```

## Validations
### Entries
* `groupDnaMeta`
    * create is valid if creator pubkey matches the creator field (change this to role based validation when role is implemented)
    * update is valid if creator pubkey matches the cretor field (refactor once role lands)
    * update is valid only if the passphrase field did not change from the originally created GroupDnaMeta
    * update is valid only if the creator feild did not change from the original entry
    * update is valid only if the name of the group is more than 1 character but less than 50
    * update is valid only if the avatar entry can be retrieved
    * delete is invalid
* `Member`
* `groupAvatar`
### Links
`meta_path->groupDnaMeta`
`members_path->Member`
## Clone Group DNA

```mermaid
sequenceDiagram

participant AUI as Alice_UI
participant AC as Alice_Conductor
participant ALC as Alice_Lobby_Cell
participant AGDNA as Alice_Group_Cell

AUI-->>AUI: generate random passphrase
AUI-->>AC: registerDna with passphrase as uID
Note over AUI: Probably better for the passphrase to be used as membrane proof as well
AUI-->>AC: install Happ with the newly registered DNA
AC-->>AGDNA: install
AUI-->>AC: enableApp
AUI-->>AGDNA: create_group_meta
AGDNA-->>AUI: groupDnaMeta
```

## create_group_meta
```mermaid
sequenceDiagram

participant AUI as Alice_UI
participant AGDNA as Alice_Group_Cell

AUI-->>AGDNA: call create_group_meta
AGDNA-->>AGDNA: create meta_path
AGDNA-->>AGDNA: create group_dna_meta
AGDNA-->>AGDNA: create link from meta_path to group_dna_meta
AGDNA-->>AUI: return groupDnaMeta
```

## get_group_meta

## join_group_dna

## leave_group_dna

## remove_member

## update_group_name

## update_group_picture