2015-12-30 23:19:09 +03:00
|
|
|
syntax = "proto3";
|
|
|
|
|
2016-10-16 00:38:47 +03:00
|
|
|
import "google/api/annotations.proto";
|
|
|
|
|
2015-12-30 23:19:09 +03:00
|
|
|
package lnrpc;
|
|
|
|
|
|
|
|
service Lightning {
|
2016-10-16 00:38:47 +03:00
|
|
|
rpc WalletBalance(WalletBalanceRequest) returns (WalletBalanceResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
get: "/v1/balance/blockchain"
|
|
|
|
};
|
|
|
|
}
|
|
|
|
rpc ChannelBalance(ChannelBalanceRequest) returns (ChannelBalanceResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
get: "/v1/balance/channels"
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
rpc GetTransactions(GetTransactionsRequest) returns (TransactionDetails) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
get: "/v1/transactions"
|
|
|
|
};
|
|
|
|
}
|
|
|
|
rpc SendCoins(SendCoinsRequest) returns (SendCoinsResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
post: "/v1/transactions"
|
|
|
|
body: "*"
|
|
|
|
};
|
|
|
|
}
|
|
|
|
rpc SubscribeTransactions(GetTransactionsRequest) returns (stream Transaction);
|
2016-09-15 21:59:51 +03:00
|
|
|
|
2015-12-31 05:58:15 +03:00
|
|
|
rpc SendMany(SendManyRequest) returns (SendManyResponse);
|
2015-12-31 06:02:24 +03:00
|
|
|
|
2016-10-16 00:38:47 +03:00
|
|
|
rpc NewAddress(NewAddressRequest) returns (NewAddressResponse);
|
|
|
|
rpc NewWitnessAddress(NewWitnessAddressRequest) returns (NewAddressResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
get: "/v1/newaddress"
|
|
|
|
};
|
|
|
|
}
|
2016-06-21 21:52:09 +03:00
|
|
|
|
2016-10-16 00:38:47 +03:00
|
|
|
rpc ConnectPeer(ConnectPeerRequest) returns (ConnectPeerResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
post: "/v1/peers"
|
|
|
|
body: "*"
|
|
|
|
};
|
|
|
|
}
|
|
|
|
rpc ListPeers(ListPeersRequest) returns (ListPeersResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
get: "/v1/peers"
|
|
|
|
};
|
|
|
|
}
|
|
|
|
rpc GetInfo(GetInfoRequest) returns (GetInfoResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
get: "/v1/getinfo"
|
|
|
|
};
|
|
|
|
}
|
2016-09-26 06:02:33 +03:00
|
|
|
|
2016-10-16 00:38:47 +03:00
|
|
|
// TODO(roasbeef): merge with below with bool?
|
|
|
|
rpc PendingChannels(PendingChannelRequest) returns (PendingChannelResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
get: "/v1/channels/pending"
|
|
|
|
};
|
|
|
|
}
|
|
|
|
rpc ListChannels(ListChannelsRequest) returns (ListChannelsResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
get: "/v1/channels"
|
|
|
|
};
|
|
|
|
}
|
2016-11-11 04:33:24 +03:00
|
|
|
rpc OpenChannelSync(OpenChannelRequest) returns (ChannelPoint) {
|
2016-10-16 00:38:47 +03:00
|
|
|
option (google.api.http) = {
|
|
|
|
post: "/v1/channels"
|
|
|
|
body: "*"
|
|
|
|
};
|
|
|
|
}
|
2016-11-11 04:33:24 +03:00
|
|
|
|
|
|
|
rpc OpenChannel(OpenChannelRequest) returns (stream OpenStatusUpdate);
|
|
|
|
|
2016-10-16 00:38:47 +03:00
|
|
|
rpc CloseChannel(CloseChannelRequest) returns (stream CloseStatusUpdate) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
delete: "/v1/channels/{channel_point.funding_txid}/{channel_point.output_index}/{force}"
|
|
|
|
};
|
|
|
|
}
|
2016-07-13 03:36:34 +03:00
|
|
|
|
2016-11-11 04:33:24 +03:00
|
|
|
rpc SendPayment(stream SendRequest) returns (stream SendResponse);
|
|
|
|
|
|
|
|
rpc SendPaymentSync(SendRequest) returns (SendResponse) {
|
2016-10-16 00:38:47 +03:00
|
|
|
option (google.api.http) = {
|
|
|
|
post: "/v1/channels/transactions"
|
|
|
|
body: "*"
|
|
|
|
};
|
|
|
|
}
|
2016-09-19 21:52:23 +03:00
|
|
|
|
2016-10-16 00:38:47 +03:00
|
|
|
rpc AddInvoice(Invoice) returns (AddInvoiceResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
post: "/v1/invoices"
|
|
|
|
body: "*"
|
|
|
|
};
|
|
|
|
}
|
|
|
|
rpc ListInvoices(ListInvoiceRequest) returns (ListInvoiceResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
get: "/v1/invoices/{pending_only}"
|
|
|
|
};
|
|
|
|
}
|
|
|
|
rpc LookupInvoice(PaymentHash) returns (Invoice) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
get: "/v1/invoices/{r_hash_str}"
|
|
|
|
};
|
|
|
|
}
|
|
|
|
rpc SubscribeInvoices(InvoiceSubscription) returns (stream Invoice) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
get: "/v1/invoices/subscribe"
|
|
|
|
};
|
|
|
|
}
|
2016-09-19 21:52:23 +03:00
|
|
|
|
2016-07-15 14:02:59 +03:00
|
|
|
rpc ShowRoutingTable(ShowRoutingTableRequest) returns (ShowRoutingTableResponse);
|
2016-12-05 14:59:36 +03:00
|
|
|
|
|
|
|
rpc ListPayments(ListPaymentsRequest) returns (ListPaymentsResponse){
|
|
|
|
option (google.api.http) = {
|
|
|
|
get: "/v1/payments"
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
rpc DeleteAllPayments(DeleteAllPaymentsRequest) returns (DeleteAllPaymentsResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
delete: "/v1/payments"
|
|
|
|
};
|
|
|
|
};
|
2016-07-13 03:36:34 +03:00
|
|
|
}
|
|
|
|
|
2016-10-16 00:38:47 +03:00
|
|
|
|
|
|
|
message Transaction {
|
|
|
|
string tx_hash = 1;
|
|
|
|
double amount = 2;
|
|
|
|
int32 num_confirmations = 3;
|
|
|
|
string block_hash = 4;
|
|
|
|
int32 block_height = 5;
|
|
|
|
int64 time_stamp = 6;
|
|
|
|
int64 total_fees = 7;
|
|
|
|
}
|
|
|
|
message GetTransactionsRequest {
|
|
|
|
}
|
|
|
|
message TransactionDetails {
|
|
|
|
repeated Transaction transactions = 1;
|
|
|
|
}
|
|
|
|
|
2016-07-13 03:36:34 +03:00
|
|
|
message SendRequest {
|
|
|
|
bytes dest = 1;
|
2016-11-11 04:33:24 +03:00
|
|
|
string dest_string = 2;
|
|
|
|
|
|
|
|
int64 amt = 3;
|
2016-07-13 03:36:34 +03:00
|
|
|
|
2016-11-11 04:33:24 +03:00
|
|
|
bytes payment_hash = 4;
|
|
|
|
string payment_hash_string = 5;
|
|
|
|
|
|
|
|
bool fast_send = 6;
|
2016-07-13 03:36:34 +03:00
|
|
|
}
|
2016-10-16 00:38:47 +03:00
|
|
|
message SendResponse {
|
2016-07-13 03:36:34 +03:00
|
|
|
// TODO(roasbeef): info about route? stats?
|
2015-12-30 23:19:09 +03:00
|
|
|
}
|
|
|
|
|
2016-06-21 21:52:09 +03:00
|
|
|
message ChannelPoint {
|
|
|
|
bytes funding_txid = 1;
|
2016-10-16 00:38:47 +03:00
|
|
|
string funding_txid_str = 2;
|
|
|
|
uint32 output_index = 3;
|
2016-06-21 21:52:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
message LightningAddress {
|
2016-10-28 05:41:42 +03:00
|
|
|
string pubkey = 1;
|
2016-06-21 21:52:09 +03:00
|
|
|
string host = 2;
|
|
|
|
}
|
|
|
|
|
2015-12-30 23:19:09 +03:00
|
|
|
message SendManyRequest {
|
|
|
|
map<string, int64> AddrToAmount = 1;
|
|
|
|
}
|
|
|
|
message SendManyResponse {
|
|
|
|
string txid = 1;
|
|
|
|
}
|
|
|
|
|
2016-06-29 21:28:10 +03:00
|
|
|
message SendCoinsRequest {
|
|
|
|
string addr = 1;
|
|
|
|
int64 amount = 2;
|
|
|
|
}
|
|
|
|
message SendCoinsResponse {
|
|
|
|
string txid = 1;
|
|
|
|
}
|
|
|
|
|
2016-04-25 06:26:32 +03:00
|
|
|
message NewAddressRequest {
|
|
|
|
enum AddressType {
|
|
|
|
WITNESS_PUBKEY_HASH = 0;
|
|
|
|
NESTED_PUBKEY_HASH = 1;
|
|
|
|
PUBKEY_HASH = 2;
|
|
|
|
}
|
|
|
|
AddressType type = 1;
|
|
|
|
}
|
2016-10-16 00:38:47 +03:00
|
|
|
message NewWitnessAddressRequest {}
|
2015-12-30 23:19:09 +03:00
|
|
|
message NewAddressResponse {
|
|
|
|
string address = 1;
|
|
|
|
}
|
2015-12-31 05:58:15 +03:00
|
|
|
|
2016-01-17 06:03:47 +03:00
|
|
|
message ConnectPeerRequest {
|
2016-06-21 21:52:09 +03:00
|
|
|
LightningAddress addr = 1;
|
2015-12-31 05:58:15 +03:00
|
|
|
}
|
2016-01-17 06:03:47 +03:00
|
|
|
message ConnectPeerResponse {
|
2016-06-21 21:52:09 +03:00
|
|
|
int32 peer_id = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message HTLC {
|
2016-09-26 06:02:33 +03:00
|
|
|
bool incoming = 1;
|
2016-06-21 21:52:09 +03:00
|
|
|
int64 amount = 2;
|
|
|
|
bytes hash_lock = 3;
|
2016-09-26 06:02:33 +03:00
|
|
|
uint32 expiration_height = 4;
|
|
|
|
uint32 revocation_delay = 5;
|
2016-06-21 21:52:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
message ActiveChannel {
|
2016-09-26 06:02:33 +03:00
|
|
|
string remote_pubkey = 1;
|
2016-06-23 08:06:37 +03:00
|
|
|
string channel_point = 2;
|
2016-06-21 21:52:09 +03:00
|
|
|
|
2016-06-23 08:06:37 +03:00
|
|
|
int64 capacity = 3;
|
|
|
|
int64 local_balance = 4;
|
|
|
|
int64 remote_balance = 5;
|
2016-06-21 21:52:09 +03:00
|
|
|
|
2016-09-26 06:02:33 +03:00
|
|
|
int64 unsettled_balance = 6;
|
2016-11-19 03:20:44 +03:00
|
|
|
int64 total_satoshis_sent = 7;
|
|
|
|
int64 total_satoshis_received = 8;
|
|
|
|
uint64 num_updates = 9;
|
2016-06-21 21:52:09 +03:00
|
|
|
|
2016-11-19 03:20:44 +03:00
|
|
|
repeated HTLC pending_htlcs = 10;
|
2016-06-21 21:52:09 +03:00
|
|
|
// TODO(roasbeef): other stuffs
|
|
|
|
}
|
|
|
|
|
2016-09-26 06:02:33 +03:00
|
|
|
message ListChannelsRequest {}
|
|
|
|
message ListChannelsResponse {
|
2016-11-19 03:20:44 +03:00
|
|
|
repeated ActiveChannel channels = 11;
|
2016-09-26 06:02:33 +03:00
|
|
|
}
|
|
|
|
|
2016-06-21 21:52:09 +03:00
|
|
|
message Peer {
|
2016-10-27 00:31:41 +03:00
|
|
|
string pub_key = 1;
|
2016-06-21 21:52:09 +03:00
|
|
|
int32 peer_id = 2;
|
|
|
|
string address = 3;
|
|
|
|
|
|
|
|
uint64 bytes_sent = 4;
|
|
|
|
uint64 bytes_recv = 5;
|
|
|
|
|
|
|
|
int64 sat_sent = 6;
|
|
|
|
int64 sat_recv = 7;
|
|
|
|
|
|
|
|
bool inbound = 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
message ListPeersRequest {}
|
|
|
|
message ListPeersResponse {
|
|
|
|
repeated Peer peers = 1;
|
|
|
|
}
|
2016-06-21 22:32:32 +03:00
|
|
|
|
2016-07-06 04:52:05 +03:00
|
|
|
message GetInfoRequest{}
|
|
|
|
message GetInfoResponse {
|
2016-12-13 02:34:20 +03:00
|
|
|
string identity_pubkey = 1;
|
2016-12-22 23:34:51 +03:00
|
|
|
string alias = 2;
|
2016-07-06 04:52:05 +03:00
|
|
|
|
2016-12-22 23:34:51 +03:00
|
|
|
uint32 num_pending_channels = 3;
|
|
|
|
uint32 num_active_channels = 4;
|
2016-07-06 04:52:05 +03:00
|
|
|
|
2016-12-22 23:34:51 +03:00
|
|
|
uint32 num_peers = 5;
|
2016-11-15 02:54:47 +03:00
|
|
|
|
2016-12-22 23:34:51 +03:00
|
|
|
uint32 block_height = 6;
|
|
|
|
string block_hash = 8;
|
2016-12-13 02:34:20 +03:00
|
|
|
|
2016-12-22 23:34:51 +03:00
|
|
|
bool synced_to_chain = 9;
|
|
|
|
bool testnet = 10;
|
2016-07-06 04:52:05 +03:00
|
|
|
}
|
|
|
|
|
2016-07-08 01:23:29 +03:00
|
|
|
message ConfirmationUpdate {
|
|
|
|
bytes block_sha = 1;
|
|
|
|
int32 block_height = 2;
|
|
|
|
|
|
|
|
uint32 num_confs_left = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
message ChannelOpenUpdate {
|
|
|
|
ChannelPoint channel_point = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message ChannelCloseUpdate {
|
|
|
|
bytes closing_txid = 1;
|
|
|
|
|
|
|
|
bool success = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message CloseChannelRequest {
|
|
|
|
ChannelPoint channel_point = 1;
|
|
|
|
int64 time_limit = 2;
|
2016-09-12 22:27:44 +03:00
|
|
|
bool force = 3;
|
2016-07-08 01:23:29 +03:00
|
|
|
}
|
|
|
|
message CloseStatusUpdate {
|
|
|
|
oneof update {
|
2016-08-31 02:42:23 +03:00
|
|
|
PendingUpdate close_pending = 1;
|
|
|
|
ConfirmationUpdate confirmation = 2;
|
|
|
|
ChannelCloseUpdate chan_close = 3;
|
2016-07-08 01:23:29 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-31 02:42:23 +03:00
|
|
|
message PendingUpdate {
|
|
|
|
bytes txid = 1;
|
|
|
|
}
|
|
|
|
|
2016-06-21 22:32:32 +03:00
|
|
|
message OpenChannelRequest {
|
|
|
|
int32 target_peer_id = 1;
|
2016-11-11 04:33:24 +03:00
|
|
|
|
2016-10-28 05:41:42 +03:00
|
|
|
bytes node_pubkey = 2;
|
2016-06-21 22:32:32 +03:00
|
|
|
|
2016-11-11 04:33:24 +03:00
|
|
|
string node_pubkey_string = 3;
|
|
|
|
|
|
|
|
int64 local_funding_amount = 4;
|
|
|
|
int64 remote_funding_amount = 5;
|
2016-06-21 22:32:32 +03:00
|
|
|
|
2016-11-11 04:33:24 +03:00
|
|
|
int64 commission_size = 6;
|
2016-06-21 22:32:32 +03:00
|
|
|
|
2016-11-11 04:33:24 +03:00
|
|
|
uint32 num_confs = 7;
|
2016-06-21 22:32:32 +03:00
|
|
|
}
|
2016-07-08 01:23:29 +03:00
|
|
|
message OpenStatusUpdate {
|
|
|
|
oneof update {
|
2016-08-31 02:42:23 +03:00
|
|
|
PendingUpdate chan_pending = 1;
|
|
|
|
ConfirmationUpdate confirmation = 2;
|
|
|
|
ChannelOpenUpdate chan_open = 3;
|
2016-07-08 01:23:29 +03:00
|
|
|
}
|
2016-06-21 22:32:32 +03:00
|
|
|
}
|
|
|
|
|
2016-07-08 01:24:52 +03:00
|
|
|
enum ChannelStatus {
|
|
|
|
ALL = 0;
|
|
|
|
OPENING = 1;
|
|
|
|
CLOSING = 2;
|
2016-06-21 22:32:32 +03:00
|
|
|
}
|
2016-07-08 01:24:52 +03:00
|
|
|
message PendingChannelRequest {
|
|
|
|
ChannelStatus status = 1;
|
|
|
|
}
|
|
|
|
message PendingChannelResponse {
|
|
|
|
message PendingChannel {
|
|
|
|
int32 peer_id = 1;
|
|
|
|
|
2016-10-28 05:41:42 +03:00
|
|
|
string identity_key = 2;
|
2016-07-08 01:24:52 +03:00
|
|
|
string channel_point = 3;
|
|
|
|
|
|
|
|
int64 capacity = 4;
|
|
|
|
int64 local_balance = 5;
|
|
|
|
int64 remote_balance = 6;
|
|
|
|
|
|
|
|
string closing_txid = 7;
|
|
|
|
|
|
|
|
ChannelStatus status = 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
repeated PendingChannel pending_channels = 1;
|
2016-06-21 22:32:32 +03:00
|
|
|
}
|
|
|
|
|
2016-06-21 21:46:27 +03:00
|
|
|
message WalletBalanceRequest {
|
|
|
|
bool witness_only = 1;
|
|
|
|
}
|
|
|
|
message WalletBalanceResponse {
|
|
|
|
double balance = 1;
|
2015-12-31 05:58:15 +03:00
|
|
|
}
|
2016-07-15 14:02:59 +03:00
|
|
|
|
2016-09-15 21:59:51 +03:00
|
|
|
message ChannelBalanceRequest {
|
|
|
|
}
|
|
|
|
message ChannelBalanceResponse {
|
|
|
|
int64 balance = 1;
|
|
|
|
}
|
|
|
|
|
2016-08-21 17:46:54 +03:00
|
|
|
message RoutingTableLink {
|
2016-08-20 23:49:35 +03:00
|
|
|
string id1 = 1;
|
|
|
|
string id2 = 2;
|
2016-08-21 17:46:54 +03:00
|
|
|
string outpoint = 3;
|
|
|
|
int64 capacity = 4;
|
2016-08-20 23:49:35 +03:00
|
|
|
double weight = 5;
|
|
|
|
}
|
|
|
|
|
2016-07-15 14:02:59 +03:00
|
|
|
message ShowRoutingTableRequest {
|
|
|
|
}
|
|
|
|
|
|
|
|
message ShowRoutingTableResponse {
|
2016-08-21 17:46:54 +03:00
|
|
|
repeated RoutingTableLink channels = 1;
|
2016-07-15 14:02:59 +03:00
|
|
|
}
|
2016-09-19 21:52:23 +03:00
|
|
|
|
|
|
|
message Invoice {
|
|
|
|
string memo = 1;
|
|
|
|
bytes receipt = 2;
|
|
|
|
|
|
|
|
bytes r_preimage = 3;
|
|
|
|
bytes r_hash = 4;
|
|
|
|
|
|
|
|
int64 value = 5;
|
2016-09-24 01:06:25 +03:00
|
|
|
|
|
|
|
bool settled = 6;
|
2016-11-13 05:03:19 +03:00
|
|
|
|
|
|
|
int64 creation_date = 7;
|
|
|
|
int64 settle_date = 8;
|
2016-09-19 21:52:23 +03:00
|
|
|
}
|
|
|
|
message AddInvoiceResponse {
|
|
|
|
bytes r_hash = 1;
|
|
|
|
}
|
|
|
|
message PaymentHash {
|
2016-10-16 00:38:47 +03:00
|
|
|
string r_hash_str = 1;
|
|
|
|
bytes r_hash = 2;
|
2016-09-19 21:52:23 +03:00
|
|
|
}
|
|
|
|
message ListInvoiceRequest {
|
|
|
|
bool pending_only = 1;
|
|
|
|
}
|
|
|
|
message ListInvoiceResponse {
|
|
|
|
repeated Invoice invoices = 1;
|
|
|
|
}
|
2016-10-16 00:38:47 +03:00
|
|
|
|
|
|
|
message InvoiceSubscription {}
|
2016-12-05 14:59:36 +03:00
|
|
|
|
|
|
|
|
|
|
|
message Payment {
|
|
|
|
string r_hash = 1;
|
|
|
|
|
|
|
|
int64 value = 2;
|
|
|
|
|
|
|
|
int64 creation_date = 3;
|
|
|
|
repeated string path = 4;
|
|
|
|
int64 fee = 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
message ListPaymentsRequest {
|
|
|
|
}
|
|
|
|
|
|
|
|
message ListPaymentsResponse {
|
|
|
|
repeated Payment payments = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message DeleteAllPaymentsRequest {
|
|
|
|
}
|
|
|
|
|
|
|
|
message DeleteAllPaymentsResponse {
|
|
|
|
}
|