-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathmining.proto
103 lines (81 loc) · 2.98 KB
/
mining.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
syntax = "proto3";
import "google/protobuf/empty.proto";
import "types/types.proto";
package txpool;
option go_package = "./txpool;txpoolproto";
message OnPendingBlockRequest {}
message OnPendingBlockReply {
bytes rpl_block = 1;
}
message OnMinedBlockRequest {}
message OnMinedBlockReply {
bytes rpl_block = 1;
}
message OnPendingLogsRequest {}
message OnPendingLogsReply {
bytes rpl_logs = 1;
}
message GetWorkRequest {}
message GetWorkReply {
string header_hash = 1; // 32 bytes hex encoded current block header pow-hash
string seed_hash = 2; // 32 bytes hex encoded seed hash used for DAG
string target = 3; // 32 bytes hex encoded boundary condition ("target"), 2^256/difficulty
string block_number = 4; // hex encoded block number
}
message SubmitWorkRequest {
bytes block_nonce = 1;
bytes pow_hash = 2;
bytes digest = 3;
}
message SubmitWorkReply {
bool ok = 1;
}
message SubmitHashRateRequest {
uint64 rate = 1;
bytes id = 2;
}
message SubmitHashRateReply {
bool ok = 1;
}
message HashRateRequest {}
message HashRateReply {
uint64 hash_rate = 1;
}
message MiningRequest {}
message MiningReply {
bool enabled = 1;
bool running = 2;
}
service Mining {
// Version returns the service version number
rpc Version(google.protobuf.Empty) returns (types.VersionReply);
// subscribe to pending blocks event
rpc OnPendingBlock(OnPendingBlockRequest) returns (stream OnPendingBlockReply);
// subscribe to mined blocks event
rpc OnMinedBlock(OnMinedBlockRequest) returns (stream OnMinedBlockReply);
// subscribe to pending blocks event
rpc OnPendingLogs(OnPendingLogsRequest) returns (stream OnPendingLogsReply);
// GetWork returns a work package for external miner.
//
// The work package consists of 3 strings:
// result[0] - 32 bytes hex encoded current block header pow-hash
// result[1] - 32 bytes hex encoded seed hash used for DAG
// result[2] - 32 bytes hex encoded boundary condition ("target"), 2^256/difficulty
// result[3] - hex encoded block number
rpc GetWork(GetWorkRequest) returns (GetWorkReply);
// SubmitWork can be used by external miner to submit their POW solution.
// It returns an indication if the work was accepted.
// Note either an invalid solution, a stale work a non-existent work will return false.
rpc SubmitWork(SubmitWorkRequest) returns (SubmitWorkReply);
// SubmitHashRate can be used for remote miners to submit their hash rate.
// This enables the node to report the combined hash rate of all miners
// which submit work through this node.
//
// It accepts the miner hash rate and an identifier which must be unique
// between nodes.
rpc SubmitHashRate(SubmitHashRateRequest) returns (SubmitHashRateReply);
// HashRate returns the current hashrate for local CPU miner and remote miner.
rpc HashRate(HashRateRequest) returns (HashRateReply);
// Mining returns an indication if this node is currently mining and its mining configuration
rpc Mining(MiningRequest) returns (MiningReply);
}