-
Notifications
You must be signed in to change notification settings - Fork 158
NKN Client Protocol
NKN client can be written in any language as long as the following protocol is implemented.
Each client has a unique and permanent NKN address, which consists of an arbitrary string and a public key, see more at https://github.com/nknorg/nkn/wiki/Tech-Design-Doc%3A-NKN-Address-Scheme#clients
Note that all communications with nodes use the pre-hash raw string "anything.public" for client NKN address.
Currently the key pair is generated with p256r1 curve, but we plan to move to ed25519 soon. The cryptographic scheme used is based on the ed25519 twisted Edwards' curve.
Each NKN client has a designated NKN node it should establish websocket connection depending on the client NKN address. Trying to connect to other nodes will get an error. During initialization, client should make a JSON-RPC call getwsaddr to get the node it should establish websocket connection with.
After getting the node websocket address, it should establish a websocket connection and send setClient message to register with the node before sending anything.
Send sendPacket message to node through websocket.
A receivePacket message will be pushed from node through websocket.