We have a treat from our developers – a Technical Preview release of Lightning Network running on Bitcoin Gold!

Our devs have successfully brought to life all the core functions for a BTG-based implementation of Lightning Network, based on LND (the Lightning Network Daemon) from Lightning Labs. This release provides a Technical Preview version that other developers can test and experiment with.

What is Lightning Network?

It’s a brilliant way to create super-fast, micro-cost BTG payments with virtually no limits to the transactions per second or the number of users.

Lightning Network payments take place through payment channels directly between users, without waiting for blocks on the blockchain, so they are instantaneous. At the same time, the payments are reliable and trustable because of the way those payment channels are created and funded: with smart contracts on the blockchain.

Because Lightning Network depends on a Segwit-enabled blockchain (like the BTG blockchain) as a base layer where the channels can be created, it’s often called a “second layer solution.”

The last piece of the puzzle? Routing:

Routing

On the Lightning Network, two people don’t need a direct channel to send money to each other because the payment can travel across many peoples’ channels. As long as there’s a path between people, the network can route the funds between them. The payment “hops” through channels between multiple people to reach the recipient, and clever cryptography within the Lightning Network payment system ensures that nobody in the chain gets paid unless everybody in the chain gets paid. And since each individual transfer is instantaneous, the entire chain of payments can be completed in a moment!

This code is backed by solid engineering, but the combined effect is somewhat magical. Channels between nodes are secure and trusted because they’re based on coins and contracts on the base-layer blockchain. Meanwhile, payments across those channels in the second-layer Lightning Network happen instantly, without waiting for the blockchain, by flowing through those pre-established channels.

So Lightning Network is super-fast – but how is it micro-cost?

The cost of opening or closing a channel is based on the cost of transactions on the blockchain – every new channel puts activity on the underlying blockchain, which incurs a fee. But, once a channel is opened, it can be used for thousands of payments without touching the blockchain again, so none of the payments incur that cost. Each Lightning Network payment includes a tiny, tiny fee which is paid to the node that relays a payment. The tiny fee is so small it’s almost negligible, but it gives people an incentive to allow their nodes to serve as relays, and it also prevent spamming (if transactions were completely free, someone could write bots to just push massive number of tiny payments to try to cause trouble.)

What it All Means

When many thousands of people have Lightning Network nodes, this system is capable of sending millions to billions of transactions per second!!! Without changing the underlying blockchain, Lightning Network delivers:

  • instant transactions – payments in a fraction of a second
  • phenomenal scalability – perhaps millions of transactions per second before a block size needs to be increased
  • tiny fees so that even true micropayments are possible

And that’s just the beginning – the advent of Lightning Network provides the basis for future developments. When Lightning Networks for different blockchains are compatible, transactions can be made across blockchains in what’s called a “cross-chain atomic swap.” You’ll be able instantly trade BTG for Bitcoin or Litecoin with someone else, without involving an Exchange, without needing an escrow, and without needing to trust the other party!

The Technical Preview

If you’re adept enough to install a computer language, compile code, and configure software, you can go ahead and install our LND implementation from this GitHub repo, and play with it yourself. There isn’t yet a graphical user interface, and it’s only intended for use on the BTG testnet at this time, but the code is fully functional and you can walk through the Lightning Network Developers tutorial with it. (Our implementation is being built to fully compliant with the BOLT specification.)

For those of use who aren’t ready to compile and configure our own nodes manually, there’s a walkthrough below of how the technology works; you can see what we’re already able to do on the BTG Lightning Network.

Gratitude

We’re excited about the possibilities this new technology brings (you should be, too!), and that’s why we’re working hard to bring it to fruition on our blockchain – but we’d be remiss if we didn’t mention that the open-source LND code we’re working on is being developed by Lightning Labs, who announced their first mainnet beta of Lightning for Bitcoin just a few months ago, and we want to thank the authors of the original Lightning Network whitepaper, Joseph Poon and Thaddeus Dryja.

As always, we’re grateful for the fantastic community of open source developers working on exciting projects today and we look forward to making our own contributions to these projects in the future.

Building better every day,
The Bitcoin Gold Organization
#1CPU#1VOTE


Lightning Network Technical Preview:
a Basic Walkthrough

Developers can install our Technical Preview and perform the walkthrough with real nodes, but for the rest of us, here’s a description of what we’re now able to do on BTG with Lightning Network.

Let’s say that Alice and Bob want to be able to interact. First, they each set up a Lightning Node of their own:     They’ve set up software on their computers, but they haven’t touched the BTG blockchain, yet.


Now, Alice opens a payment channel to Bob, and funds it with 1 BTG:

Alice and Bob can both trust this channel because it is opened as a smart contract on the blockchain and they each hold one of the multi-signature keys for the contract. In the channel, Alice has 1.0 BTG, and Bob has none.


Next, Alice sends 0.2 BTG to Bob:

This transfer was instantaneous! It didn’t have to wait for a block, because the channel still contains 1.0 BTG, same as before – but now Alice has 0.8 and Bob has 0.2. If they were to close the channel now, the smart contract on the blockchain would give Alice 0.8 and Bob would get 0.2 – but let’s say they don’t close the channel. They leave things up and running.


Now, let’s add Charlie to the picture. He puts up a node:


And then Charlie opens a channel with Bob, funding it with 0.2 BTG:

Again, creating the channel happens as a smart contract on the blockchain where Bob and Charlie have keys, which contains 0.2 BTG. Only Bob and Charlie trust this new channel.


Now, the magical part – it’s easy to see that Charlie can send money to Bob, but Charlie can also send money to Alice, even though they don’t have a channel! Here’s Charlie sending 0.1 BTG to Alice through Bob:

Charlie sent 0.1 to Bob, and Bob sent 0.1 to Alice, and it was all instantaneous, because this “multi-hop” payment happened without involving the blockchain. And Bob didn’t even need to be around to handle the two transactions; his Lightning Node was there to serve a purpose, connecting other people. In a large network these payments can go through many people to reach their destinations. It’s like a chain reaction, money flowing quickly through the network like lightning!

Notice that the Alice-Bob channel still contains 1.0 BTG, and the Bob-Charlie channel still contains 0.2 BTG. This is how many BTG are locked on the blockchain smart contract for their channel.


Here’s one last image, the same as the previous one, but you can see how the two channels are tied to the blockchain:

This is why the Lightning Network is a second-layer solution. The coins actually stay on the base layer of the blockchain, but are locked up in a contract between the two people who open the channel. Lightning Network creates the channels where those coins can move back and forth without needing to update the blockchain – and lets networks of people move coins across multiple channels – instantly.

Alice, Bob, and Charlie can move money back and forth thousands of times, without making transactions that take up space on the blockchain! And because they don’t touch the blockchain, the fees are super-low – so low that they can be sending 0.00000001 BTG back and forth thousands of times.

Instant – Super-Scalable – Tiny Fees
Lightning Network