From e392f801a53081414f17c2da1d0f12b34cc1ccb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20Eng=C3=A9libert?= <tuxmain@zettascript.org> Date: Thu, 26 Sep 2019 08:10:59 +0200 Subject: [PATCH] Update protocol doc --- README.md | 35 ++++++++++++++++++++++++++++++++++- server.py | 2 +- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2a7d674..d5412b8 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,28 @@ A document generated periodically by a node, then sent to other nodes. A peer info file is useful for connecting a node to an existing network. It contains a list of peer infos. Format: UBJSON. +#### Confirmation + +A document generated by a node, to confirm they engage to send a certain tx if they receive another certain tx. + + sign( + ubjson( + { + "document": "gmixer-mixconfirm1", + "sender_pubkey": self.sender_pubkey, + "receiver_pubkey": keys.pubkey, + "in_amount": self.in_amount, + "in_base": self.in_base, + "in_seeds": self.in_seeds, + "receiver_pubkey": self.receiver_pubkey, + "out_amount": self.out_amount, + "out_base": self.out_base, + "out_seeds": self.out_seeds, + "req_date": self.date, + "expire_date": self.expire + } + ) + ) ### HTTP API @@ -164,8 +186,19 @@ Content: a peer info document Command: **/getconfirm/_sender\_pubkey_/_in\_seed1_** get mix confirmation + ENCRYPTED_CONFIRM = encrypt( // to client's one-time key + CONFIRM + ) + // response: - "confirm": CONFIRMATION + "confirm": sign( + // binary + IN_SEED_1 + IN_SEED_2 + length(ENCRYPTED_CONFIRM) // unsigned int 32 bits, Big Endian + ENCRYPTED_CONFIRM + CONFIRMS // Each confirm is preceded by its length, as above + ) Command: **/mix/_sender_/_amount_/_base_[/client]** mix a transaction (set "client" option if request is sent to entry node) * If "client": _sender_ is the sender pubkey diff --git a/server.py b/server.py index 0324834..c070883 100644 --- a/server.py +++ b/server.py @@ -868,7 +868,7 @@ def main(): peers = {} db_peers = plyvel.DB(DIR+"/db_peers", create_if_missing=True) utils.load_peers(conf, db_peers, peers) - utils.logprint("Loaded " + str(len(peers)) + " peers", utils.LOG_TRACE) + utils.logprint("Loaded " + str(len(peers)) + " peers", utils.LOG_INFO) # Load txs pool = [] -- GitLab