Greenlight Lightning node deployment and developer API

Cloud infrastructure and non-custodial control

Blockstream provides Greenlight, a service that allows users to run a Lightning Network node on cloud infrastructure. The service uses c-lightning to keep operational costs low. Users maintain full control over their bitcoin because the private keys never leave the personal device of the user. This structure ensures that Blockstream operators cannot access user funds. The system works by having the node run on Blockstream infrastructure while the user’s device provides the necessary signatures for transactions. Blockstream releases the service in an incremental fashion to ensure stability. The service aims to reduce the difficulty of onboarding new users to the Bitcoin space.

This architecture allows for the sharing of a single node among any number of front-ends. This capability saves on-chain fees for the user and reduces the fragmentation of funds. In previous setups, users moved funds from a home node to a phone when they ran out of capacity. Sphinx and Lastbit currently host the service, allowing visitors to spin up a node on demand. Sphinx users can download the sphinx-relay onto Raspberry Pi hardware and connect it to the Greenlight server to begin chatting in seconds. Lastbit users use a web interface called Striga to manage their nodes.

The service also serves as a path for users to gain more knowledge. Once a user grows comfortable with the network, they can export their node and move it to another platform. This feature prevents users from becoming locked into one provider. Blockstream plans to improve privacy by encrypting invoices and payments at rest and implementing oblivious sends.

Developer API and delegation

Developers can integrate Lightning payments into applications by using a simple programmable interface. The recent debut of non-custodial API key delegation allows for more secure application design. The client repository includes gl-client, gl-testing, and gl-plugin. Developers can use gl-signerproxy to replicate the interface of a Greenlight node. This specific component allows for the use of a remote signer instead of keeping the seed on a server.

An application using Greenlight can take on two roles. The remote control role allows the application to authenticate as a user to manage channels and funds. The key manager role involves running a part of c-lightning called the hsmd to sign actions. You already understand how to manage a seed phrase, so you know the importance of keeping the 32-byte secret safe. The application must keep this secret on the user device. If the developer builds against the Greenlight API, the application will support Core Lightning when they move to their own infrastructure.

The gl-testing component provides a mock environment for code testing. This allows developers to test their applications without using the real Greenlight service. The gl-client provides language bindings to make interaction easier, including Python bindings in gl-client-py. Breez has already built its SDK on Greenlight and migrated the Breez wallet to the service. Validating Lightning Signer also helps with end-to-end verification.

Command line and registration

To register a node, users must first generate a 32-byte seed secret that they derive from a BIP 39 seed phrase to ensure they can recover their funds on a different device if they lose their original hardware. The glcli command-line interface makes this process straightforward. Users install the tool from crates.io and use it to manage their connections. The glcli tool provides an overview of all available commands once it is installed. The scheduler handles the registration of new accounts and the scheduling of nodes.

Users must configure Nobody credentials to talk to the scheduler via mTLS. The current environment consists of a single cluster located in us-west2. This location results in higher roundtrip times for users in distant regions. The mTLS handshake requires several roundtrips during the first connection, though the system can cache parts of the handshake to speed up reconnections. The node shuts down automatically after a few minutes of inactivity to save server resources. Will the latency in us-west2 disappear once the geo-load-balancing rollout completes?

The registration process requires the client to prove it has access to the private key. The signer processes signature requests and provides this proof to the scheduler. After registration, the user receives credentials to talk to the scheduler and the node. These credentials must stay secure.

Technical specifications and implementation

Greenlight supports three networks: bitcoin, testnet, and regtest. Most developers use testnet for testing, although the testnet can be flaky. The service scales by allowing many front-ends to connect to a single node. This capability reduces the need to move funds between different devices.

Feature Core Lightning (CLN) LND Eclair
Codebase C and Rust Go Scala
Architecture Fully Modular Monolithic Monolithic
Automation Full via CLBOSS Limited None
Backups Plugin support Mnemonic/Static Dat/sqlite/Postgres

Blockstream plans to add features such as automatic channel proposing and liquidity rebalancing. They also intend to add swap services in the future. These additions aim to simplify the management of liquidity for new users. Blockstream is also researching ways to extend verification to include an authorization layer for hardware wallet support. Automation for CLN nodes currently relies on the CLBOSS plugin. The current environment consists of a single cluster in us-west2.

Newsletter