PIP: PIP-0038 Title: P2P Chat and Ccommunication Type: Front-End Protocol Author: Preben Björn Biermann Madsen (nightraven) Comments-URI: https://discordapp.com/channels/@me Status: Draft Created: 2019-10-23
It is proposed to open a channel for chat and exchange of information that does not need to be stored in the blockchain.
The proposal serves two purposes.
The wallet has a Message tab that is rarely used because messages are only sent to connected nodes. However, an advanced chat can easily be developed. It just requires that incoming messages are broadcasted to the network.
In addition, Layer-2 applications will need to send data that will be a waste of resources to store in the blockchain. For example, a request and respons on an account's balance. Thise data can be transmitted together with chat messages.
The wallet already has an option for sending and receiving messages. It is this option that should be developed and extended so incomming messages and data are broadcasted to connected nodes unless it has been recieved and broadcasted before. A simple P2P protocol, perhaps like the good old Gnutella. See links.
Each message consists of a record:
TMsg = recordMsgId: MD5hash; // of a big random number Target: MD5hash; // Target can be a hash of a nick, an account or a message channel PayloadLen: Byte; // length of payload Payload: Ansistring; // the message or data to be broadcasted
end;
The MsgID is stored in a temporary data base to check if a message has been received before. Target is what nodes are listening after. Hits must be handled. Other messages are just broadcasted.
Options for encoding could be added
Options for sending messages and data should be made available both via the font-end and via RPC Json.
Example of possible use:
Here it is only suggested to make a chat and a channel for sending data. But there are many other opportunities to expand and develop this, for example, a market where traders can exchange offers.
No fork is needed.
https://sourceforge.net/projects/p2pirc/files/p2pirc/
http://capnbry.net/gnutella/protocol.php