Proof of work message structures

This commit is contained in:
JoelKatz
2012-11-21 09:49:00 -08:00
parent 89d54999c9
commit b4e7d8c5c3

View File

@@ -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
}