cln

package
v1.22.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

README

Generating Go gRPC Code

The Go gRPC bindings for Core Lightning (CLN) are generated from proto files that live in the lightning repository (cln-grpc) and in the hold plugin repository.

The generated Go files are written into the hub repository under lnclient/cln/clngrpc and lnclient/cln/clngrpc_hold.

Prerequisites

Make sure the following tools are installed:

# protoc (>= 3.20 recommended)
protoc --version

# Go plugins
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest

Ensure $GOPATH/bin is in your PATH:

export PATH="$PATH:$(go env GOPATH)/bin"

This guide assumes the following directory structure:

~/dev/
├── lightning/
│   └── cln-grpc/
│       └── proto/
│           ├── node.proto
│           ├── primitives.proto
│           └── ...
├── hub/
|   └── lnclient/
|       └── cln/
|           └── clngrpc/
|           └── clngrpc_hold/
└── hold/
    └── protos/
        └── hold.proto

Generating Go code

From the hub repository root, run:

protoc \
  --proto_path=../lightning/cln-grpc/proto \
  --go_out=./lnclient/cln/clngrpc \
  --go_opt=paths=source_relative \
  --go_opt=Mprimitives.proto=github.com/getAlby/hub/lnclient/cln/clngrpc \
  --go_opt=Mnode.proto=github.com/getAlby/hub/lnclient/cln/clngrpc \
  --go-grpc_out=./lnclient/cln/clngrpc \
  --go-grpc_opt=paths=source_relative \
  --go-grpc_opt=Mprimitives.proto=github.com/getAlby/hub/lnclient/cln/clngrpc \
  --go-grpc_opt=Mnode.proto=github.com/getAlby/hub/lnclient/cln/clngrpc \
  ../lightning/cln-grpc/proto/node.proto \
  ../lightning/cln-grpc/proto/primitives.proto

and if you have the hold plugin repo:

protoc \
  --proto_path=../hold/protos \
  --go_out=./lnclient/cln/clngrpc_hold \
  --go_opt=paths=source_relative \
  --go_opt=Mhold.proto=github.com/getAlby/hub/lnclient/cln/clngrpc_hold \
  --go-grpc_out=./lnclient/cln/clngrpc_hold \
  --go-grpc_opt=paths=source_relative \
  --go-grpc_opt=Mhold.proto=github.com/getAlby/hub/lnclient/cln/clngrpc_hold \
  ../hold/protos/hold.proto

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCLNService

func NewCLNService(ctx context.Context, eventPublisher events.EventPublisher, address, lightningDir, addressHold string) (lnclient lnclient.LNClient, err error)

Types

type CLNService

type CLNService struct {
	// contains filtered or unexported fields
}

func (*CLNService) CancelHoldInvoice

func (c *CLNService) CancelHoldInvoice(ctx context.Context, paymentHash string) (err error)

func (*CLNService) CloseChannel

func (c *CLNService) CloseChannel(ctx context.Context, closeChannelRequest *lnclient.CloseChannelRequest) (*lnclient.CloseChannelResponse, error)

func (*CLNService) ConnectPeer

func (c *CLNService) ConnectPeer(ctx context.Context, connectPeerRequest *lnclient.ConnectPeerRequest) error

func (*CLNService) DisconnectPeer

func (c *CLNService) DisconnectPeer(ctx context.Context, peerId string) error

func (*CLNService) ExecuteCustomNodeCommand

func (c *CLNService) ExecuteCustomNodeCommand(ctx context.Context, command *lnclient.CustomNodeCommandRequest) (*lnclient.CustomNodeCommandResponse, error)

func (*CLNService) GetBalances

func (c *CLNService) GetBalances(ctx context.Context, includeInactiveChannels bool) (*lnclient.BalancesResponse, error)

func (*CLNService) GetCustomNodeCommandDefinitions

func (c *CLNService) GetCustomNodeCommandDefinitions() []lnclient.CustomNodeCommandDef

func (*CLNService) GetInfo

func (c *CLNService) GetInfo(ctx context.Context) (*lnclient.NodeInfo, error)

func (*CLNService) GetLogOutput

func (c *CLNService) GetLogOutput(ctx context.Context, maxLen int) ([]byte, error)

func (*CLNService) GetNetworkGraph

