Skip to content
LearnBitcoin

ResearchBitcoin Dev Archive lightning-dev list

Python LightningNetwork implementation

6 messages, Aug 11 to 14, 2015. Started by Jasper Hugunin.

Jasper Hugunin (3), Joseph Poon, Bryan Bishop, Rusty Russell

Permalink First message in the Wayback Machine

Jasper Hugunin permalink original

Hi all,

I'm Jasper Hugunin, a developer at HashPlex. I have implemented a full prototype Lightning node in Python and will be releasing tomorrow.

Features include: Micropayment channels supporting unilateral close. Basic routing support which allows payment to be routed multiple hops. Integration tests. MIT License.

Please be looking forward to it, - Jasper

Joseph Poon in reply to Jasper Hugunin permalink original

Hi Jasper,

On Tue, Aug 11, 2015 at 10:48:57AM -0700, Jasper Hugunin wrote:

Quoted text (8 lines)
> I'm Jasper Hugunin, a developer at HashPlex. I have implemented a full
> prototype Lightning node in Python and will be releasing tomorrow.
>
> Features include:
> Micropayment channels supporting unilateral close.
> Basic routing support which allows payment to be routed multiple hops.
> Integration tests.
> MIT License.

Very cool, I'm looking forward to it!!

Jasper Hugunin in reply to Joseph Poon permalink original

Sorry for the wait.

Here is the repo: https://github.com/hashplex/Lightning

This version is meant to be a minimal node able to send payment across multiple hops in the network. I intend to follow Rusty's micro-payment channel design, but revocation and HTLCs have not yet been implemented. Routing also uses an insecure payment forwarding algorithm (since HTLCs are missing), and does not handle channels closing. See the GitHub issue tracker for more details.

I have attempted to split the server, the UI, the channel protocol, and the routing protocol into separate modules so that they can be developed independently. My hope is that someone interested in routing can work on the routing protocol before micro-payment channels are fully secured.

I look forward to working with you all, - Jasper

On Tue, Aug 11, 2015 at 10:58 AM, Joseph Poon <joseph at lightning.network> wrote:

Quoted text (17 lines)
> Hi Jasper,
>
> On Tue, Aug 11, 2015 at 10:48:57AM -0700, Jasper Hugunin wrote:
> > I'm Jasper Hugunin, a developer at HashPlex. I have implemented a full
> > prototype Lightning node in Python and will be releasing tomorrow.
> >
> > Features include:
> > Micropayment channels supporting unilateral close.
> > Basic routing support which allows payment to be routed multiple hops.
> > Integration tests.
> > MIT License.
>
> Very cool, I'm looking forward to it!!
>
> --
> Joseph Poon
>
Bryan Bishop in reply to Jasper Hugunin permalink original

On Wed, Aug 12, 2015 at 11:12 AM, Jasper Hugunin <jasper at hashplex.com> wrote:

Quoted text (2 lines)
> Here is the repo: https://github.com/hashplex/Lightning
>

The routing seems to only send to one peer. What happens if that peer does not know the destination either? or what if you have more than one peer?

https://github.com/hashplex/Lightning/blob/fa94a05170faa954d3f6505265d34ac97983f083/lightning.py#L99

- Bryan http://heybryan.org/ • ••• ••• ••••

Jasper Hugunin in reply to Bryan Bishop permalink original

The routing protocol is a variant of distance-vector routing <https://en.wikipedia.org/wiki/Distance-vector_routing_protocol>. The idea is that nodes tell their peers beforehand "I know how to get to node X, and it will cost you this much." Nodes use this information to build a routing table saying "If I want to send payment to node X, I should forward payment to node B." Then when payment needs to be sent, the node looks up "Which of my peers do I forward to?" That is done by the "SELECT nexthop, cost FROM ROUTES WHERE address = ?" query. If the peer you select does not know the destination, they lied to you. If you have more than one peer, you choose the cheapest one. That said, the current routing protocol is something of a hack to demonstrate potential, rather than a final solution.

Thanks, - Jasper

On Wed, Aug 12, 2015 at 9:31 AM, Bryan Bishop <kanzure at gmail.com> wrote:

Quoted text (16 lines)
> On Wed, Aug 12, 2015 at 11:12 AM, Jasper Hugunin <jasper at hashplex.com>
> wrote:
>
>> Here is the repo: https://github.com/hashplex/Lightning
>>
>
> The routing seems to only send to one peer. What happens if that peer does
> not know the destination either? or what if you have more than one peer?
>
>
> https://github.com/hashplex/Lightning/blob/fa94a05170faa954d3f6505265d34ac97983f083/lightning.py#L99
>
> - Bryan
> http://heybryan.org/
> • ••• ••• ••••
>
Rusty Russell in reply to Jasper Hugunin permalink original

Jasper Hugunin <jasper at hashplex.com> writes:

Quoted text (12 lines)
> The routing protocol is a variant of distance-vector routing
> <https://en.wikipedia.org/wiki/Distance-vector_routing_protocol>. The idea
> is that nodes tell their peers beforehand "I know how to get to node X, and
> it will cost you this much." Nodes use this information to build a routing
> table saying "If I want to send payment to node X, I should forward payment
> to node B." Then when payment needs to be sent, the node looks up "Which of
> my peers do I forward to?" That is done by the "SELECT nexthop, cost FROM
> ROUTES WHERE address = ?" query. If the peer you select does not know the
> destination, they lied to you. If you have more than one peer, you choose
> the cheapest one.
> That said, the current routing protocol is something of a hack to
> demonstrate potential, rather than a final solution.

Hi Jasper,

        Yeah, routing is going to be hard, this seems perfectly workable
for bootstrapping.

I'm hoping to review your code next week, once I've got my own protocol state machine tested.

Cheers! Rusty.