From b4e7d8c5c39ec08080024fb684dd0cd2edfceb25 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Wed, 21 Nov 2012 09:49:00 -0800 Subject: [PATCH] Proof of work message structures --- src/cpp/ripple/ripple.proto | 49 ++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/src/cpp/ripple/ripple.proto b/src/cpp/ripple/ripple.proto index 5ffbb657d..250ebf5ac 100644 --- a/src/cpp/ripple/ripple.proto +++ b/src/cpp/ripple/ripple.proto @@ -5,6 +5,7 @@ enum MessageType { mtHELLO = 1; mtERROR_MSG = 2; mtPING = 3; + mtPOW = 4; // network presence detection mtGET_CONTACTS = 10; @@ -32,20 +33,44 @@ enum MessageType { } -// Sent on connect +// empty message (or just result) = request proof of work +// token, iterations, target, challenge = give proof of work challenge +// token, response = show proof of work +// token, result = result of pow attempt +message TMProofWork +{ + optional string token = 1; + optional uint32 iterations = 2; + optional bytes target = 3; + optional bytes challenge = 4; + optional bytes response = 5; + enum POWResult + { + powrOK = 0; + powrREUSED = 1; + powrEXPIRED = 2; // You took too long solving + powrTOOEASY = 3; // Difficulty went way up, sorry + powrINVALID = 4; + powrDISCONNECT = 5; // We are disconnecting + } + optional POWResult result = 6; +} + +// Sent on connect message TMHello { - required uint32 protoVersion = 1; - required uint32 protoVersionMin = 2; - required bytes nodePublic = 3; - required bytes nodeProof = 4; - optional string fullVersion = 5; - optional uint64 netTime = 6; - optional uint32 ipv4Port = 7; - optional uint32 ledgerIndex = 8; - optional bytes ledgerClosed = 9; // our last closed ledger - optional bytes ledgerPrevious = 10; // the ledger before the last closed ledger - optional bool nodePrivate = 11; // Request to not forward IP. + required uint32 protoVersion = 1; + required uint32 protoVersionMin = 2; + required bytes nodePublic = 3; + required bytes nodeProof = 4; + optional string fullVersion = 5; + optional uint64 netTime = 6; + optional uint32 ipv4Port = 7; + optional uint32 ledgerIndex = 8; + optional bytes ledgerClosed = 9; // our last closed ledger + optional bytes ledgerPrevious = 10; // the ledger before the last closed ledger + optional bool nodePrivate = 11; // Request to not forward IP. + optional TMProofWork proofOfWork = 12; // request/provide proof of work }