NilChat / Nillion Network
NCWA (Nillion Chat Web App) uses the Nillion network to store messages in a peer-to-peer fashion. Think of NCWA as a WhatsApp or Signal or Telegram, but in a peer-to-peer way without the reliance of a central server or authority.
The goal is to develop a light web client for NCWA, equivalent to WhatsApp Web (https://web.whatsapp.com/)
The idea is to develop a quick PoC to showcase the capability, not to develop a production-ready app for millions of users.
POST /create-account
Associates an email address with a backend generated user key (note we can get the user id from the user key).
This association is done once.
GET /account
Retrieves the current user id to be displayed
GET /email
Checks if an email is registered - so that we can store a message for that user
POST /message
Stores a message for a given user email
Associates in the backend the target user email, alongside the store message id
GET /messages
Reads all messages from a given user id
This goes through the list of stored messages ids and read them from the network and return them
CREATE TABLE NilAccount (
user_email varchar(255),
user_key varchar(255),
user_id varchar(255),
PRIMARY KEY (user_email)
);
CREATE TABLE NilMessage (
from_user_email varchar(255),
to_user_email varchar(255),
store_id varchar(255),
read boolean default false,
PRIMARY KEY (from_user_email, to_user_email, store_id)
);NilAccount stores on-off data post registration - i.e., first time the user logs in. user_key, node_key and user_id are generated by gen_user_keys.
NilMessage stores all messages via the store_ids.