func (c *CLNService) GetNetworkGraph(ctx context.Context, nodeIds []string) (lnclient.NetworkGraphResponse, error)

func (*CLNService) GetNewOnchainAddress

func (c *CLNService) GetNewOnchainAddress(ctx context.Context) (string, error)

func (*CLNService) GetNodeConnectionInfo

func (c *CLNService) GetNodeConnectionInfo(ctx context.Context) (*lnclient.NodeConnectionInfo, error)

func (*CLNService) GetNodeStatus

func (c *CLNService) GetNodeStatus(ctx context.Context) (nodeStatus *lnclient.NodeStatus, err error)

func (*CLNService) GetOnchainBalance

func (c *CLNService) GetOnchainBalance(ctx context.Context) (*lnclient.OnchainBalanceResponse, error)

func (*CLNService) GetPubkey

func (c *CLNService) GetPubkey() string

func (*CLNService) GetStorageDir

func (c *CLNService) GetStorageDir() (string, error)

func (*CLNService) GetSupportedNIP47Methods

func (c *CLNService) GetSupportedNIP47Methods() []string

func (*CLNService) GetSupportedNIP47NotificationTypes

func (c *CLNService) GetSupportedNIP47NotificationTypes() []string

func (*CLNService) ListChannels

func (c *CLNService) ListChannels(ctx context.Context) (channels []lnclient.Channel, err error)

func (*CLNService) ListOnchainTransactions

func (c *CLNService) ListOnchainTransactions(ctx context.Context) ([]lnclient.OnchainTransaction, error)

func (*CLNService) ListPeers

func (c *CLNService) ListPeers(ctx context.Context) ([]lnclient.PeerDetails, error)

func (*CLNService) LookupInvoice

func (c *CLNService) LookupInvoice(ctx context.Context, paymentHash string) (transaction *lnclient.Transaction, err error)

func (*CLNService) MakeHoldInvoice

func (c *CLNService) MakeHoldInvoice(ctx context.Context, amountMsat int64, description string, descriptionHash string, expiry int64, paymentHash string, minCltvExpiryDelta *uint64) (transaction *lnclient.Transaction, err error)

func (*CLNService) MakeInvoice

func (c *CLNService) MakeInvoice(ctx context.Context, amountMsat int64, description string, descriptionHash string, expiry int64, throughNodePubkey *string) (transaction *lnclient.Transaction, err error)

func (*CLNService) MakeOffer

func (c *CLNService) MakeOffer(ctx context.Context, description string) (string, error)

func (*CLNService) OpenChannel

func (c *CLNService) OpenChannel(ctx context.Context, openChannelRequest *lnclient.OpenChannelRequest) (*lnclient.OpenChannelResponse, error)

func (*CLNService) RedeemOnchainFunds

func (c *CLNService) RedeemOnchainFunds(ctx context.Context, toAddress string, amount uint64, feeRate *uint64, sendAll bool) (txId string, err error)

func (*CLNService) ResetRouter

func (c *CLNService) ResetRouter(key string) error

func (*CLNService) SendKeysend

func (c *CLNService) SendKeysend(amount uint64, destination string, customRecords []lnclient.TLVRecord, preimage string) (*lnclient.PayKeysendResponse, error)

func (*CLNService) SendPaymentProbes

func (c *CLNService) SendPaymentProbes(ctx context.Context, invoice string) error

func (*CLNService) SendPaymentSync

func (c *CLNService) SendPaymentSync(payReq string, amount *uint64) (*lnclient.PayInvoiceResponse, error)

func (*CLNService) SendSpontaneousPaymentProbes

func (c *CLNService) SendSpontaneousPaymentProbes(ctx context.Context, amountMsat uint64, nodeId string) error

func (*CLNService) SettleHoldInvoice

func (c *CLNService) SettleHoldInvoice(ctx context.Context, preimage string) (err error)

func (*CLNService) Shutdown

func (c *CLNService) Shutdown() error

func (*CLNService) SignMessage

func (c *CLNService) SignMessage(ctx context.Context, message string) (string, error)

func (*CLNService) UpdateChannel

func (c *CLNService) UpdateChannel(ctx context.Context, updateChannelRequest *lnclient.UpdateChannelRequest) error

func (*CLNService) UpdateLastWalletSyncRequest

func (c *CLNService) UpdateLastWalletSyncRequest()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL