Skip to main content

Funding your Lightning Gateway

Funding your Gateway with Ecash

The Fedimint Lightning Gateway is a user of the Fedimint who also runs a Lightning Node, so you have to manage liquidity on both the Fedimint and Lightning sides of the Gateway. This section assumes you've already funded the Lightning Node and set up some channels. If you haven't done that yet, go back to Part 1: Setting up a Lightning Node.

Now you need to fund the Gateway with some ecash. You can do this by sending onchain to a Fedimint peg-in address from the Thunderhub Dashboard.

  1. On your Thunderhub Dashboard, click "Peg-In", select the Fedimint you want to peg-in to, then click "Create Address" to generate a new peg-in address for that Fedimint.
  2. Copy the address to your clipboard.
  3. Go to the Mutinynet Faucet.
  4. Paste the address into the "Destination" field at the top and click "Make it rain" to send some signet sats to the peg-in address.

You won't see the transaction show up in your Thunderhub Dashboard until the Fedimint peg-in completes and you're issued the ecash, which will take at least a couple minutes and depend on the specific Federation's required confirmations (normally 6-10 confirmations). For more information on why this is necessary, see the Onchain Bitcoin TXs section of this documentation.

Once the peg-in completes, you'll see the ecash balance in your Thunderhub Dashboard. You'll see an aggregate balance for all your ecash on the homepage, and can see a breakdown of the ecash balance by specific Federation on the "Fedimints" tab.

![Thunderhub Fedimints Tab]

Managing Ecash Liquidity across Federations

Fedimint Lightning Gateways require additional liquidity management compared to a normal Lightning Node, because you have to manage liquidity on both the Fedimint and Lightning sides of the Gateway. This means you'll need to manage ecash liquidity across multiple Federations, and lightning channels based on the aggregate spending behavior of all the users of your Gateway.

We're working on tools to help you manage this with autopilot settings, but for now it's a manual process. You can do this by pegging in and pegging out ecash funds between the Lightning Node's onchain wallet and the Federations you're servicing. You can create addresses using Receive or Peg-In, or send to addresses using Send or Peg-Out on the Thunderhub Dashboard.

We recommend starting with a small amount of ecash in each Federation you're providing services to, then topping up if the ecash balance approaches 0 or pegging-out if the ecash balance increases beyond what you'd ideally like within a specific federation.

A couple heuristics to keep in mind:

For Fedi users to RECEIVE sats ecash via lightning gateway, the gateway needs INBOUND channel liquidity + E-CASH in the Federation.

You lock the ecash to the user in exchange for the preimage that lets you claim the corresponding sats from the lightning invoice. The gateway ends up with inbound channel liquidity.

For Fedi users to SEND sats ecash via lightning gateway, the gateway needs OUTBOUND liquidity.

They lock ecash to your gateway which you sweep by proving you paid the corresponding lightning invoice. The gateway ends up with outbound channel liquidity and ecash in the Federation.

For longer running federations with more active users, you'll want to keep a larger amount of ecash in the Federation to avoid running out of ecash and having to wait for a peg-in to complete. For smaller federations, you can keep a smaller amount of ecash in the Federation and top it up as needed.