Files
rippled/newcoin.proto
2011-12-19 20:34:45 -08:00

209 lines
4.9 KiB
Protocol Buffer

package newcoin;
enum MessageType {
// core
mtHELLO= 0;
mtERROR_MSG= 1;
mtPING= 2;
// network presence detection
mtGET_CONTACTS= 10;
mtCONTACT= 11;
// operations for 'small' nodes
mtSEARCH_TRANSACTION= 20;
mtGET_ACCOUNT= 21;
mtACCOUNT= 22;
// transaction and ledger processing
mtTRANSACTION= 30;
mtGET_LEDGER= 31;
mtLEDGER= 32;
mtPROPOSE_LEDGER= 33;
mtCLOSE_LEDGER= 35;
// data replication and synchronization
mtGET_VALIDATIONS= 40;
mtVALIDATION= 41;
mtGET_OBJECT= 42;
mtOBJECT= 43;
}
// Sent on connect
message TMHello {
required uint32 version = 1;
optional uint32 ledgerIndex = 2;
optional uint64 netTime = 3;
optional bytes nodeID = 4; // node may opt to remain anonymous
}
/*
A transaction can have only one input and one output.
If you want to send an amount that is greater than any single address of yours
you must first combine coins from one address to another.
*/
enum TransactionStatus {
tsNEW = 1; // origin node did/could not validate
tsCURRENT = 2; // scheduled to go in this ledger
tsCOMMITED = 3; // in a closed ledger
tsREJECT_CONFLICT = 4;
tsREJECT_INVALID = 5;
tsREJECT_FUNDS = 6;
tsHELD_SEQ = 7;
tsHELD_LEDGER = 8; // held for future ledger
}
message TMTransaction {
required bytes rawTransaction = 1;
required TransactionStatus status = 9;
optional uint64 receiveTimestamp = 10;
optional uint32 ledgerIndexPossible = 11; // the node may not know
optional uint32 ledgerIndexFinal = 12;
optional bytes conflictingTransaction = 13;
}
message TMProposeLedger {
required uint32 closingSeq = 1;
required uint32 secondsSinceClose = 2;
required bytes previousLedgerHash = 3; // 0 if first proposal, hash we no longer propose
required bytes currentLedgerHash = 4; // the hash of the ledger we are proposing
required bytes hanko = 5;
repeated bytes addedTransactions = 6;
repeated bytes removedTransactions = 7;
required bytes signature = 8;
}
// Used to propose/validate during ledger close
message TMValidation {
required uint32 ledgerIndex = 1;
required bytes ledgerHash = 2;
optional uint64 timestamp = 3; // only in proposed ledgers
optional uint32 confidence = 4; // only in proposed ledgers
required bytes hanko = 5;
required bytes sig = 6;
}
message TMGetValidations {
required uint32 ledgerIndex = 1;
repeated bytes hanko = 2;
optional uint32 count = 3; // get random validations
}
message TMContact {
required bytes pubKey = 1;
required uint32 softwareVersion = 2;
required uint32 protoVersion = 3;
required uint64 nodeFlags = 4;
required uint64 timestamp = 5;
repeated bytes nodeInfo = 6;
required bytes signature = 7;
}
// request node information
message TMGetContacts {
repeated bytes nodeIDs =1; // specific nodes we want
optional uint32 nodeCount =2; // get some random nodes
}
message TMSearchTransaction {
required uint32 maxTrans =1;
optional bytes toAccount =2;
optional bytes fromAccount =3;
optional uint32 minLedger =4;
optional bytes fromAcctSeq =5;
repeated bytes transID =6;
}
message TMGetAccount {
repeated bytes acctID =1;
optional uint32 seq =2;
}
message Account {
required bytes accountID =1;
required uint64 balance =2;
required uint32 accountSeq =3;
required uint32 ledgerSeq =4;
}
message TMAccount{
repeated Account accounts =1;
optional uint32 seq =2;
}
message TMIndexedObject
{
enum ObjectType {
otTRANSACTION = 1;
otTRANSACTION_NODE = 2; // a node in a transaction tree
otTRANSACTION_LEAF = 3; // a leaf in a transaction tree
otACCOUNT = 4; // a single account state (with balance/sequence)
otACCOUNT_NODE = 5; // a node in an account state tree
otACCOUNT_LEAF = 6; // a leaf in an account state tree
otLEDGER = 7;
}
required bytes hash = 1;
required ObjectType type = 2;
}
message TMGetObjectByHash
{
required TMIndexedObject object = 1;
optional uint32 seq = 2; // used to match replies to queries
}
message TMObjectByHash
{
optional TMIndexedObject object = 1; // present unless no object found
optional bytes data = 2; // present unless no object found
optional uint32 seq = 3; // matches seq from query
}
message LedgerNodes {
required bytes nodeid = 1;
required bytes nodedata = 2;
}
message TMGetLedger {
optional bytes hash = 1;
optional uint32 ledgerSeq = 2;
repeated LedgerNodes nodes = 3;
optional uint32 seq = 4; // used to match replies to queries
}
message TMLedger {
required bytes hash = 1;
repeated LedgerNodes nodes = 2;
optional uint32 seq = 3; // matches seq from query
}
message TMPing {
enum pingType {
PING = 0; // we want a reply
PONG = 1; // this is a reply
}
required pingType type = 1;
optional uint32 seq = 2; // detect stale replies, ensure other side is reading
optional uint64 pingTime = 3; // know when we think we sent the ping
optional uint64 netTime = 4;
}
message TMErrorMsg {
optional int32 errorCode = 1;
optional string message = 2;
}