Skip to content

A technical tutorial for understanding how lightning transactions are created

Notifications You must be signed in to change notification settings

MPins/lightning-tx-tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

UNDER CONSTRUCTION

lightning-tx-tutorial

This repo contains a series of python jupyter-notebooks to explain how lightning transactions are created. The notebooks will start up an instance of bitcoind in regtest mode so that transactions can be validated and broadcasted on regtest. Each notebook has some questions and exercises to test your understanding.

Prerequisite knowledge

Chapters

  • Chapter 1: 'Funding Transactions'
    • Segwit
    • Taproot
  • Chapter 2: 'Commitment Transaction'
    • Simple Commitment Transaction
    • Pending HTLCs
    • Anchor Outputs
  • Chapter 3: 'Closing Transactions'
    • Colaborative Closing
    • Force Closing

Setup

Python3

This project requires Python 3.6 (or greater) to be installed on your machine already. All other dependencies will be installed automatically with pip3.

To verify your Python version, run

python3 --version

If it is properly installed, you should see something like:

Python 3.9.13

To copy the repository to your local machine you can download the files directly from GitHub, there are no further dependencies on git.

git clone https://github.com/MPins/lightning-tx-tutorial
cd lightning-tx-tutorial

To create a virtual environment and install all dependencies:

python3 -m venv myenv
source myenv/bin/activate
pip3 install -r requirements.txt

Finally, to launch the interactive notebook:

jupyter lab

Bitcoin core

The notebooks in this repo use bitcoin core's TestShell from its test framework. The TestShell is used to create a local test instance of a bitcoin node (and blockchain) against which we can test our manually created transactions. The notebooks in this repo have been tested with bitcoin core v24.0.1.

Acknowledgements

About

A technical tutorial for understanding how lightning transactions are created

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published