Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,056 changes: 14 additions & 1,042 deletions documentation.swagger.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions model/accountBalance.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ option go_package = "github.com/zoobc/zoobc-core/common/model";
message AccountBalance {
string AccountAddress = 1;
uint32 BlockHeight = 2;
int64 SpendableBalance = 3;
int64 Balance = 4;
int64 PopRevenue = 5;
int64 SpendableBalance = 3 [jstype = JS_STRING];
int64 Balance = 4 [jstype = JS_STRING];
int64 PopRevenue = 5 [jstype = JS_STRING];
bool Latest = 6;
}

Expand Down
37 changes: 29 additions & 8 deletions model/block.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ import "model/transaction.proto";

// Block represent the block data structure stored in the database
message Block {
int64 ID = 1;
int64 ID = 1 [jstype = JS_STRING];
bytes PreviousBlockHash = 2;
uint32 Height = 3;
int64 Timestamp = 4;
int64 Timestamp = 4 [jstype = JS_STRING];
bytes BlockSeed = 5;
bytes BlockSignature = 6;
string CumulativeDifficulty = 7;
int64 SmithScale = 8;
int64 SmithScale = 8 [jstype = JS_STRING];
string BlocksmithAddress = 9;
int64 TotalAmount = 10;
int64 TotalFee = 11;
int64 TotalCoinBase = 12;
int64 TotalAmount = 10 [jstype = JS_STRING];
int64 TotalFee = 11 [jstype = JS_STRING];
int64 TotalCoinBase = 12 [jstype = JS_STRING];
uint32 Version = 13;
uint32 PayloadLength = 14;
bytes PayloadHash = 15;
Expand All @@ -31,7 +31,7 @@ message GetBlockRequest {
// Number indicating chaintype
int32 ChainType = 1;
// Block ID
int64 ID = 2;
int64 ID = 2 [jstype = JS_STRING] ;
// number of block to fetch
uint32 Height = 3;
}
Expand All @@ -54,5 +54,26 @@ message GetBlocksResponse {
// Blocks height returned from
uint32 Height = 3;
// Blocks returned
repeated Block blocks = 4;
repeated Block Blocks = 4;
}

message GetNextBlockIdsRequest {
// Number indicating chaintype
int32 ChainType = 1;
int64 BlockId =2 [jstype = JS_STRING];
uint32 Limit = 3;
}
message BlockIdsResponse {
repeated int64 BlockIds = 1 [jstype = JS_STRING];
}

message GetNextBlocksRequest {
// Number indicating chaintype
int32 ChainType = 1;
int64 BlockId = 2 [jstype = JS_STRING];
repeated int64 BlockIds = 3 [jstype = JS_STRING];
}

message BlocksData {
repeated Block NextBlocks = 1;
}
36 changes: 36 additions & 0 deletions model/blockchain.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
syntax="proto3";

package model;

option go_package = "github.com/zoobc/zoobc-core/common/model";

import "model/block.proto";

message ChainStatus{
// Integer indicating chaintype
int32 ChainType = 1;
uint32 Height = 2;
Block LastBlock = 3;
}

message GetCumulativeDifficultyResponse {
string CumulativeDifficulty = 1;
uint32 Height = 2;
}

message GetCumulativeDifficultyRequest {
// Integer indicating chaintype
int32 ChainType = 1;
}

message GetCommonMilestoneBlockIdsRequest {
// Integer indicating chaintype
int32 ChainType = 1;
int64 LastBlockID = 2 [jstype = JS_STRING];
int64 LastMilestoneBlockID = 3 [jstype = JS_STRING];
}

message GetCommonMilestoneBlockIdsResponse {
repeated int64 BlockIds = 1 [jstype = JS_STRING];
bool Last = 2;
}
6 changes: 6 additions & 0 deletions model/host.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ option go_package = "github.com/zoobc/zoobc-core/common/model";

import "model/node.proto";
import "model/peer.proto";
import "model/blockchain.proto";

// Host represent data sructure node and listed peers in node it's self
message Host {
Expand All @@ -16,3 +17,8 @@ message Host {
map<string, Peer> BlacklistedPeers = 5;
bool Stopped = 6;
}

message HostInfo{
Host Host = 1;
repeated ChainStatus ChainStatuses = 2;
}
8 changes: 4 additions & 4 deletions model/mempool.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ option go_package = "github.com/zoobc/zoobc-core/common/model";

// Mempool represent the mempool data structure stored in the database
message MempoolTransaction {
int64 ID = 1;
int64 ID = 1 [jstype = JS_STRING];
int32 FeePerByte = 2;
int64 ArrivalTimestamp = 3;
int64 ArrivalTimestamp = 3 [jstype = JS_STRING];
bytes TransactionBytes = 4;
string SenderAccountAddress = 5;
string RecipientAccountAddress = 6;
Expand All @@ -24,9 +24,9 @@ message GetMempoolTransactionResponse {

message GetMempoolTransactionsRequest {
// Fetch Mempool transactions from arrival timestamp start from n
int64 timestampStart = 1;
int64 timestampStart = 1 [jstype = JS_STRING];
// Fetch Mempool transactions to arrival timestamp end until n
int64 timestampEnd = 2;
int64 timestampEnd = 2 [jstype = JS_STRING];
// SenderAddress and RecipientAddress
string address = 3;
uint32 Limit = 4;
Expand Down
8 changes: 4 additions & 4 deletions model/nodeRegistration.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ option go_package = "github.com/zoobc/zoobc-core/common/model";


message NodeRegistration {
int64 NodeID = 1;
int64 NodeID = 1 [jstype = JS_STRING];
bytes NodePublicKey = 2;
string AccountAddress = 3;
uint32 RegistrationHeight = 4;
string NodeAddress = 5;
int64 LockedBalance = 6;
int64 LockedBalance = 6 [jstype = JS_STRING];
bool Queued = 7;
bool Latest = 8;
uint32 Height = 9;
Expand All @@ -38,7 +38,7 @@ message UpdateNodeRegistrationRequest {
bytes NodePublicKey = 2;
string AccountAddress = 3;
string NodeAddress = 4;
int64 LockedBalance = 5;
int64 LockedBalance = 5 [jstype = JS_STRING];
}

message GetNodeRegistrationsResponse {
Expand All @@ -47,7 +47,7 @@ message GetNodeRegistrationsResponse {
string AccountAddress = 3;
uint32 RegistrationHeight = 4;
string NodeAddress = 5;
int64 LockedBalance = 6;
int64 LockedBalance = 6 [jstype = JS_STRING];
bool Queued = 7;
bool Latest = 8;
uint32 Height = 9;
Expand Down
4 changes: 2 additions & 2 deletions model/peer.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ message Peer {
Node Info = 1;
uint32 LastInboundRequest = 2;
string BlacklistingCause = 3;
uint64 BlacklistingTime = 4;
int64 LastUpdated = 5;
uint64 BlacklistingTime = 4 [jstype = JS_STRING];
int64 LastUpdated = 5 [jstype = JS_STRING];
int32 connectionAttempted = 6;
}

Expand Down
18 changes: 9 additions & 9 deletions model/transaction.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import "model/proofOfOwnership.proto";
// Transaction represent the transaction data structure stored in the database
message Transaction {
uint32 Version = 1;
int64 ID = 2;
int64 BlockID = 3;
int64 ID = 2 [jstype = JS_STRING];
int64 BlockID = 3 [jstype = JS_STRING];
uint32 Height = 4;
string SenderAccountAddress = 5;
string RecipientAccountAddress = 6;
uint32 TransactionType = 7;
int64 Fee = 8;
int64 Timestamp = 9;
int64 Fee = 8 [jstype = JS_STRING];
int64 Timestamp = 9 [jstype = JS_STRING];
bytes TransactionHash = 10;
uint32 TransactionBodyLength = 11;
bytes TransactionBodyBytes = 12;
Expand All @@ -33,21 +33,21 @@ message Transaction {
message EmptyTransactionBody {}

message SendMoneyTransactionBody {
int64 Amount = 1;
int64 Amount = 1 [jstype = JS_STRING];
}

message NodeRegistrationTransactionBody {
bytes NodePublicKey = 1;
string AccountAddress = 2;
string NodeAddress = 3;
int64 LockedBalance = 4;
int64 LockedBalance = 4 [jstype = JS_STRING];
ProofOfOwnership Poown = 5;
}

message UpdateNodeRegistrationTransactionBody {
bytes NodePublicKey = 1;
string NodeAddress = 2;
int64 LockedBalance = 3;
int64 LockedBalance = 3 [jstype = JS_STRING];
ProofOfOwnership Poown = 4;
}

Expand All @@ -59,7 +59,7 @@ message UpdateNodeRegistrationTransactionBody {
// GetTransactionRequest return model.Transaction
message GetTransactionRequest {
// Fetch Transaction by its ID
int64 ID = 1;
int64 ID = 1 [jstype = JS_STRING];
}

// GetTransactions return GetTransactionsResponse
Expand All @@ -70,7 +70,7 @@ message GetTransactionsRequest {
}
message GetTransactionsResponse {
// Number of transactions in total
uint64 Total = 1;
uint64 Total = 1 [jstype = JS_STRING];
// Transaction transactions returned
repeated Transaction Transactions = 2;
}
Expand Down
2 changes: 1 addition & 1 deletion service/host.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import "google/api/annotations.proto";

// HostService represent request on Blockchain's Block
service HostService {
rpc GetHostInfo(model.Empty) returns (model.Host) {
rpc GetHostInfo(model.Empty) returns (model.HostInfo) {
option (google.api.http) = {
get: "/v1/host/GetHostInfo"
};
Expand Down
6 changes: 6 additions & 0 deletions service/p2pCommunication.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import "model/peer.proto";
import "model/node.proto";
import "model/empty.proto";
import "model/block.proto";
import "model/blockchain.proto";
import "model/transaction.proto";

service P2PCommunication {
Expand All @@ -16,4 +17,9 @@ service P2PCommunication {
rpc SendPeers(model.SendPeersRequest) returns (model.Empty) {}
rpc SendBlock (model.Block) returns (model.Empty) {}
rpc SendTransaction (model.SendTransactionRequest) returns (model.Empty) {}

rpc GetCumulativeDifficulty(model.GetCumulativeDifficultyRequest) returns (model.GetCumulativeDifficultyResponse){}
rpc GetCommonMilestoneBlockIDs(model.GetCommonMilestoneBlockIdsRequest) returns (model.GetCommonMilestoneBlockIdsResponse) {}
rpc GetNextBlockIDs(model.GetNextBlockIdsRequest) returns (model.BlockIdsResponse) {}
rpc GetNextBlocks(model.GetNextBlocksRequest) returns (model.BlocksData) {}
}