<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ryan Tremblay on Medium]]></title>
        <description><![CDATA[Stories by Ryan Tremblay on Medium]]></description>
        <link>https://medium.com/@zaptrem?source=rss-76be2b934742------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*1DbKvtoopw4HyJmsemIM3w@2x.jpeg</url>
            <title>Stories by Ryan Tremblay on Medium</title>
            <link>https://medium.com/@zaptrem?source=rss-76be2b934742------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 14:11:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@zaptrem/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A Sim]]></title>
            <link>https://zaptrem.medium.com/a-sim-6e635e6d5bff?source=rss-76be2b934742------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e635e6d5bff</guid>
            <dc:creator><![CDATA[Ryan Tremblay]]></dc:creator>
            <pubDate>Tue, 26 Jan 2021 06:31:00 GMT</pubDate>
            <atom:updated>2021-01-26T06:33:12.512Z</atom:updated>
            <content:encoded><![CDATA[<h3>A Simple Expanation of The Game Theory Behind Bitcoin’s Proof of Work System</h3><p>Originally published here in 2018: <a href="http://blogs.cornell.edu/info2040/2018/10/16/a-simple-expanation-of-the-game-theory-behind-bitcoins-proof-of-work-system/">http://blogs.cornell.edu/info2040/2018/10/16/a-simple-expanation-of-the-game-theory-behind-bitcoins-proof-of-work-system/</a><br>Link: <a href="https://bitcoin.org/bitcoin.pdf">Bitcoin: A Peer-to-Peer Electronic Cash System</a></p><p>This is oversimplified and assumes a very basic understanding of <a href="https://en.wikipedia.org/wiki/Digital_signature">digital signatures</a> and <a href="https://en.wikipedia.org/wiki/Hash_function">hash functions</a>.</p><p>Blockchains attempt to solve the problem of coordinating distributed and untrustworthy players into a single secure and global network. As there can be no master coordinator (like in a modern client-server database) all of the players must reach <em>consensus</em> only by talking to other players. This requires <em>Practical Byzantine Fault Tolerance</em>, which comes from a 1982 paper <a href="https://web.archive.org/web/20170205142845/http://lamport.azurewebsites.net/pubs/byz.pdf"><em>The Byzantine General’s Problem</em></a>.</p><p>This game goes as such: There are a number of generals plotting to attack a town. However, they all have to agree on whether to attack or retreat to get a reward. Additionally, communication between the generals is unreliable (messengers might be killed or could be traitors) and one or more might be traitors, sending different information to different generals. Bitcoin was the first to solve this problem in a practical sense, where the network aligned the economic incentives of the majority around acting truthfully using public/private key cryptography and the <em>proof of work</em>system.</p><p>A miner first cryptographically verifies that every message it received from other parties is genuine (it actually came from the party the message states it came from) using public keys attached to the transactions. After that, it verifies that every message makes sense. For example, if the miner receives two messages signed by the same private key saying opposite things (attack/retreat or send all my money to person a/b) it will ignore one of them (in Bitcoin the miner chooses based on the message with the highest bounty or “transaction fee” attached to it by the sender). Additionally, the miner ignores transactions that try to spend money that doesn’t exist. Finally, the miner is ready to start the most computationally intensive portion of the process.</p><p>The miner next bunches these verified transactions together into a block, adds a small random number called a <em>nonce</em>, and runs the resulting data through a hash function. Using an arbitrary difficulty (which the network previously agreed upon) the miner will change this nonce and run the hash function again and again until it finds a combination that results in a hash that meets some arbitrary specification (e.g., it must end in five zeros). After that, other miners independently verify the block is valid begin to build their own blocks on top of it <em>if and only if this block is the head of the longest chain those other miners know about</em>. If a different miner found a valid solution first that other miners build on that block and pretend the new one doesn’t exist (the block is <em>orphaned</em>). The <em>dominant strategy</em> for miners in a network where the majority not colluding is therefore to act truthfully, as otherwise they lose the reward (block reward and transaction fees) they reap if their block is accepted and built upon by the majority.</p><p>As more and more Bitcoin miners compete for a limited allowed number of blocks per hour (currently at 6) the difficulty increases, necessitating more and more computing power. The Proof of Work system dooms Bitcoin to cost more and more money to secure and take a larger and larger toll on the environment (through the miners’ increasing demand for electricity). However, the world of blockchain is changing as innovative new solutions to the Generals Problem are introduced. One of the most fascinating of these to me is Ethereum’s Casper Sharding+Beacon Chain system. However, I’ll save that for the next post.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e635e6d5bff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ethereum 2.0’s Nothing at Stake Problem]]></title>
            <link>https://zaptrem.medium.com/ethereum-2-0s-nothing-at-stake-problem-65f7fc5e2edd?source=rss-76be2b934742------2</link>
            <guid isPermaLink="false">https://medium.com/p/65f7fc5e2edd</guid>
            <dc:creator><![CDATA[Ryan Tremblay]]></dc:creator>
            <pubDate>Tue, 26 Jan 2021 06:29:18 GMT</pubDate>
            <atom:updated>2021-02-19T05:22:52.915Z</atom:updated>
            <content:encoded><![CDATA[<p>Originally posted here in late 2018: <a href="http://blogs.cornell.edu/info2040/2018/11/29/ethereum-2-0s-nothing-at-stake-problem/">http://blogs.cornell.edu/info2040/2018/11/29/ethereum-2-0s-nothing-at-stake-problem/</a></p><p>Link: <a href="https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQs#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed">Ethereum Proof of Stake FAQ — What is the nothing at stake problem and how can it be fixed?</a></p><p>Last time I explained Proof of Work, blockchains, and the Byzantine General’s Problem: <a href="http://blogs.cornell.edu/info2040/2018/10/16/a-simple-expanation-of-the-game-theory-behind-bitcoins-proof-of-work-system/">A Simple Expanation of The Game Theory Behind Bitcoin’s Proof of Work System</a></p><p>This isn’t the exciting full look at Ethereum’s Serenity Proof of Stake system. Sadly, the spec is still changing massive amounts every day and anything I write now will likely be actively misleading six months from now (2018/11/29)(for example, six months ago the leading concept was <a href="https://www.youtube.com/watch?v=M3EFi_POhps">Consensus by Bet</a>). I will quickly look at a particularly interesting piece of the puzzle.</p><p>— — — — — — — — — — — — — — — -</p><p>Proof of Stake blockchains attempt to solve many of the problems inherent to Proof of Work (see my last post) by replacing miners with <strong>validators</strong>. Instead of using their money to purchase expensive mining hardware, validators directly stake their money by putting it in blockchain-based time-locked deposits and validating blocks directly. The specifics of this locking and validation process are outside the scope of this post.</p><p>In Proof of Work, miners are incentivized to mine on the longest/most valid chain and <em>only</em> that chain because it is the chain where their blocks (and their accompanying block rewards) are least likely to be orphaned (abandoned by the network in favor of another longest chain). The computing power they invest in a certain chain is proportional to their reward. However, Proof of Stake validators aren’t limited by computing power. When one of these orphan chains appears and a fork happens, validators can easily begin validating on multiple chains (as in these “alternate realities” of sorts their money can be represented differently). In this way, a validator’s dominant strategy is to mine on every chain to maximize their expected revenue. Obviously, this creates a problem. Now, attackers only need to overpower the few “altruistic” nodes that only validate one chain at a time and the rest will follow.</p><p>To mitigate this problem, researchers introduced the idea of a <strong>slashing system</strong>. The slasher will punish those who cheat by validating multiple orphan chains simultaneously by “slashing” their deposits. However, blockchains are unable to communicate with orphan chains on their own, so the system relies on “bounty hunters” of sorts who collect orphan blocks and extract cryptographically signed votes offenders made on other chains. If these hunters discover the offender also voted on a block of the same height in the main chain, they can submit the two conflicting signed votes to the slasher. As a reward, the slasher pays a portion of the offender’s stake to the bounty hunter and burns a larger portion (this portion is gone entirely, nobody can ever use it again).</p><p>As a result, the incentives have changed. Now, as these validators can actively lose their principal by misbehaving (as opposed to a certain time period worth of profits a miner might lose), they are more incentivized to avoid participating in 51% attacks than even miners are!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65f7fc5e2edd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mainnet Lightning: Run LND+Zap-Desktop on Windows]]></title>
            <link>https://zaptrem.medium.com/mainnet-lightning-run-lnd-zap-desktop-on-windows-f73cf78dd633?source=rss-76be2b934742------2</link>
            <guid isPermaLink="false">https://medium.com/p/f73cf78dd633</guid>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[lightning-network]]></category>
            <dc:creator><![CDATA[Ryan Tremblay]]></dc:creator>
            <pubDate>Mon, 29 Jan 2018 19:15:31 GMT</pubDate>
            <atom:updated>2018-10-26T15:59:27.128Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*A3cg2ssfSYzb7p9KgON2uA.png" /><figcaption>picture src: coincenter.org</figcaption></figure><p><strong>HELLO! Both LND and Zap work differently now as the developers are working towards a final, user friendly release. As a result, much of this guide no longer applies. </strong><a href="https://blog.lightning.engineering/announcement/2018/03/15/lnd-beta.html"><strong>https://blog.lightning.engineering/announcement/2018/03/15/lnd-beta.html</strong></a></p><p>First: Know that trusting your money to an untested system where you will likely lose said money is a horrible idea and you definitely shouldn’t do it. <a href="https://twitter.com/elonmusk/status/957476434800386053">Unless you like fun</a>.</p><p>Second: Know that I am personally (like nearly everyone) almost brand new to the system, so I may have missed a few things. However, after spending a week coming dangerously close to throwing my computer out the window trying to get past certain issues I felt obligated to share my knowledge.</p><p>Third: This guide is also not final, and it will be updated over time as more knowledgeable people report the glaring security flaws/additional setup that I didn’t mention.</p><h3>Prerequisites (These Have GUI Installers)</h3><ul><li><a href="https://www.python.org/ftp/python/2.7.14/python-2.7.14.msi">Python 2.7</a> (Needed to build build Zap)</li><li><a href="http://gitforwindows.org/">Git</a> (used to maintain open source repos like LND)</li><li><a href="https://nodejs.org/en/">Node Package Manager</a> (manages dependencies for many web development projects)</li><li><a href="https://yarnpkg.com/en/docs/install">Yarn Package Manager</a> (another PM)</li><li><a href="http://landinghub.visualstudio.com/visual-cpp-build-tools">Microsoft C++ Build Tools 2015</a> (needed to aid in compiling some of the other programs we will use)</li><li><a href="http://www.majorgeeks.com/mg/getmirror/visual_c_runtime_installer,1.html">All Visual C++ Redistributables</a> (needed for basically every Windows program nowadays)</li><li><a href="https://golang.org/dl/">Go</a> (a programming language used by LND) (make sure to use the Windows x64 installer!)</li><li><a href="https://bitcoin.org/en/download">Bitcoin-Core</a> (communicate with the Bitcoin network) (do not run after installer completes!)</li><li><a href="http://miru.hk/archive/ZeroMQ-4.0.4~miru1.0-x64.exe">ZeroMQ</a> (Bitcoind uses this to talk to our LND node)</li><li>~170gb of disk space (the blockchain is yuuge!)</li></ul><h3>Step 1: Configuring bitcoind</h3><p>To make things easier on newbies, we’re going to bundle bitcoind’s parameters into a batch file instead of configuring bitcoin.conf. This command can either be run by itself or saved in a .bat file using a text editor (e.g., Notepad).</p><p>Open the Command Prompt and run this command</p><pre>“C:\Program Files\Bitcoin\daemon\bitcoind.exe” -zmqpubrawblock=tcp://127.0.0.1:18501 -zmqpubrawtx=tcp://127.0.0.1:18501 -rpcuser=INSERT_USERNAME -rpcpassword=INSERT_PASSWORD -server=1 -txindex=1</pre><p>Optional Parameters:</p><p>-dbcache=(megabytes) sets the blockchain database RAM cache size (a higher number will help Bitcoin sync faster, but make sure not to allocate more than half your total available ram)</p><p>-maxconnections=(number) number of connections allowed to and from your node, good for high-bandwidth servers.</p><p>When this command is executed, Bitcoin-Core will begin to download the ~170gb full blockchain from other nodes on the network. I suggest letting this run overnight.</p><h3>Step 2: Use Bitcoin-CLI to Encrypt Your Wallet and Check Sync Status</h3><p>Run this command in a separate Command Prompt window to encrypt your wallet (required):</p><pre>“C:\Program Files\Bitcoin\daemon\bitcoin-cli.exe” -rpcuser=INSERT_USERNAME -rpcpassword=INSERT_PASSWORD encryptwallet AVERYSECUREPASSWORD</pre><p>Run this command to see how much of the blockchain your node has downloaded so far:</p><pre>“C:\Program Files\Bitcoin\daemon\bitcoin-cli.exe” -rpcuser=INSERT_USERNAME -rpcpassword=INSERT_PASSWORD getinfo</pre><p>Compare the “blocks” number to the most recent block <a href="http://blockchain.info/">here</a></p><h3>Step 3: Set your GOPATH Environment Variable (this can be done while bitcoind is syncing)</h3><p>Taken from the Go Github Wiki:</p><p>Your workspace can be located wherever you like, but we’ll use C:\go-work in this example.</p><p>NOTE: that GOPATH must not be the same path as your Go installation.</p><ul><li>Create folder at C:\go-work.</li><li>Right click on “Start” and click on “Control Panel”. Select “System and Security”, then click on “System”.</li><li>From the menu on the left, select the “Advanced systems settings”.</li><li>Click the “Environment Variables” button at the bottom.</li><li>Click “New” from the “User variables” section.</li><li>Type GOPATH into the &quot;Variable name&quot; field.</li><li>Type C:\go-work into the &quot;Variable value&quot; field.</li><li>Click OK.</li></ul><h3>Step 4: Pull LND and Modify It to Run on the Mainnet (can also be done while bitcoind is syncing)</h3><p>Open another Command Prompt window and run these commands in order:</p><p>Install Glide (a Go package manager):</p><pre>go get -u github.com/Masterminds/glide</pre><p>Pull the LND repo from Github:</p><pre>git clone <a href="https://github.com/lightningnetwork/lnd">https://github.com/lightningnetwork/lnd</a> %GOPATH%/src/github.com/lightningnetwork/lnd</pre><p>Navigate to the New Folder:</p><pre>cd %GOPATH%/src/github.com/lightningnetwork/lnd</pre><p>Use Glide to install dependencies:</p><pre>glide install</pre><p><em>Note: If glide install doesn’t work (saying “glide not recognized..etc..”): This means Glide wasn’t added to your system path. For a short-term solution, try putting glide.exe (from your go file or from their </em><a href="https://github.com/Masterminds/glide/releases"><em>GitHub</em></a><em>) into any folder you plan on running the glide command in. In case of an “access denied” error, reader </em><a href="https://medium.com/u/d5fdfb5ae9ed"><em>Василий Ширкин</em></a><em> also suggested this: “</em>you can download old glide.exe version 0.12.3, and put it in %GOPATH%\bin”</p><p>Now minimize the window and navigate to %GOPATH%/src/github.com/lightningnetwork/lnd using the File Explorer (the file browser) :</p><ul><li>Use Notepad to open chainparams.go</li><li>Change the line that says: var activeNetParams = bitcoinTestNetParams to var activeNetParams = bitcoinMainNetParams</li><li>Somewhere in the file, add:</li></ul><pre>var bitcoinMainNetParams = bitcoinNetParams{ Params: &amp;bitcoinCfg.MainNetParams, rpcPort: “8334”, }</pre><ul><li>Save and close</li></ul><p>Back in the Command Prompt window we left open, type (don’t copy) this command:</p><pre>go install . ./cmd/...</pre><h3>Step 5: Run LND and Lightning-CLI (bitcoind sync should be complete first)</h3><p>Google “what’s my IP” and replace X.X.X.X below with the IP address you’re given in the command below. Additionally, you may need to forward port 9735 (the lighting port) to your local IP (using the command “ipconfig” to determine your local IP) if you want other nodes to be able to call your node. The process varies by router manufacturer, but there are guides available online by searching “how to port forward”.</p><p>As always, you can either run this directly or create a .bat file with Notepad and save it somewhere for easy starting in the future.</p><pre>“%GOPATH%\bin\lnd.exe” --bitcoin.active --debuglevel=debug --bitcoin.node=bitcoind --bitcoind.rpcuser=INSERT_USERNAME --bitcoind.rpcpass=INSERT_PASSWORD --externalip=X.X.X.X --bitcoind.zmqpath=tcp://127.0.0.1:18501 --bitcoind.rpchost=localhost:8332</pre><p>The LND node will now start, but tell you that the Bitcoin wallet is locked. To unlock it, we need to use the Lightning CLI in another Command Prompt window:</p><pre>“%GOPATH%\bin\lncli.exe” unlock</pre><p>It will prompt you for your previously created VERYSECUREPASSWORD, and will then unlock your wallet, allowing LND to continue.</p><p>Note: Some have reported the need to use the ln-cli.exe <em>create</em> command if the unlock command alone doesn’t work.</p><p>LND will now begin syncing to the Bitcoin blockchain. In the mean time, we will set up Zap-Desktop and deposit BTC in our wallet.</p><h3>Step 6: Zap-Desktop and Depositing BTC</h3><p>Open a new Command Prompt window and run these commands:</p><p>Install MSBuild tools for Yarn:</p><pre>npm install --global --production windows-build-tools<br>yarn config set msvs_version 2015 --global</pre><p>Get Zap Repo:</p><pre>git clone <a href="https://github.com/LN-Zap/zap-desktop.git">https://github.com/LN-Zap/zap-desktop.git</a></pre><p>Navigate to repo directory:</p><pre>cd zap-desktop</pre><p>Install Dependencies with Yarn:</p><pre>yarn</pre><p>Install More Dependencies with NPM:</p><pre>npm run install-grpc</pre><p>Finally, use NPM to start a Zap-Desktop instance:</p><pre>npm run dev</pre><p>Ta da! You should now see a screen either detailing the syncing process, or your main wallet page. While it syncs, you can use the address Zap gives you to deposit mainnet BTC (the address should start with the number 3, indicating that it is SegWit enabled)</p><h3>Step 7: Connecting to the Lightning Network</h3><p>Once LND finishes syncing and once the Bitcoin you deposited has been confirmed (mined in a block) you can open your first channels to the Lightning Network.</p><ul><li>In Zap, navigate to the Contacts tab</li><li>In the upper left corner, click the Add button</li><li>On the bottom of the dialog box, paste this address (you will be connecting to my node):</li></ul><p>02829de2d8762ac70f6a243c7e210e1a41d7bc9fe909d09f120b7f0b0252c83858@lightning.zaptremworld.com:9735</p><ul><li>On the bottom, a text box says “Use <strong>0.3</strong> BTC Per Contract”</li><li>Edit the number to the value of BTC you want to place into this Lightning channel (e.g., 0.003 for ~$30 of BTC)</li><li>Add the node/channel (the fee is automatically determined and usually only takes an hour or two).</li></ul><p>Now, LND will begin downloading the layout of the entire network (first from the node listed above, and later other nodes it finds). In a few hours, the transaction that opens the channel will be mined and you will be free to send payments to any other node over the Mainnet Lightning Network! Simply click the “Pay” button and paste a Lightning Invoice created by the person/site you want to interact with.</p><h3>Things To Do</h3><p>Once you have a working channel or two, you can start using some of the interesting services available on LN:</p><ul><li><a href="https://mainnet.yalls.org/">Yalls</a> — LN Payment-Powered Articles (Try flipping me a virtual penny by unlocking this same article over there or adding an emote! <a href="https://mainnet.yalls.org/articles/97d67df1-d721-417d-a6c0-11d793739be9:0965AC5E-56CD-4870-9041-E69616660E6F/20d2188b-a62e-49ea-bff1-304d8e237aab">Link</a>)</li><li><a href="http://zigzag.bitlum.io/">ZigZag </a>— LN Powered CryptoCurrency Exchange</li><li><a href="https://lightning.bitrefill.com/usa/">BitRefill</a> — Buy Gift Cards, Pay Phone Bills, and More (<a href="https://en.bitrefill.com/usa/">alt link</a>)</li><li><a href="https://store.blockstream.com/">Lightning Stickers </a>— LN Powered Store Selling Blockstream Merch</li><li><a href="https://torguard.net/">TorGuard</a> — VPN Services, Paid For Anonymously With LN!</li></ul><p>Questions? Comments? Curses? <a href="https://twitter.com/zaptrem">https://twitter.com/zaptrem</a></p><h3>Creating an LND Node With a Light Client</h3><p>Coming as soon as the Neutrino BIP is accepted!</p><h3>Starting LND+bitcoind+Zap-Desktop automatically on login:</h3><p>Coming soon!</p><h3>Closing a Lightning Channel:</h3><p>Coming soon!</p><h3>Updating LND and Zap-Desktop:</h3><p>Coming soon!</p><h3>Enabling Autopilot:</h3><p>Coming soon!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f73cf78dd633" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>