This commit is contained in:
bumi 2022-06-12 10:17:57 +02:00 committed by GitHub
commit 1df28a191c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 441 additions and 15 deletions

View File

@ -1,4 +1,5 @@
# Lnrpc - ruby gRPC client for LND # Lnrpc - ruby gRPC client for LND
[![Gem Version](https://badge.fury.io/rb/lnrpc.svg)](https://badge.fury.io/rb/lnrpc) [![Gem Version](https://badge.fury.io/rb/lnrpc.svg)](https://badge.fury.io/rb/lnrpc)
a [gRPC](https://grpc.io/) client for [LND, the Lightning Network Daemon](https://github.com/lightningnetwork/lnd/) packed as ruby gem. a [gRPC](https://grpc.io/) client for [LND, the Lightning Network Daemon](https://github.com/lightningnetwork/lnd/) packed as ruby gem.
@ -10,6 +11,7 @@ Add this line to your application's Gemfile:
```ruby ```ruby
gem 'lnrpc', '~> 0.13.0' gem 'lnrpc', '~> 0.13.0'
``` ```
lnrpc follows the lnd versioning, thus it is recommended to specify the exact version you need for your lnd node as dependency (see [#Versioning](#Versioning)). lnrpc follows the lnd versioning, thus it is recommended to specify the exact version you need for your lnd node as dependency (see [#Versioning](#Versioning)).
And then execute: And then execute:
@ -24,7 +26,7 @@ Or install it yourself as:
## Usage ## Usage
This gem makes the gRPC client classes created from the [LND service definitions](https://github.com/lightningnetwork/lnd/tree/master/lnrpc) available. This gem makes the gRPC client classes created from the [LND service definitions](https://github.com/lightningnetwork/lnd/tree/master/lnrpc) available.
```ruby ```ruby
require "lnrpc" require "lnrpc"
@ -70,6 +72,7 @@ An optional client wrapper ([Lnrpc::Client](https://github.com/bumi/lnrpc/blob/m
initializing the gRPC client easier and removes the need for some boilerplate code for calling RPC methods. initializing the gRPC client easier and removes the need for some boilerplate code for calling RPC methods.
#### Example #### Example
```ruby ```ruby
lnd = Lnrpc::Client.new({credentials_path: '/path/to.cert.cls', macaroon_path: '/path/to/admin.macaroon'}) lnd = Lnrpc::Client.new({credentials_path: '/path/to.cert.cls', macaroon_path: '/path/to/admin.macaroon'})
lnd.lightning # => Lnrpc::Lightning::Stub lnd.lightning # => Lnrpc::Lightning::Stub
@ -84,13 +87,13 @@ Also have a look at [examples.rb](https://github.com/bumi/lnrpc/blob/master/exam
The Lnrpc::Client constructor allows the following options: The Lnrpc::Client constructor allows the following options:
* credentials: - credentials:
- `credentials` : the credentials data as string (pass nil if a "trusted" cert (e.g. from letsencrypt is used) - `credentials` : the credentials data as string (pass nil if a "trusted" cert (e.g. from letsencrypt is used)
- `credentials_path` : the path to a credentials file (tls.cert) as string (default: `"#{LND_HOME_DIR}/tls.cert"` ) - `credentials_path` : the path to a credentials file (tls.cert) as string (default: `"#{LND_HOME_DIR}/tls.cert"` )
* macaroon: - macaroon:
- `macaroon` : the macaroon as hex string - `macaroon` : the macaroon as hex string
- `macaroon_path` : the path to the macaroon file created by lnd as string (default: `"#{LND_HOME_DIR}/data/chain/bitcoin/mainnet/admin.macaroon"`) - `macaroon_path` : the path to the macaroon file created by lnd as string (default: `"#{LND_HOME_DIR}/data/chain/bitcoin/mainnet/admin.macaroon"`)
* address: - address:
- `address` : lnd address as string. format: address:port, e.g. localhost:10009 (default) - `address` : lnd address as string. format: address:port, e.g. localhost:10009 (default)
If no credentials or no macaroon is provided default files are assumed in `ENV['LND_HOME'] || "~/.lnd"`. If no credentials or no macaroon is provided default files are assumed in `ENV['LND_HOME'] || "~/.lnd"`.
@ -135,6 +138,7 @@ client.lightning.grpc.wallet_balance(request).total_balance
``` ```
## Using with BTC Pay Server ## Using with BTC Pay Server
If you have a running BTC Pay Server with LND support, integrating with lnrpc is easy. If you have a running BTC Pay Server with LND support, integrating with lnrpc is easy.
- Navigate to the domain associated with your BTC Pay Server - Navigate to the domain associated with your BTC Pay Server
@ -145,7 +149,6 @@ If you have a running BTC Pay Server with LND support, integrating with lnrpc is
Don't have a BTC Pay Server? [Setting one up is easy.](https://medium.com/@BtcpayServer/launch-btcpay-server-via-web-interface-and-deploy-full-bitcoin-node-lnd-in-less-than-a-minute-dc8bc6f06a3) Don't have a BTC Pay Server? [Setting one up is easy.](https://medium.com/@BtcpayServer/launch-btcpay-server-via-web-interface-and-deploy-full-bitcoin-node-lnd-in-less-than-a-minute-dc8bc6f06a3)
## Versioning ## Versioning
This gem follows the LND versions and will update the gRPC service definitions accordingly. This gem follows the LND versions and will update the gRPC service definitions accordingly.
@ -153,7 +156,6 @@ e.g. gem version 0.5.2 includes the gRPC service definitions from LND v0.5.2
see [rubygems](https://rubygems.org/gems/lnrpc) for all available releases. see [rubygems](https://rubygems.org/gems/lnrpc) for all available releases.
### Update service definitions ### Update service definitions
The script `generate-grpc-service-files.sh` can be used to generate the GRPC ruby files. The script `generate-grpc-service-files.sh` can be used to generate the GRPC ruby files.
@ -161,14 +163,16 @@ The files will be stored in `lib/grpc_services`
$ ./generate-grpc-service-files.sh $ ./generate-grpc-service-files.sh
+ Make sure you have the [grpc-tools](https://rubygems.org/gems/grpc-tools) installed - Make sure you have the [grpc-tools](https://rubygems.org/gems/grpc-tools) installed
+ Make sure you have the lnd source in your $GOPATH/src folder - Make sure you have the lnd source in your $GOPATH/src folder
- Note: There have been issues with the generated requires `require "lightning_pb"` must be replaced with `require "rpc_pb"` (I don't know exactly why)
## Other resources ## Other resources
* [LND gRPC API Reference](https://api.lightning.community) - [LND gRPC API Reference](https://api.lightning.community)
* [LND Developer Site](https://dev.lightning.community/) - [LND Developer Site](https://dev.lightning.community/)
* [gRPC Ruby quick start](https://grpc.io/docs/quickstart/ruby.html) - [gRPC Ruby quick start](https://grpc.io/docs/quickstart/ruby.html)
## Contributing ## Contributing

View File

@ -21,9 +21,11 @@ module Chainrpc
# registers an intent for a client to be notified once a confirmation request # registers an intent for a client to be notified once a confirmation request
# has reached its required number of confirmations on-chain. # has reached its required number of confirmations on-chain.
# #
# A client can specify whether the confirmation request should be for a # A confirmation request must have a valid output script. It is also possible
# particular transaction by its hash or for an output script by specifying a # to give a transaction ID. If the transaction ID is not set, a notification
# zero hash. # is sent once the output script confirms. If the transaction ID is also set,
# a notification is sent once the output script confirms in the given
# transaction.
rpc :RegisterConfirmationsNtfn, ::Chainrpc::ConfRequest, stream(::Chainrpc::ConfEvent) rpc :RegisterConfirmationsNtfn, ::Chainrpc::ConfRequest, stream(::Chainrpc::ConfEvent)
# #
# RegisterSpendNtfn is a synchronous response-streaming RPC that registers an # RegisterSpendNtfn is a synchronous response-streaming RPC that registers an

View File

@ -0,0 +1,17 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: devrpc/dev.proto
require 'google/protobuf'
require 'rpc_pb'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_file("devrpc/dev.proto", :syntax => :proto3) do
add_message "devrpc.ImportGraphResponse" do
end
end
end
module Devrpc
ImportGraphResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("devrpc.ImportGraphResponse").msgclass
end

View File

@ -0,0 +1,25 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# Source: devrpc/dev.proto for package 'devrpc'
require 'grpc'
require 'devrpc/dev_pb'
module Devrpc
module Dev
class Service
include ::GRPC::GenericService
self.marshal_class_method = :encode
self.unmarshal_class_method = :decode
self.service_name = 'devrpc.Dev'
#
# ImportGraph imports a ChannelGraph into the graph database. Should only be
# used for development.
rpc :ImportGraph, ::Lnrpc::ChannelGraph, ::Devrpc::ImportGraphResponse
end
Stub = Service.rpc_stub_class
end
end

View File

@ -0,0 +1,98 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: neutrinorpc/neutrino.proto
require 'google/protobuf'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_file("neutrinorpc/neutrino.proto", :syntax => :proto3) do
add_message "neutrinorpc.StatusRequest" do
end
add_message "neutrinorpc.StatusResponse" do
optional :active, :bool, 1
optional :synced, :bool, 2
optional :block_height, :int32, 3
optional :block_hash, :string, 4
repeated :peers, :string, 5
end
add_message "neutrinorpc.AddPeerRequest" do
optional :peer_addrs, :string, 1
end
add_message "neutrinorpc.AddPeerResponse" do
end
add_message "neutrinorpc.DisconnectPeerRequest" do
optional :peer_addrs, :string, 1
end
add_message "neutrinorpc.DisconnectPeerResponse" do
end
add_message "neutrinorpc.IsBannedRequest" do
optional :peer_addrs, :string, 1
end
add_message "neutrinorpc.IsBannedResponse" do
optional :banned, :bool, 1
end
add_message "neutrinorpc.GetBlockHeaderRequest" do
optional :hash, :string, 1
end
add_message "neutrinorpc.GetBlockHeaderResponse" do
optional :hash, :string, 1
optional :confirmations, :int64, 2
optional :stripped_size, :int64, 3
optional :size, :int64, 4
optional :weight, :int64, 5
optional :height, :int32, 6
optional :version, :int32, 7
optional :version_hex, :string, 8
optional :merkleroot, :string, 9
optional :time, :int64, 10
optional :nonce, :uint32, 11
optional :bits, :string, 12
optional :ntx, :int32, 13
optional :previous_block_hash, :string, 14
optional :raw_hex, :bytes, 15
end
add_message "neutrinorpc.GetBlockRequest" do
optional :hash, :string, 1
end
add_message "neutrinorpc.GetBlockResponse" do
optional :hash, :string, 1
optional :confirmations, :int64, 2
optional :stripped_size, :int64, 3
optional :size, :int64, 4
optional :weight, :int64, 5
optional :height, :int32, 6
optional :version, :int32, 7
optional :version_hex, :string, 8
optional :merkleroot, :string, 9
repeated :tx, :string, 10
optional :time, :int64, 11
optional :nonce, :uint32, 12
optional :bits, :string, 13
optional :ntx, :int32, 14
optional :previous_block_hash, :string, 15
optional :raw_hex, :bytes, 16
end
add_message "neutrinorpc.GetCFilterRequest" do
optional :hash, :string, 1
end
add_message "neutrinorpc.GetCFilterResponse" do
optional :filter, :bytes, 1
end
end
end
module Neutrinorpc
StatusRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("neutrinorpc.StatusRequest").msgclass
StatusResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("neutrinorpc.StatusResponse").msgclass
AddPeerRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("neutrinorpc.AddPeerRequest").msgclass
AddPeerResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("neutrinorpc.AddPeerResponse").msgclass
DisconnectPeerRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("neutrinorpc.DisconnectPeerRequest").msgclass
DisconnectPeerResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("neutrinorpc.DisconnectPeerResponse").msgclass
IsBannedRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("neutrinorpc.IsBannedRequest").msgclass
IsBannedResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("neutrinorpc.IsBannedResponse").msgclass
GetBlockHeaderRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("neutrinorpc.GetBlockHeaderRequest").msgclass
GetBlockHeaderResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("neutrinorpc.GetBlockHeaderResponse").msgclass
GetBlockRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("neutrinorpc.GetBlockRequest").msgclass
GetBlockResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("neutrinorpc.GetBlockResponse").msgclass
GetCFilterRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("neutrinorpc.GetCFilterRequest").msgclass
GetCFilterResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("neutrinorpc.GetCFilterResponse").msgclass
end

View File

@ -0,0 +1,48 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# Source: neutrinorpc/neutrino.proto for package 'neutrinorpc'
require 'grpc'
require 'neutrinorpc/neutrino_pb'
module Neutrinorpc
module NeutrinoKit
# NeutrinoKit is a service that can be used to get information about the
# current state of the neutrino instance, fetch blocks and add/remove peers.
class Service
include ::GRPC::GenericService
self.marshal_class_method = :encode
self.unmarshal_class_method = :decode
self.service_name = 'neutrinorpc.NeutrinoKit'
#
# Status returns the status of the light client neutrino instance,
# along with height and hash of the best block, and a list of connected
# peers.
rpc :Status, ::Neutrinorpc::StatusRequest, ::Neutrinorpc::StatusResponse
#
# AddPeer adds a new peer that has already been connected to the server.
rpc :AddPeer, ::Neutrinorpc::AddPeerRequest, ::Neutrinorpc::AddPeerResponse
#
# DisconnectPeer disconnects a peer by target address. Both outbound and
# inbound nodes will be searched for the target node. An error message will
# be returned if the peer was not found.
rpc :DisconnectPeer, ::Neutrinorpc::DisconnectPeerRequest, ::Neutrinorpc::DisconnectPeerResponse
#
# IsBanned returns true if the peer is banned, otherwise false.
rpc :IsBanned, ::Neutrinorpc::IsBannedRequest, ::Neutrinorpc::IsBannedResponse
#
# GetBlockHeader returns a block header with a particular block hash.
rpc :GetBlockHeader, ::Neutrinorpc::GetBlockHeaderRequest, ::Neutrinorpc::GetBlockHeaderResponse
#
# GetBlock returns a block with a particular block hash.
rpc :GetBlock, ::Neutrinorpc::GetBlockRequest, ::Neutrinorpc::GetBlockResponse
#
# GetCFilter returns a compact filter from a block.
rpc :GetCFilter, ::Neutrinorpc::GetCFilterRequest, ::Neutrinorpc::GetCFilterResponse
end
Stub = Service.rpc_stub_class
end
end

View File

@ -0,0 +1,48 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: peersrpc/peers.proto
require 'google/protobuf'
require 'rpc_pb'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_file("peersrpc/peers.proto", :syntax => :proto3) do
add_message "peersrpc.UpdateAddressAction" do
optional :action, :enum, 1, "peersrpc.UpdateAction"
optional :address, :string, 2
end
add_message "peersrpc.UpdateFeatureAction" do
optional :action, :enum, 1, "peersrpc.UpdateAction"
optional :feature_bit, :enum, 2, "lnrpc.FeatureBit"
end
add_message "peersrpc.NodeAnnouncementUpdateRequest" do
repeated :feature_updates, :message, 1, "peersrpc.UpdateFeatureAction"
optional :color, :string, 2
optional :alias, :string, 3
repeated :address_updates, :message, 4, "peersrpc.UpdateAddressAction"
end
add_message "peersrpc.NodeAnnouncementUpdateResponse" do
repeated :ops, :message, 1, "lnrpc.Op"
end
add_enum "peersrpc.UpdateAction" do
value :ADD, 0
value :REMOVE, 1
end
add_enum "peersrpc.FeatureSet" do
value :SET_INIT, 0
value :SET_LEGACY_GLOBAL, 1
value :SET_NODE_ANN, 2
value :SET_INVOICE, 3
value :SET_INVOICE_AMP, 4
end
end
end
module Peersrpc
UpdateAddressAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("peersrpc.UpdateAddressAction").msgclass
UpdateFeatureAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("peersrpc.UpdateFeatureAction").msgclass
NodeAnnouncementUpdateRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("peersrpc.NodeAnnouncementUpdateRequest").msgclass
NodeAnnouncementUpdateResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("peersrpc.NodeAnnouncementUpdateResponse").msgclass
UpdateAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("peersrpc.UpdateAction").enummodule
FeatureSet = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("peersrpc.FeatureSet").enummodule
end

View File

@ -0,0 +1,27 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# Source: peersrpc/peers.proto for package 'peersrpc'
require 'grpc'
require 'peersrpc/peers_pb'
module Peersrpc
module Peers
# Peers is a service that can be used to get information and interact
# with the other nodes of the newtwork.
class Service
include ::GRPC::GenericService
self.marshal_class_method = :encode
self.unmarshal_class_method = :decode
self.service_name = 'peersrpc.Peers'
# lncli: peers updatenodeannouncement
# UpdateNodeAnnouncement allows the caller to update the node parameters
# and broadcasts a new version of the node announcement to its peers.
rpc :UpdateNodeAnnouncement, ::Peersrpc::NodeAnnouncementUpdateRequest, ::Peersrpc::NodeAnnouncementUpdateResponse
end
Stub = Service.rpc_stub_class
end
end

View File

@ -30,6 +30,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
optional :no_inflight_updates, :bool, 18 optional :no_inflight_updates, :bool, 18
optional :max_shard_size_msat, :uint64, 21 optional :max_shard_size_msat, :uint64, 21
optional :amp, :bool, 22 optional :amp, :bool, 22
optional :time_pref, :double, 23
end end
add_message "routerrpc.TrackPaymentRequest" do add_message "routerrpc.TrackPaymentRequest" do
optional :payment_hash, :bytes, 1 optional :payment_hash, :bytes, 1
@ -181,6 +182,8 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
optional :incoming_circuit_key, :message, 1, "routerrpc.CircuitKey" optional :incoming_circuit_key, :message, 1, "routerrpc.CircuitKey"
optional :action, :enum, 2, "routerrpc.ResolveHoldForwardAction" optional :action, :enum, 2, "routerrpc.ResolveHoldForwardAction"
optional :preimage, :bytes, 3 optional :preimage, :bytes, 3
optional :failure_message, :bytes, 4
optional :failure_code, :enum, 5, "lnrpc.Failure.FailureCode"
end end
add_message "routerrpc.UpdateChanStatusRequest" do add_message "routerrpc.UpdateChanStatusRequest" do
optional :chan_point, :message, 1, "lnrpc.ChannelPoint" optional :chan_point, :message, 1, "lnrpc.ChannelPoint"

View File

@ -21,14 +21,17 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
optional :key_desc, :message, 1, "signrpc.KeyDescriptor" optional :key_desc, :message, 1, "signrpc.KeyDescriptor"
optional :single_tweak, :bytes, 2 optional :single_tweak, :bytes, 2
optional :double_tweak, :bytes, 3 optional :double_tweak, :bytes, 3
optional :tap_tweak, :bytes, 10
optional :witness_script, :bytes, 4 optional :witness_script, :bytes, 4
optional :output, :message, 5, "signrpc.TxOut" optional :output, :message, 5, "signrpc.TxOut"
optional :sighash, :uint32, 7 optional :sighash, :uint32, 7
optional :input_index, :int32, 8 optional :input_index, :int32, 8
optional :sign_method, :enum, 9, "signrpc.SignMethod"
end end
add_message "signrpc.SignReq" do add_message "signrpc.SignReq" do
optional :raw_tx_bytes, :bytes, 1 optional :raw_tx_bytes, :bytes, 1
repeated :sign_descs, :message, 2, "signrpc.SignDescriptor" repeated :sign_descs, :message, 2, "signrpc.SignDescriptor"
repeated :prev_outputs, :message, 3, "signrpc.TxOut"
end end
add_message "signrpc.SignResp" do add_message "signrpc.SignResp" do
repeated :raw_sigs, :bytes, 1 repeated :raw_sigs, :bytes, 1
@ -65,6 +68,71 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
add_message "signrpc.SharedKeyResponse" do add_message "signrpc.SharedKeyResponse" do
optional :shared_key, :bytes, 1 optional :shared_key, :bytes, 1
end end
add_message "signrpc.TweakDesc" do
optional :tweak, :bytes, 1
optional :is_x_only, :bool, 2
end
add_message "signrpc.TaprootTweakDesc" do
optional :script_root, :bytes, 1
optional :key_spend_only, :bool, 2
end
add_message "signrpc.MuSig2CombineKeysRequest" do
repeated :all_signer_pubkeys, :bytes, 1
repeated :tweaks, :message, 2, "signrpc.TweakDesc"
optional :taproot_tweak, :message, 3, "signrpc.TaprootTweakDesc"
end
add_message "signrpc.MuSig2CombineKeysResponse" do
optional :combined_key, :bytes, 1
optional :taproot_internal_key, :bytes, 2
end
add_message "signrpc.MuSig2SessionRequest" do
optional :key_loc, :message, 1, "signrpc.KeyLocator"
repeated :all_signer_pubkeys, :bytes, 2
repeated :other_signer_public_nonces, :bytes, 3
repeated :tweaks, :message, 4, "signrpc.TweakDesc"
optional :taproot_tweak, :message, 5, "signrpc.TaprootTweakDesc"
end
add_message "signrpc.MuSig2SessionResponse" do
optional :session_id, :bytes, 1
optional :combined_key, :bytes, 2
optional :taproot_internal_key, :bytes, 3
optional :local_public_nonces, :bytes, 4
optional :have_all_nonces, :bool, 5
end
add_message "signrpc.MuSig2RegisterNoncesRequest" do
optional :session_id, :bytes, 1
repeated :other_signer_public_nonces, :bytes, 3
end
add_message "signrpc.MuSig2RegisterNoncesResponse" do
optional :have_all_nonces, :bool, 1
end
add_message "signrpc.MuSig2SignRequest" do
optional :session_id, :bytes, 1
optional :message_digest, :bytes, 2
optional :cleanup, :bool, 3
end
add_message "signrpc.MuSig2SignResponse" do
optional :local_partial_signature, :bytes, 1
end
add_message "signrpc.MuSig2CombineSigRequest" do
optional :session_id, :bytes, 1
repeated :other_partial_signatures, :bytes, 2
end
add_message "signrpc.MuSig2CombineSigResponse" do
optional :have_all_signatures, :bool, 1
optional :final_signature, :bytes, 2
end
add_message "signrpc.MuSig2CleanupRequest" do
optional :session_id, :bytes, 1
end
add_message "signrpc.MuSig2CleanupResponse" do
end
add_enum "signrpc.SignMethod" do
value :SIGN_METHOD_WITNESS_V0, 0
value :SIGN_METHOD_TAPROOT_KEY_SPEND_BIP0086, 1
value :SIGN_METHOD_TAPROOT_KEY_SPEND, 2
value :SIGN_METHOD_TAPROOT_SCRIPT_SPEND, 3
end
end end
end end
@ -83,4 +151,19 @@ module Signrpc
VerifyMessageResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.VerifyMessageResp").msgclass VerifyMessageResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.VerifyMessageResp").msgclass
SharedKeyRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.SharedKeyRequest").msgclass SharedKeyRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.SharedKeyRequest").msgclass
SharedKeyResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.SharedKeyResponse").msgclass SharedKeyResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.SharedKeyResponse").msgclass
TweakDesc = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.TweakDesc").msgclass
TaprootTweakDesc = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.TaprootTweakDesc").msgclass
MuSig2CombineKeysRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.MuSig2CombineKeysRequest").msgclass
MuSig2CombineKeysResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.MuSig2CombineKeysResponse").msgclass
MuSig2SessionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.MuSig2SessionRequest").msgclass
MuSig2SessionResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.MuSig2SessionResponse").msgclass
MuSig2RegisterNoncesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.MuSig2RegisterNoncesRequest").msgclass
MuSig2RegisterNoncesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.MuSig2RegisterNoncesResponse").msgclass
MuSig2SignRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.MuSig2SignRequest").msgclass
MuSig2SignResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.MuSig2SignResponse").msgclass
MuSig2CombineSigRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.MuSig2CombineSigRequest").msgclass
MuSig2CombineSigResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.MuSig2CombineSigResponse").msgclass
MuSig2CleanupRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.MuSig2CleanupRequest").msgclass
MuSig2CleanupResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.MuSig2CleanupResponse").msgclass
SignMethod = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.SignMethod").enummodule
end end

View File

@ -62,6 +62,71 @@ module Signrpc
# The resulting shared public key is serialized in the compressed format and # The resulting shared public key is serialized in the compressed format and
# hashed with sha256, resulting in the final key length of 256bit. # hashed with sha256, resulting in the final key length of 256bit.
rpc :DeriveSharedKey, ::Signrpc::SharedKeyRequest, ::Signrpc::SharedKeyResponse rpc :DeriveSharedKey, ::Signrpc::SharedKeyRequest, ::Signrpc::SharedKeyResponse
#
# MuSig2CombineKeys (experimental!) is a stateless helper RPC that can be used
# to calculate the combined MuSig2 public key from a list of all participating
# signers' public keys. This RPC is completely stateless and deterministic and
# does not create any signing session. It can be used to determine the Taproot
# public key that should be put in an on-chain output once all public keys are
# known. A signing session is only needed later when that output should be
# _spent_ again.
#
# NOTE: The MuSig2 BIP is not final yet and therefore this API must be
# considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming
# releases. Backward compatibility is not guaranteed!
rpc :MuSig2CombineKeys, ::Signrpc::MuSig2CombineKeysRequest, ::Signrpc::MuSig2CombineKeysResponse
#
# MuSig2CreateSession (experimental!) creates a new MuSig2 signing session
# using the local key identified by the key locator. The complete list of all
# public keys of all signing parties must be provided, including the public
# key of the local signing key. If nonces of other parties are already known,
# they can be submitted as well to reduce the number of RPC calls necessary
# later on.
#
# NOTE: The MuSig2 BIP is not final yet and therefore this API must be
# considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming
# releases. Backward compatibility is not guaranteed!
rpc :MuSig2CreateSession, ::Signrpc::MuSig2SessionRequest, ::Signrpc::MuSig2SessionResponse
#
# MuSig2RegisterNonces (experimental!) registers one or more public nonces of
# other signing participants for a session identified by its ID. This RPC can
# be called multiple times until all nonces are registered.
#
# NOTE: The MuSig2 BIP is not final yet and therefore this API must be
# considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming
# releases. Backward compatibility is not guaranteed!
rpc :MuSig2RegisterNonces, ::Signrpc::MuSig2RegisterNoncesRequest, ::Signrpc::MuSig2RegisterNoncesResponse
#
# MuSig2Sign (experimental!) creates a partial signature using the local
# signing key that was specified when the session was created. This can only
# be called when all public nonces of all participants are known and have been
# registered with the session. If this node isn't responsible for combining
# all the partial signatures, then the cleanup flag should be set, indicating
# that the session can be removed from memory once the signature was produced.
#
# NOTE: The MuSig2 BIP is not final yet and therefore this API must be
# considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming
# releases. Backward compatibility is not guaranteed!
rpc :MuSig2Sign, ::Signrpc::MuSig2SignRequest, ::Signrpc::MuSig2SignResponse
#
# MuSig2CombineSig (experimental!) combines the given partial signature(s)
# with the local one, if it already exists. Once a partial signature of all
# participants is registered, the final signature will be combined and
# returned.
#
# NOTE: The MuSig2 BIP is not final yet and therefore this API must be
# considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming
# releases. Backward compatibility is not guaranteed!
rpc :MuSig2CombineSig, ::Signrpc::MuSig2CombineSigRequest, ::Signrpc::MuSig2CombineSigResponse
#
# MuSig2Cleanup (experimental!) allows a caller to clean up a session early in
# cases where it's obvious that the signing session won't succeed and the
# resources can be released.
#
# NOTE: The MuSig2 BIP is not final yet and therefore this API must be
# considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming
# releases. Backward compatibility is not guaranteed!
rpc :MuSig2Cleanup, ::Signrpc::MuSig2CleanupRequest, ::Signrpc::MuSig2CleanupResponse
end end
Stub = Service.rpc_stub_class Stub = Service.rpc_stub_class

View File

@ -12,6 +12,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
optional :min_confs, :int32, 1 optional :min_confs, :int32, 1
optional :max_confs, :int32, 2 optional :max_confs, :int32, 2
optional :account, :string, 3 optional :account, :string, 3
optional :unconfirmed_only, :bool, 4
end end
add_message "walletrpc.ListUnspentResponse" do add_message "walletrpc.ListUnspentResponse" do
repeated :utxos, :message, 1, "lnrpc.Utxo" repeated :utxos, :message, 1, "lnrpc.Utxo"
@ -172,6 +173,8 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
optional :id, :bytes, 1 optional :id, :bytes, 1
optional :outpoint, :message, 2, "lnrpc.OutPoint" optional :outpoint, :message, 2, "lnrpc.OutPoint"
optional :expiration, :uint64, 3 optional :expiration, :uint64, 3
optional :pk_script, :bytes, 4
optional :value, :uint64, 5
end end
add_message "walletrpc.SignPsbtRequest" do add_message "walletrpc.SignPsbtRequest" do
optional :funded_psbt, :bytes, 1 optional :funded_psbt, :bytes, 1
@ -197,6 +200,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
value :WITNESS_PUBKEY_HASH, 1 value :WITNESS_PUBKEY_HASH, 1
value :NESTED_WITNESS_PUBKEY_HASH, 2 value :NESTED_WITNESS_PUBKEY_HASH, 2
value :HYBRID_NESTED_WITNESS_PUBKEY_HASH, 3 value :HYBRID_NESTED_WITNESS_PUBKEY_HASH, 3
value :TAPROOT_PUBKEY, 4
end end
add_enum "walletrpc.WitnessType" do add_enum "walletrpc.WitnessType" do
value :UNKNOWN_WITNESS, 0 value :UNKNOWN_WITNESS, 0

View File

@ -18,7 +18,9 @@ module Walletrpc
# #
# ListUnspent returns a list of all utxos spendable by the wallet with a # ListUnspent returns a list of all utxos spendable by the wallet with a
# number of confirmations between the specified minimum and maximum. # number of confirmations between the specified minimum and maximum. By
# default, all utxos are listed. To list only the unconfirmed utxos, set
# the unconfirmed_only to true.
rpc :ListUnspent, ::Walletrpc::ListUnspentRequest, ::Walletrpc::ListUnspentResponse rpc :ListUnspent, ::Walletrpc::ListUnspentRequest, ::Walletrpc::ListUnspentResponse
# #
# LeaseOutput locks an output to the given ID, preventing it from being # LeaseOutput locks an output to the given ID, preventing it from being