owned this note
owned this note
Published
Linked with GitHub
# Social DNA - HoloChat
Social DNA is the idea of using a unique DNA with each group of agents an agent interacts with. In HoloChat a channel would be a DNA as would a Private Chat. For resilience a HOLO Port should be used as one of the agents in the DNA for small groups and Private Chats.
## Rules - Etiquette
As part of joining a DNA agent accepts the rules coded in to the DNA. Agent creating the DNA uses an app to design the rules which are then part of the DNA. The agent joining gets a copy of the rules from the Agent they have requested access from and adds the rules to their own copy of the UI App (this is the DNA and UI that the rest are managed from) and creates their own DNA that will have the same Hash as the rest of the group. If the rules need to change then the DNA also changes and we have a trustable record of a DNA's history. When there is an upgrade each agent downloads the latest DNA and then combines the coutersigned rules and recreates the new DNA.
## HoloChat
HoloChat has a copy of the "Channel DNA code" stored as an entry. Then when a Channel is created use hcadmin to create the new DNA from the stored package.
- Agent "installs" HoloChat
- Key management done
- HoloChat has T&C, HOLO cost to use etc
- HoloChat keeps a list of public Channels (DNA) an agent can join
- Agent joins channel by accepting rules of the channel, creating their own version of the DNA hash key and running that DNA.
- Data for that DNA now available and only shared to those in the group!
- Agent creates their own DNA by using rules engine on HoloChat, likely to be a "Friends" DNA.
- Agent keeps a private list of DNAs and the UI state keeps the hash for the DNA that the content is for.
- Hash of DNA is part of request
- Posting a message into a group uses the Hash and the message to get the message posted into the right DNA.
```mermaid
graph LR
Errol1(Searches for philt3r)
```
```
## Bridging to Each DNA
- Agent clicks the channel in HoloChat app
- Channels and People available stored in HoloChat
- Each "Team" has its own DNA as well
- Channels (DNAs) Agent is part of Stored in HoloVault
- HoloChat retrieves feed by bridging to the DNA selected
```jsx=
function getAllChannelsBridge () {
return bridge(TeamDNA, 'HoloChat', 'getAllChannels', '')
}
function getMyChannelsBridge () {
return bridge(HoloVaultDNA, 'HoloVault', 'getMyChannels', '')
}
function getMessagesBridge (ChannelDNA) {
return bridge(ChannelDNA, 'HoloChat', 'getMessages', '')
}
function getAllMessagesBridge () {
iterateListOfDNAs --> ChannelDNA
messages.push(bridge(ChannelDNA, 'HoloChat', 'getMessages', ''))
return messages
}
```
## Testing Setup
#### Hypothesis: We can segregate data with Multiple DNAs.
We need to simulate a common setup such as a messaging application with mulitple channels, and private channels. The following is based on HoloChat
To do that:
- Create 3 DNAs
- Copy the DNA folder to 3 folders
- welcome
- technical
- ico
- Make a change to the dna.json file so it generates its a new hash on hcdev web
- Use this bridge_spec.json in each agent so they are bridged to each DNA.
- hcd enables adding bridges at run time which we will use when this idea is more compelete.
```jsx
[
{
"Path": "../welcome",
"Side": 1,
"BridgeZome": "messages"
},
{
"Path": "../technical",
"Side": 1,
"BridgeZome": "messages"
},
{
"Path": "../ico",
"Side": 1,
"BridgeZome": "messages"
}
]
```
- Create 10 agents that each use the same UI App DNA. Each agent will have their own "port" and run the same version of HoloChat and be bridged to the DNAs
#### Like this for 10 Agents
```shell
$ hcdev -execpath=$HOME/.holochaindev1 -no-nat-upnp -port=6001 -agentID=agent3141 -mdns=true web 3141
$ hcdev -execpath=$HOME/.holochaindev2 -no-nat-upnp -port=6002 -agentID=agent4141 -mdns=true web 4141
$ hcdev -execpath=$HOME/.holochaindev3 -no-nat-upnp -port=6003 -agentID=agent5141 -mdns=true web 5141
```
- Add data to each of the DNA through the DNA of the UI App
- use cy.request('') to POST data from each agent
- Agent 1
- Sees messages from 2,3,4,5,6,7,8,9 & 10 in Welcome
- Sees messages from 2,3,4 in Technical
- Sees messages from 5,6,7 in ICO
- Agent 2,3,4
- Post 1 message in Welcome DNA
- Post 1 message in Technical DNA
- Sees messages from 2,3,4,5,6,7,8,9 & 10 in Welcome
- Sees messages from 2,3,4 in Technical
- Agent 5,6,7
- Post 1 message in Welcome DNA
- Post 1 message in ICO DNA
- Sees messages from 2,3,4,5,6,7,8,9 & 10 in Welcome
- Sees messages from 5,6,7 in ICO
- Agent 8,9,10
- Post 1 message in Welcome DNA
- Sees messages from 2,3,4,5,6,7,8,9 & 10 in Welcome
## Storing the channel DNA
```jsx
[
{
"name": "welcome",
"dna": "QmaqMroPXpPU4EdMtkodugx7NMyVcFyKmkVQRqUUzAaELz"
},
{
"name": "technical",
"dna": "Qmd4GxKD7uFEsPZezUMbaKYL41qrjcWj6tLEh7QCHdSsk5"
},
{
"name": "ico",
"dna": "QmNvYEuGcs4pJnzXfx4JzJ4hb8rrqCeN84Pr226pyz6is8"
}
]
var dna = query({Return:{Entries:true},
{Constrain:{EntryTypes:["channel"],
Equals:{"name":"welcome"}})[0]['dna']
```