Moving to production

To move your project to production, you will have to replace the evaluation invite code with a partner certificate issued by Greenlight.

Rust
// Read in your Greenlight credentials from the file 
// system, environment variable or build config
let developer_key: Vec<u8> = vec![];
let developer_cert: Vec<u8> = vec![];
let greenlight_credentials = GreenlightCredentials {
    developer_key,
    developer_cert,
};

let node_config = NodeConfig::Greenlight {
    config: GreenlightNodeConfig {
        partner_credentials: Some(greenlight_credentials),
        invite_code: None,
    },
};
Swift
// Read in your Greenlight credentials from the file 
// system, environment variable or build config
let developerKey = [UInt8]()
let developerCert = [UInt8]()
let greenlightCredentials = GreenlightCredentials(developerKey: developerKey, developerCert: developerCert)

let nodeConfig = NodeConfig.greenlight(
    config: GreenlightNodeConfig(partnerCredentials: greenlightCredentials, inviteCode: nil))
Kotlin
// Read in your Greenlight credentials from the file 
// system, environment variable or build config
val developerKey = emptyList<UByte>()
val developerCert = emptyList<UByte>()
val greenlightCredentials = GreenlightCredentials(developerKey, developerCert)

val nodeConfig = NodeConfig.Greenlight(GreenlightNodeConfig(greenlightCredentials, null))
React Native
// Read in your Greenlight credentials from the file
// system, environment variable or build config
const developerKey: number[] = []
const developerCert: number[] = []
const greenlightCredentials: GreenlightCredentials = {
  developerKey,
  developerCert
}

const nodeConfig: NodeConfig = {
  type: NodeConfigVariant.GREENLIGHT,
  config: {
    partnerCredentials: greenlightCredentials
  }
}
Dart
// Read in your Greenlight credentials from the file 
// system, environment variable or build config
Uint8List developerKey = Uint8List(0);
Uint8List developerCert = Uint8List(0);
GreenlightCredentials greenlightCredentials = GreenlightCredentials(
  developerKey: developerKey, 
  developerCert: developerCert,
);

NodeConfig nodeConfig = NodeConfig.greenlight(
  config: GreenlightNodeConfig(
    partnerCredentials: greenlightCredentials,
    inviteCode: null,
  ),
);
Python
# Read in your Greenlight credentials from the file 
# system, environment variable or build config
developerKey = []
developerCert = []
greenlightCredentials = breez_sdk.GreenlightCredentials(developerKey, developerCert)

node_config = breez_sdk.NodeConfig.GREENLIGHT(
    breez_sdk.GreenlightNodeConfig(greenlightCredentials, None))
Go
// Read in your Greenlight credentials from the file
// system, environment variable or build config
developerKey := []uint8{}
developerCert := []uint8{}
greenlightCredentials := breez_sdk.GreenlightCredentials{
    DeveloperKey:  developerKey,
    DeveloperCert: developerCert,
}

nodeConfig := breez_sdk.NodeConfigGreenlight{
    Config: breez_sdk.GreenlightNodeConfig{
        PartnerCredentials: &greenlightCredentials,
        InviteCode:         nil,
    },
}
C#
// Read in your Greenlight credentials from the file 
// system, environment variable or build config
var developerKey = new List<byte>();
var developerCert = new List<byte>();
var greenlightCredentials = new GreenlightCredentials(developerKey, developerCert);

var nodeConfig = new NodeConfig.Greenlight(
    new GreenlightNodeConfig(greenlightCredentials, null)
);

To obtain a certificate for a production environment, please register here and make sure to notify your LSP(s).

Applying certificates

The certificates received from Blockstream should be contained with a zip file. Within the zip file should be a .crt and a .pem file, these are the certificate and private key files. To use these files with the Breez SDK each file needs to be read as binary/byte data, inserting the .crt data as the developer cert and the .pem data as the developer key.

Developer note

Leave the file contents as is, manipulating the file contents will result in transport errors.
  • Do not strip the headers and footers from the file contents
    (BEGIN CERTIFICATE / END CERTIFICATE / BEGIN PRIVATE KEY / END PRIVATE KEY)
  • Do not use only part of the certificate

Production checklist

There are some use cases where you need to verify that they are implemented correctly. Here is a checklist you can use to verify that your application is production ready.

  • Add logging: Add sufficient logging into your application to diagnose any issues users are having. For more information: Adding logging.

  • Handle closed channels: Make sure you allow your users to redeem their onchain balance in case their channels were closed. For more information: Handling channel closures.

  • Display pending payments: Payments always contain a status field that can be used to determine if the payment was completed or not. Make sure you handle the case where the payment is still pending by showing the correct status to the user.

  • Enable swaps refunds: Swaps that are the result of Receiving an On-Chain Transaction may not be completed and change to Refundable state. Make sure you handle this case correctly by allowing the user to retry the refund with different fees as long as the refund is not confirmed. A confirmed refund changes the swap status from Refundable to Completed.

  • Expose swap fees: When sending or receiving on-chain, make sure to clearly show the expected fees involved, as well as the send / receive amounts.

  • Connect on-demand: Create a Lightning node (connect) only when users are interested to receive payments with Lightning (not on the app startup).