diff --git a/README.md b/README.md index 7dca75521991071275d26624def5ded8fcbfb31a..e39036a65772e2a8e406c2d66b28daff37932043 100644 --- a/README.md +++ b/README.md @@ -74,47 +74,97 @@ To unactivate proxy, set `client.proxy` to `null`. ## Protocols -### Peer list file +### Documents + +#### Identity signature + +A document which explicitly link a ÄžMixer node which uses PUBKEY to another member pubkey. + + sign( + ubjson( + { + "doctype": "gmixer/idtysig", + "docver": IDTYSIG_VERSION, + "pubkey": PUBKEY, + "sigtime": time() + } + ) + ) + +#### Peer info + +A document generated periodically by a node, then sent to other nodes. + + { + "pubkey": PUBKEY, + "raw": sign( + ubjson( + { + "doctype": "gmixer/peer", + "docver": PEER_VERSION, + "currency": CURRENCY, + "pubkey": PUBKEY, + "sigtime": time(), + "host": [PUBLIC_ADDR, PUBLIC_PORT], + "idty": IDTY_PUBKEY, + "idtysig": IDTY_SIG, + "peers": [ + { + "hash": PEER_HASH, + "up_in": True|False|None, + "up_out": True|False|None + }, + ... + ] + } + ) + ) + } + +#### Peer info file + +A peer info file is useful for connecting a node to an existing network. It contains a list of peer infos. Format: UBJSON. - pubkey host port - ... -Example: +### HTTP API - DCovzCEnQm9GUWe6mr8u42JR1JAuoj3HbQUGdCkfTzSr localhost 10951 - EiZ8LNJmtwCDQa8W8PcnB9n8Q7QreMHsB24kS14iV5vV 12.34.56.78 443 +URL is used like commandline arguments. Arguments are separated by slashes. Different commands can be set in the same request. -### HTTP API +Command: **/json** send response in JSON instead of default UBJSON if possible (impossible if response contains binary values) -**Warning**: This doc is outdated! +Command: **/peers** list known peers (excluding itself) -URL is used like commandline arguments. Arguments are separated by slashes. Different commands can be set in the same request. + // response: + "peers": [ + { + "raw": PEER_INFO, + "up_in": True|False|None, + "up_out": True|False|None + }, + ... + ] -Command: **/list** list known peers (excluding itself) +Command: **/info** give local peer info - // response: (clear json) - "peers": [ - { "pubkey": "DCovzCEnQm9GUWe6mr8u42JR1JAuoj3HbQUGdCkfTzSr", "localhost", "10951" }, - ... - ] + // response: + "info": PEER_INFO Command: **/pubkey** get peer pubkey - // response: (clear json) - "pubkey": "ENSD6KikoZAcUVGBWJNKFREG2ryrGaHUD68GCYsiY2pK" + // response: + "pubkey": PUBKEY Command: **/version** get peer version - // response: (clear json) - "version": "0.1.0" + // response: + "version": VERSION + +Command: **/new** tell the peer about a new peer +Content: a peer info document -Command: **/new/_pubkey_** tell the peer about a new peer +**ToDo**: check behind - // request: (encrypted then signed json) - "pubkey": "EiZ8LNJmtwCDQa8W8PcnB9n8Q7QreMHsB24kS14iV5vV", // new peer pubkey - "host": "12.34.56.78", // new peer host - "port": "443", // new peer port - "time": 1551444674 // timestamp +Command: **/getconfirm/_sender\_pubkey_/_in\_seed1_** Command: **/mix/_pubkey_/_amount_/_base_** mix a transaction