So far I have not yet encountered any concept which is not trivial. This means I am progressing. In my experience things are either trivial or impossible. Our job is to break down impossible tasks until they become trivial 🙂
One of the things I cherish from my youth are the days when I would be immersed in Point and click adventure games: Lucasfilm’s Indiana Jones, Monkey Island or Loom, Sierra’s Kings’ Quest or Leisure Suit Larry…
If I won the lottery tomorrow I would retire to learn how to create these wonderful worlds, to immerse the players in my adventurous story 🙂
Yesterday I learnt how to set up scummvm in my retropie and load Monkey Island. I want to be a pirate! 😀
Now that you have your node set up and you have established a few channels you can start routing payments. You can see my node here I have opened three channels for now, and with it I am able to route payments anywhere.
You can set up a tippin.me account to receive tips in satoshis. It creates a custodial lighning wallet where people can send you tips. You can send me some satoshis at https://tippin.me/@Rogeman (as of today 1 satoshi equals 0.00003416 Euros, so don’t be shy, if you go wild and send 1,000 satoshis it will be 3 cents of a euro 😉 )
To send a tip to tippin.me you need to use the payinvoice command, instead of the sendpayment command as you won’t have an invoice and you can send any amount you want.
Once you’ve created the invoice you can send the pay_req to the payer (in the above example lnbc1u1pw8a7u6pp5lxa8l4dshc7hdrpf4223kj3pt6n7xufnaw6pl4d86sjw0xq4280qdqqcqzysxqypr9qfrglxdwv8jdc9xlsyatugwztdvsn89y4hmlm2mgds5wyl9k3c963uk66zhntp6940yxpfz5fa0au9mcg4c0sfc77eg589fmpnjhcs6gp49ghuh)
Others can send you money with the sendpayment command by paying your invoice
With your lightning network node you can send payments which are:
Borderless: The internet knows no boundaries, it has no borders, you can as seamlessly send payments within your country, your continent, your planet, or your solar system. In the future we may need to send money to mars!
Anonymous: Since payments are routed via a mesh of nodes which can’t see the whole end to end payment route, payments are anonymous. This is different to on-chain bitcoin payments, which are only pseudo-anonymous and can be tracked to you.
Instantaneous: Once you start playing with lnd you will see that it takes less than a second to route a payment. This is mindblowing if you think about it. Internet packets are being communicated throughout the planet, from one internet provider to another, from one router to another, from one lnd node to another, until they reach their destination.
Low cost: The nodes (yours as well) set the fees they want to charge to route payments. The route chosen is always the cheapest one so this incentivises nodes to reduce the fees. Sending payments over the lightning network costs cents of euro equivalent in satoshis.
World scale: Lightning is capable of millions to billions of transactions per second across the network. Visa, which is currently the benchmark can transfer less than 2,000 transactions per second.
One problem lightning network has is that you can only send or receive as much money as you have route bandwidth for, this means that if you want to be able to receive payments worth 500 Euro, you need to have channels open worth 500 Euro. This can be pretty expensive for high value payments. Due to this constraint the lightning network can work very well for low value payments, like buying a coffee, and not so well for high value payments like buying a house. In any case high value payments can be done directly using the bitcoin blockchain without using the lightning network layer and are usually not done in high volumes. (Maybe a third layer protocol could be used to spit large payments into groups of smaller ones similarly how tcp over ip is capable of splitting large packets of information into smaller ones and guarantee order and completeness, you could split a payment of 1000 satoshis into two payments of 500)
This is the future of how robots will pay each other.
lnd is written in go. First we install the go compiler.
mkdir -p $HOME/src
git clone https://go.googlesource.com/go
git checkout go1.12
add the following to your $HOME/.bashrc
Once go is working we install lnd
go get -d github.com/lightningnetwork/lnd
make && make install
In order for lnd to communicate with your bitcoind process you need to configure zmq in your bitcoin.conf (if you followed my previous post you will have compiled bitcoind with zmq support).
if you are on testnet you can get some free satoshis (a.k.a. sats) by googling lightning network testnet faucet (here’s one). Once you have sent some money to your lnd wallet you can check your balance.
lighning network is a mesh of point to point nodes, so let’s connect to some nodes in the network. You can find nodes to connect to here https://1ml.com for mainnet and https://1ml.com/testnet/ for testnet.
For example, let’s connect to firstname.lastname@example.org:9735
now we can route payments through this node to any node in the lightning network. For example if you live in USA you can order a dominoes pizza. Let’s draw in satoshis.place my twitter handle (@Rogeman) (all-in cost 7675 sats, or 0,25 Euro. Totally worth it! :D)
Lightning network is a Layer 2 protocol that sits on top of the bitcoin/litecoin blockchain. It enables instant, low cost, anonymous payments by routing payments through point to point channels in a similar way to what the correspondent banking system uses today to transfer fiat currency.
you will need libzmq3 in order for the lighning node to communicate with your bitcoin node, so we need to install libzmq3-dev
sudo apt install libzmq3-dev
now we configure and install the node
sudo make install
bitcoind is installed! 🙂 now we need to create a config file and create an rpc user and password so you can communicate with your bicoind node
#This command will give you the user and password you will need to include in your bitcoin.conf
String to be appended to bitcoin.conf:
Your password: 34ZofsEbG95rWITDv8w03crrzIYBioGAKfMqDq1yY1A=
Let’s create a directory where all bitcoin data will be stored. Be warned that this directory will hold a copy of the whole bitcoin blockchain which is as of today 243 GB.
We will copy a bitcoin.conf file to the bitcoin data folder
now we edit the bitcoin.conf file, the following variables are important
#set testnet to 1 if you'd like to run a node for testing purposes not using real bitcoins.
#set daemon=1 to launch bitcoind as a daemon running in the background
#set rpcauth to the rpcuser you created earlier
We are set. Now we can start our bitcoind node with the following command. It could take one or two days to synchronise with the bitcoin blockchain.
now you can get an address where to deposit bitcoin in (you can buy these bitcoins in exchange for fiat currencies such as Euros or Dollars in exchanges like kraken.com or blockchain.org) do not send real bitcoin to a testnet wallet, they will be lost. You can get free testnet bitcoins by googling testnet bitcoin faucet. Here’s one (link)
bitcoin-cli -datadir=/opt/bitcoin-data -rpcuser=roge -rpcpassword=34ZofsEbG95rWITDv8w03crrzIYBioGAKfMqDq1yY1A= getnewaddress
#This will return the new address where you can send bitcoin to
# the command will return something like 3NUvF2fvitxrU1fY43rCQivx9RtCgvXuEb
Once you have transferred bitcoins to your wallet you can see your balance
bitcoin-cli -datadir=/opt/bitcoin-data -rpcuser=roge -rpcpassword=34ZofsEbG95rWITDv8w03crrzIYBioGAKfMqDq1yY1A= getbalance
#This command will output your bitcoin balance
In order to transfer bitcoins to another address you first need to unlock your wallet for x seconds
Mongodb is extremely easy to start playing with, for free you can create a database cluster in the cloud with 512MB by registering in mongodb.com and getting a Mongodb atlas.
MongoDB Compass is a graphical client with which you can connect to your database and analyse your data. It analyses the data and gives you insights on the types of data, you can also filter just by selecting with your mouse the data you want to filter on in an intuitive way.
The CLI is the best way to power-query your data. below my cheat-sheet after completing the basic training course:
Shows the databases
Once within a database , shows the collections
With ordered:false, it does not stop when a duplicate _id key is found,