Books and Papers
Total Page:16
File Type:pdf, Size:1020Kb
APPENDIX A Books and Papers Books Economics Economics in One Lesson, Henry Hazlitt, ISBN-13: 978-0517548233 Basic Economics, Thomas Sowell, ISBN-13: 978-0465060733 Crashed: How a Decade of Financial Crises Changed the World, Adam Tooze, ISBN-13: 978-0670024933 The Ascent of Money, Niall Ferguson, ISBN-13: 978-0143116172 The Ethics of Money Production, Jörg Guido Hülsmann, ASIN: B003NX6Z3W Denationalisation of Money, F. A. Hayek, ASIN: B005DTKORM Society The Sovereign Individual, James Dale Davidson and Lord William Rees-Mogg, ISBN-13: 978-0684832722 Exit, Voice, and Loyalty, Albert O. Hirschman, ASIN: 0674276604 © Harris Brakmić 2019 349 H. Brakmić, Bitcoin and Lightning Network on Raspberry Pi, https://doi.org/10.1007/978-1-4842-5522-3 APPENDIX A BOOKS and PaPERS Technology Mastering Bitcoin 2nd Edition, Andreas Antonopoulos, ASIN: B071K7FCD4 Programming Bitcoin, Jimmy Song, ISBN-13: 978-1492031499 A Dissection of Bitcoin, Paul Huang, ASIN: B0198LXI5K Bitcoin Internals, Chris Clark, ASIN: B00DG8EPT0 Applied Cryptography, Bruce Schneier, ISBN-13: 978-1119096726 Essays and Papers Bitcoin: A Peer-to-Peer Electronic Cash System, Satoshi Nakamoto, https://bitcoin.org/en/bitcoin-paper Bitcoin’s Academic Pedigree, Arvind Narayanan and Jeremy Clark, https://queue.acm.org/detail.cfm?id=3136559 Blockchain Proof-of-Work is a Decentralized Clock, Gregory Trubetskoy, https://grisha.org/blog/2018/01/23/explaining-proof- of-work/ Shelling Out: The Origins of Money, Nick Szabo, https://nakamoto institute.org/shelling-out/ Money, Blockchains, and social scalability, Nick Szabo, https://unenumerated.blogspot.com/2017/02/money-blockchains- and-social-scalability.html The many traditions of non-governmental money (part I), Nick Szabo, https://unenumerated.blogspot.com/2018/03/the-many- traditions-of-non-governmental.html Smart Contracts: Building Blocks for Digital Markets, Nick Szabo, https://web.archive.org/web/20151222144315/szabo.best.vwh.net/ smart_contracts_2.html 350 APPENDIX B Problems and Solutions Bitcoin Core Wallet Problem: The configuration script could throw the error: Configure could not find version of library. Solution: Append flag --with-boost-libdir=/usr/lib/x86_64-linux- gnu to the configure script, for example: ./configure --with-boost-libdir=/usr/lib/x86_64-linux-gnu [... other flags follow..] On 32-bit Raspbian you should use /usr/lib/arm-linux- gnueabihf instead. LND Problem: At start, LND throws the error: cannot unmarshal object into Go struct field GetBlockChainInfoResult.softforks Solution: Check out one of the v0.18.x branches from bitcoin’s repository (e.g., git checkout v0.18.1) and recompile and reinstall your local Bitcoin version. As of now (September 2019), LND only supports v0.18.x versions of Bitcoin Core reference client. © Harris Brakmić 2019 351 H. Brakmić, Bitcoin and Lightning Network on Raspberry Pi, https://doi.org/10.1007/978-1-4842-5522-3 APPENDIX B PRObLEMS aND SOLUTIONS Problem: How to create backups of channels and funds located in them? Solution: Since v0.6 LND offers the static channel backups scheme. There is a file in .lnd/data/chain/bitcoin/testnet (mainnet), called channel.backup, that is used to restore the channels. This file is encrypted with your wallet seed. The official guide can be found here: https://github.com/ lightningnetwork/lnd/blob/master/docs/recovery.md However, take into account that by default channel.backup is located on the same disk where LND runs, so it’s always a good strategy to copy it to another disk. Here is a script that automatizes this task: https://gist.github.com/alexbosworth/2c5e185aedbdac45a03655b709 e255a3 More info on Static Channel Backups: https://github.com/ lightningnetwork/lnd/releases/tag/v0.6-beta c-lightning Problem: How to create backups of channels and funds located in them? Solution: Copy hsm_secret from .lightning to a safe place first. Later, in case your node has crashed, you should follow these instructions to get your funds back: • Start lightningd --port=0 (this disables any communication) • Run lightning-cli newaddr a few times • Stop lightning daemon with lightning-cli stop 352 APPENDIX B PRObLEMS aND SOLUTIONS • Run sqlite3 with these options sqlite3 .lightning/lightningd.sqlite3 "UPDATE vars SET val= 500000 WHERE name='last_processed_block';" • Start lightningd --port=0 again • Initiate fund recovery with lightning-cli withdraw all It will now depend on your peers how long it will take, until all channels are closed and your funds available again. Meanwhile you will have to use another c-lightning instance as this node wouldn’t be available for any new channels or any other operations. Important Take care of not reusing or copying the lightnind. sqlite3 database file. Publishing an old state in Lightning Network will provoke revocations of transactions, which ultimately lead to loss of funds. Networking Problems Problem: The UFW (firewall) is blocking UPnPC port mapping. Solution: You should allow UDP packets for UPnPC inside your local network. Add this rule to your node’s UFW filter rules (replace the IP range with your own): sudo ufw allow from 192.168.0.0/24 port 1900 to any proto udp 353 Index A blockchain explorer, 255 compilation, 120–122 Addresses configuration file, 165–169 Base58, 51, 56 consensus rules, 7, 8 Bech32-type, 55 JavaScript language, 233 Bitcoin address, generation, 53 asynchronous command getnewaddress, 54 functions, 235, 236 command line tool bitcoin-cli, 54 Bech32, 246–248 double-SHA256 function, 52 bitcoin-core, 234 dumpwallet, 55 bitcoinlib-js package, 238 key types, 54 multisig script, 238, 240 P2SH-type, 54 P2PKH, 238 public key, 52 P2SH, 238 testnet and regtest types, 56 package.json file, 233 walletpassphrase, 55 scriptPubKey, 244 Asymmetric cryptography, 60, 74 SegWit address, 241–244 transaction data, 237 transaction malleability B problem, 244 Back-linked list of blocks, 17 WIF keys, 249 Base58Check format, 52 JSON format, 168 Basis of lightning technology monetary systems, 9 (BOLT), 267 money, 3–6 Bech32-type address, 55 public blockchain, 11–13 Bitcoin raw transaction access, 169 createrawtransaction bitcoin-rpc-explorer, 256, 258 command, 179 blockchain (see Blockchain) getblock command, 185 © Harris Brakmić 2019 355 H. Brakmić, Bitcoin and Lightning Network on Raspberry Pi, https://doi.org/10.1007/978-1-4842-5522-3 INDEX Bitcoin (cont.) Bitcoin client, 58, 131 getnewaddress bitcoin.conf, 166 command, 178 Bitcoin core wallet, 49, 123, 130 gettransaction command, 183 client settings, 160–163 hexadecimal form, 179 encryption, 141–146 MY_RAW_TX, 180 main window, 133 sendrawtransaction menu entry, 131 command, 182 message signing and signatures, 48–51 verification, 157–159 source code, Git, 113–116 sending and receiving funds systemd scripts, 225–229 (see Sending and receiving transaction funds) data, 173 transaction entries, 138 gettransaction Bitcoin log entries, 127 command, 170, 171 Bitcoin script hexadecimal string, 173 bloated, 73 regtest address, 170 browser console output, 204 serialized data, 174 browser warning, 205 structure, 174–177 CHECKSIG operation, 73, 77 transactions (see Transactions) constraints, 72 UFW convert, 260 execute DUP, 75 Using Python language, EQUAL, 77 229–232 EQUALVERIFY, 73, 77 ZeroMQ hashing, public key, 76 block hash format, 195 JavaScript testing install, 191 OP_MUL command, 218 message, 192 parsed structure, 216 NodeJS download, 189 visual script execution, 218 npm package, 193 LIFO, 202 publish–subscribe locking script, 203 method, 185, 186 OP_ADD, 72 ZMQ interface, 188 Op-Codes, 78 zmqtest directory, 191 OP_DUP and OP_HASH160, 73 Bitcoin CLI, 54, 58 parameters, 206 356 INDEX script notation, 205–208 file config, 290–293 scriptPubKey, 73 funding transaction, 302 signature and public key, 73 lightning node, 293–297 stack calculation, 207 payment channel stack structure, 202 creation, 300–305 turing-complete language, 204 port forwarding unlocking script, 203 (upnpc), 297–299 Bitcoin’s source code, 113 peer nodes, 303 Bitcoin Wallet GUI, 130–132 regtest, 304, 305 Bitcoin white paper, 27 testnet explorer, 297 Blockchain, 12, 27 testnet faucet, 294 back-linked list, 33 demo coffee shop, 305 back-linked stack, 35 experimental features, 310 confirmed member, 36 JSON object data, 308, 309 child block, 36 payment request, 307 decentralized and distributed plugins databases, 33 lightning-cli, 311–314 distributed over many nodes, 33 system configuration, 313, 314 Emergent Consensus, 37, 38 systemd, 320–321 forks, 36, 37 parameters, 309 Google’s LevelDB, 34 payment request, 306 parent block, 35 project’s sources, 289 predecessor, 34 QR codes, 307 replicated, 33 status of payment, 307 structure, 34 Coinbase, 21, 64, 65 transactions, 34 Collision-free, 14 variants, 36 Command line interface (CLI), 58 Commitment transactions Alice’s Private Key and Bob’s C Key, 277 Candidate blocks, 10 blockchain, 272 c-lightning, 289 changing state (payment), 272 compilation, 289, 290 definition, 272 configuration half-valid, 273 357 INDEX Commitment transactions (cont.) Environment Setup mirrored transactions, 273 hardware, 87–92 output transaction, 275 setting up, 116–120 revocation key, 275 EQUALVERIFY, 76 state creation, 275 Configuration F bitcoin-cli stop, 125 bitcoin.conf, 123 Fast Internet Bitcoin Relay daemon binary, 125 Network (FIBRE), 47 directory, creation, 124 Full Bitcoin Node, 22 HTTP-based API, 126 Full node, 10, 23, 43, 44, 47, log entries, 126 48, 130 non-mainnet Functioning node, 44 settings, 124 RPC server, 126 G regtest, 125, 126 git tool, 114 testnet,