<?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 Jemimah Nagasha on Medium]]></title>
        <description><![CDATA[Stories by Jemimah Nagasha on Medium]]></description>
        <link>https://medium.com/@nagasha?source=rss-b6e1b9e9e191------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5Et_vqgyFsNaM4b0gjcCGw.jpeg</url>
            <title>Stories by Jemimah Nagasha on Medium</title>
            <link>https://medium.com/@nagasha?source=rss-b6e1b9e9e191------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 08 Apr 2026 12:36:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nagasha/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[Understanding Output Script Descriptors in Bitcoin]]></title>
            <link>https://medium.com/@nagasha/understanding-output-script-descriptors-in-bitcoin-8af8f20e0008?source=rss-b6e1b9e9e191------2</link>
            <guid isPermaLink="false">https://medium.com/p/8af8f20e0008</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[bitcoin]]></category>
            <dc:creator><![CDATA[Jemimah Nagasha]]></dc:creator>
            <pubDate>Fri, 03 May 2024 13:56:42 GMT</pubDate>
            <atom:updated>2024-05-03T13:56:42.030Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/579/1*OPTQq0cbCdP5JcIrfUBezQ.jpeg" /><figcaption><a href="https://www.globalbrandsmagazine.com/a-technical-overview-of-bitcoins-miniscript-descriptors/">Source</a></figcaption></figure><p>Output descriptors are simple, human-readable strings that fully describe a set of Bitcoin addresses. Descriptors offer a user-friendly approach to managing scriptPubKey, the script that controls how a Bitcoin output can be spent. They contain all the information needed to “solve” (spend) the associated script. This format was proposed to improve upon the existing methods of address generation, which often lacked consistency and required additional information to reproduce accurately.</p><p>Descriptors are visible with several commands such as listunspent and getaddressinfo For instance;</p><pre>$ bitcoin-cli getaddressinfo youraddress<br>{<br>  &quot;address&quot;: &quot;str&quot;,<br>  &quot;scriptPubKey&quot;: &quot;hex&quot;,<br>  &quot;ismine&quot;: true|false,<br>  &quot;solvable&quot;: true|false,<br>  &quot;desc&quot;: &quot;str&quot;,<br>  &quot;iswatchonly&quot;: true|false,<br>  &quot;isscript&quot;: true|false,<br>  &quot;iswitness&quot;: true|false,<br>  &quot;pubkey&quot;: &quot;hex&quot;,<br>  &quot;iscompressed&quot;: true|false,<br>  &quot;ischange&quot;: true|false,<br>  &quot;timestamp&quot;: xxx, // numeric<br>  &quot;hdkeypath&quot;: &quot;str&quot;,<br>  &quot;hdseedid&quot;: &quot;hex&quot;,<br>  &quot;hdmasterfingerprint&quot;: &quot;hex&quot;,<br>  &quot;labels&quot;: [<br>    &quot;str&quot;<br>  ]<br>}</pre><p>The &quot;desc&quot; field shows the descriptor of an address.</p><p>Example of an output descriptor:</p><pre>pkh([d34db33f/44&#39;/0&#39;/0&#39;]03efdee34c0009fd175f3b20b5e5a5517fd5d16746f2e635b44617adafeaebc388)#4ahsl9pk</pre><p>A descriptor is broken into several parts as seen below;</p><pre>function([derivation-path]key)#checksum</pre><p><strong>Function: </strong>This is the function that is used to create an address from a given key. In this case, we have pkh, which is the standard P2PKH legacy address. Similarly, a P2PK address would use pk and a P2WPKH address would use wpkh.</p><p><strong>Derivation Path: </strong>This describes the specific component being exported from an HD wallet. In our example above, it’s a seed with a fingerprint d34db33f followed by the 0th child of the 0th child of the 44th child (44&#39;/0&#39;/0&#39;) of that seed.</p><p>It’s important to highlight that while derivation paths typically include a fingerprint, you can make it up if it&#39;s not provided. However, maintaining consistency with an existing fingerprint is crucial, as it ensures compatibility when returning to the device that generated it.</p><p><strong>Key:</strong> This refers to the essential data being transferred, which could be a single key or a set of keys. These keys might take various forms, such as an extended public or private key, a public key associated with an address, or a collection of addresses for a multi-signature setup. Regardless of the specific type, these keys serve as the foundational information for the transfer, while the function outlines how to utilize them.</p><p><strong>Checksum: </strong>Descriptors are supposed to be human-transferrable. Attaching a checksum to descriptors protects against typos or copy-paste errors. Every RPC (Remote Procedure Call) in Bitcoin Core will include the checksum in its output. However, only specific RPCs, like deriveaddresses and importmultirequire checksums on input. In cases where a descriptor lacks a checksum, you can compute it using the getdescriptorinfo RPC.</p><h3>Usage</h3><p>Output descriptors are used in several key areas of Bitcoin wallet management:</p><ul><li>Address Generation: Wallets use descriptors to generate addresses according to the specified script and derivation rules.</li><li>Wallet Import and Export: Descriptors can be used to export wallet information and import it into another wallet software without loss of fidelity.</li><li>Backup: By backing up a descriptor along with seed phrases, users ensure they can recover not only their keys but also the exact wallet structure and script information.</li></ul><h3><strong>Resources</strong></h3><ul><li><a href="https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md">bitcoin/doc/descriptors.md at master · bitcoin/bitcoin</a></li><li><a href="https://bitcoin.stackexchange.com/questions/99540/what-are-output-descriptors">What are output descriptors?</a></li><li><a href="https://developer.bitcoin.org/reference/rpc/index.html">RPC API Reference - Bitcoin</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8af8f20e0008" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Taproot Assets]]></title>
            <link>https://medium.com/@nagasha/understanding-taproot-assets-cef6804df27c?source=rss-b6e1b9e9e191------2</link>
            <guid isPermaLink="false">https://medium.com/p/cef6804df27c</guid>
            <category><![CDATA[taproot]]></category>
            <category><![CDATA[taproot-assets-protocol]]></category>
            <category><![CDATA[bitcoin]]></category>
            <dc:creator><![CDATA[Jemimah Nagasha]]></dc:creator>
            <pubDate>Thu, 11 Apr 2024 08:05:42 GMT</pubDate>
            <atom:updated>2024-04-11T08:05:42.777Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ITHFp7a24KG7pneVnQ3YlQ.png" /><figcaption>Source: <a href="https://tokeninsight.com/en/research/daily-digest/taproot-asset-bringing-stablecoins-back-to-the-bitcoin-network-crypto-daily-digest-oct.19">token insight</a></figcaption></figure><p>Imagine Bitcoin being able to hold more than just, well, Bitcoin. That’s the potential unlocked by Taproot Assets, a novel protocol that leverages the power of Taproot, a <a href="https://medium.com/@nagasha/unlocking-the-potential-of-taproot-a-revolutionary-upgrade-to-bitcoin-transactions-a4abdf273ba0">recent upgrade to the Bitcoin network</a>.</p><h3>What is Taproot Assets?</h3><p>Taproot Assets is a Taproot-powered protocol for issuing digital assets on bitcoin that can be transferred over the Lightning Network for instant, high-volume, low-fee transactions. Unlike traditional Bitcoin transactions, which are relatively straightforward and transparent, Taproot enables complex smart contracts while enhancing privacy and efficiency. This advancement allows for the issuance and tranfer of various types of digital assets, including stablecoins (cryptocurrencies pegged to a stable asset like the US dollar), tokens, non-fungible tokens (NFTs), and decentralized finance (DeFi) instruments, among others.</p><h3>Taproot Assets on Lightning Network</h3><p>Taproot Assets is essentially an on-chain protocol. Assets are issued on the bitcoin blockchain using taproot transactions. However these assets can be transfered to the Lightning Network by depositing them into Lightning Network payment channels. This allows for instant transactions without bloating the bitcoin blockchain itself.</p><p>The core data about the assets is stored off-chain, while only a cryptographic fingerprint is placed on the blockchain. This keeps transaction fees low and speeds high.</p><p>As a Lightning Network user, you now have the option to maintain a wallet balance in a currency other than Bitcoin, such as a stablecoin. With this capability, you can receive payments in your preferred currency and utilize your stablecoin balance to conduct transactions for goods and services across the Lightning Network.</p><p>Bitcoin remains the backbone of the network. It handles the routing of payments, even those made with stablecoins. This clever integration allows for the smooth transmission of transactions over the existing Bitcoin Lightning Network infrastructure, eliminating the necessity for upgrades or additional opt-in procedures.</p><h3>Why are Taproot Assets Important?</h3><p>Taproot Assets has the potential to significantly expand the capabilities of the Bitcoin network. Here are some reasons why:</p><ul><li><strong>Multi-Asset Functionality:</strong> Bitcoin can now potentially function like a platform for various digital assets, not just bitcoin itself.</li><li><strong>Lightning Network Integration:</strong> Taproot Assets can be seamlessly integrated with the Lightning Network, enabling fast, low-cost asset transfers.</li><li><strong>Scalability:</strong> By keeping most data off-chain, Taproot Assets avoids congesting the Bitcoin blockchain.</li></ul><h3>Still in its Early Stages</h3><p>It’s important to remember that Taproot Assets is a relatively new technology. While it holds immense promise, there are still aspects to be ironed out. For instance, regulatory frameworks around digital assets are still evolving, posing potential risks for projects built on Taproot.</p><h3>Conclusion</h3><p>Taproot Assets represent a significant step forward in the evolution of Bitcoin. One of the key features of Taproot Assets is its ability to leverage the security and stability of the bitcoin network and the speed, scalability, and low fees of Lightning. By enabling a multi-asset future, it has the potential to unlock new use cases and expand Bitcoin’s reach. As the technology matures, it will be interesting to see how it shapes the future of the cryptocurrency landscape.</p><h3>Resources</h3><p><a href="https://docs.lightning.engineering/the-lightning-network/taproot-assets">Taproot Assets | Builder&#39;s Guide</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cef6804df27c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlocking the Potential of Taproot: A Revolutionary Upgrade to Bitcoin Transactions]]></title>
            <link>https://medium.com/@nagasha/unlocking-the-potential-of-taproot-a-revolutionary-upgrade-to-bitcoin-transactions-a4abdf273ba0?source=rss-b6e1b9e9e191------2</link>
            <guid isPermaLink="false">https://medium.com/p/a4abdf273ba0</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[taproot]]></category>
            <category><![CDATA[bitcoin]]></category>
            <dc:creator><![CDATA[Jemimah Nagasha]]></dc:creator>
            <pubDate>Mon, 18 Mar 2024 21:22:05 GMT</pubDate>
            <atom:updated>2024-03-18T21:22:05.775Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*_POxVotdjhhuCLFqXkhbBQ.png" /><figcaption>Source: <a href="https://whentaproot.org/#intro">https://whentaproot.org/</a></figcaption></figure><p>Bitcoin’s Taproot upgrade, activated in November 2021, marked a significant enhancement to the Bitcoin network. But what exactly is Taproot, and how does it impact Bitcoin transactions?</p><p>At its core, Taproot is a bundle of three advancements rolled into one. These advancements, known as Bitcoin Improvement Proposals (BIPs), work together to enhance Bitcoin’s efficiency, privacy, and functionality. Let’s delve into each BIP:</p><h3><strong>BIP 340 (Schnorr Signatures):</strong></h3><p>This BIP introduces the Schnorr signatures scheme, a cryptographic signature scheme that offers improvements in efficiency, security, and privacy compared to the traditional ECDSA (Elliptic Curve Digital Signature Algorithm) used in Bitcoin. The adoption of Schnorr signatures is a key component of the Taproot upgrade in Bitcoin, providing several benefits to the network.</p><p>The primary advantage of Schnorr signatures is that when multiple people sign a transaction, it looks just like a regular single-signature transaction on the network. Instead of revealing each person’s signature and public key separately, multiple signers produce a joint public key and then jointly sign with one signature, saving space on the blockchain. This not only makes transactions more private but also reduces the amount of data to be processed, especially beneficial as more people participate in a transaction. This reduces transaction size and verification time, leading to faster and cheaper transactions. This is a significant scalability and privacy enhancement.</p><h3><strong>BIP 341 (Taproot):</strong></h3><p>This BIP revamps Bitcoin’s scripting language, enabling more complex transactions like multi-signature spending and advanced smart contracts. Additionally, Taproot hides the complexity of these transactions, making them appear indistinguishable from regular transactions on the blockchain. This is achieved through <strong>Merklized Abstract Syntax Trees (MAST).</strong></p><p>Imagine that you want to spend bitcoins from a P2SH address, you will need to produce the redeem script with the same hash value and include it in the transaction. This can make the transaction size very large if very many conditions are involved in this script. MAST provides a solution for this.</p><p>Merklized Abstract Syntax Trees are a combination of Merkle Trees and Abstract Syntax Trees. Just like Pay To Script Hash (P2SH) pays to a script matching the hash, MAST pays to the Merkle root’s hash.</p><p>With MAST, a hash tree of individual conditions that are part of a large condition set is created. A Merkle root is a single hash created by hashing all the conditions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*_5G14a8ZupN-nXqvezpxMQ.png" /><figcaption><a href="https://coincodecap.com/bitcoin-taproot#h-mast-merklized-abstract-syntax-trees">Merklized Abstract Syntax Tree (MAST) Illustration</a></figcaption></figure><p>The illustration above shows four sets of spending conditions that are first hashed individually. Two hashes are then generated from those two pairs, which are again combined to create the final hash. This is called the Merkle root.</p><p>When unlocking unspent bitcoin, you need to generate a script that satisfies any branch of a Merkle tree. The Merkle root alone is sufficient to verify if the conditions match the original set. If the blockchain identifies that the script’s conditions are a part of this Merkle tree, it recognizes the coins that were locked using this script and proceeds to unlock them.</p><p>Therefore, you don’t have to create and include the entire script in the transaction, which reduces its size. This efficiency is achieved through Merklized Abstract Syntax Trees, as the Merkle root acts as a concise proof of inclusion, streamlining the verification process and enhancing the overall efficiency of Bitcoin transactions.</p><h3><strong>BIP 342 (Tapscript):</strong></h3><p>BIP 342 provides a more flexible scripting language, <strong>Tapscript</strong>, that builds upon BIP 341. Tapscript paves the way for future innovations on the Bitcoin network by simplifying the integration of new features.</p><h3><strong>The Impact of Taproot</strong></h3><p>Taproot’s three-pronged approach offers a multitude of benefits for Bitcoin users and the network as a whole:</p><ul><li><strong>Increased Efficiency:</strong> Transactions become smaller and faster to verify, thanks to Schnorr Signatures. This translates to lower transaction fees and a more scalable network.</li><li><strong>Enhanced Privacy:</strong> By concealing the intricacies of complex transactions, Taproot makes it harder to analyze spending patterns on the blockchain, leading to greater user privacy.</li><li><strong>Expanded Functionality:</strong> Taproot opens doors for more sophisticated smart contracts on the Bitcoin network, potentially enabling new use cases in the future.</li></ul><h3>The Adoption of Taproot</h3><p>To fully unlock the benefits of Taproot, wallet interoperability is essential. To achieve this, Taproot requires the ability to support a new address format, Bech32m. According to <a href="https://whentaproot.org/#support">whentaproot</a>, an open-source project tracking Bech32m adoption in Bitcoin software, the majority of Bitcoin projects now support Bech32m.</p><h3><strong>Conclusion</strong></h3><p>Taproot represents a significant milestone in the evolution of Bitcoin, unlocking new possibilities for smart contracts, privacy, and scalability. With its improved efficiency and flexibility, Taproot paves the way for a more robust and versatile Bitcoin network in the years to come.</p><p>Resources:</p><ul><li><a href="https://blog.bitmex.com/the-schnorr-signature-taproot-softfork-proposal/">The Schnorr Signature &amp; Taproot Softfork Proposal</a></li><li><a href="https://coincodecap.com/bitcoin-taproot#h-mast-merklized-abstract-syntax-trees">Bitcoin Taproot -  A Technical Explanation 2024 - CoinCodeCap</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a4abdf273ba0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Build and Broadcast A Bitcoin Transaction Using BitcoinJS (bitcoinjs-lib) on Testnet]]></title>
            <link>https://medium.com/@nagasha/how-to-build-and-broadcast-a-bitcoin-transaction-using-bitcoinjs-bitcoinjs-lib-on-testnet-2d9c8ac725d6?source=rss-b6e1b9e9e191------2</link>
            <guid isPermaLink="false">https://medium.com/p/2d9c8ac725d6</guid>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[blockchain-development]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Jemimah Nagasha]]></dc:creator>
            <pubDate>Thu, 29 Feb 2024 07:00:22 GMT</pubDate>
            <atom:updated>2024-02-29T08:09:00.063Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*vmVa9OwTJ_Ci0168ATJAOw.png" /><figcaption>bitcoinjs-lib</figcaption></figure><p>Creating bitcoin transactions can feel like a daunting task. However, the <a href="https://github.com/bitcoinjs/bitcoinjs-lib">bitcoin-js library</a> stands out as an exceptional Node.js library designed for a variety of Bitcoin operations including building transactions. This open-source library empowers developers to interact with the Bitcoin blockchain through JavaScript/Typescript, making it a versatile tool for creating and manipulating transactions programmatically. In this guide, we’ll explore the process of building a simple transaction using this popular JavaScript library.</p><blockquote><strong>Important:</strong> <strong>This guide operates on the Testnet bitcoin network. This means that any coins and transactions carried out during this process hold no real-world value.</strong></blockquote><h3><strong>Prerequisites</strong></h3><ol><li>NodeJS</li><li>A Bitcoin Core Node configured to run on testnet</li></ol><h3>Create an Unspent Transaction Output ( UTXO) to spend</h3><p>A UTXO refers to the output of a transaction that has not been spent or used in a subsequent transaction. Creating a transaction in Bitcoin means that you are spending a previous transaction. To create a UTXO on Testnet, you need to <a href="https://medium.com/@bitcoindeezy/bitcoin-basics-programming-with-bitcoinjs-lib-4a69218c0431">create a wallet</a>, address and send testnet funds to that address using a <a href="https://bitcoinfaucet.uo1.net/">faucet</a></p><p>After creating this UTXO, store the following information in a secure .env file</p><pre>privateKeyWIF = &#39;your_private_key_in_wallet_import_format&#39;<br>previousTxid = &#39;transaction_id&#39;<br>previousHex =&#39;transaction_hex&#39;</pre><h3>Create and Broadcast A Simple Transaction</h3><ol><li><strong>Setting Up Your Environment:</strong><br>Start by installing bitcoinjs-lib in your project. You can use npm (Node Package Manager) for this:</li></ol><pre>npm install bitcoinjs-lib</pre><p>In order to manage SECP256k1 keypairs, you also need to install the ecpair and tiny-secp256k1 modules.</p><p>ECPair stands for Elliptic Curve Pair. In Bitcoin, it&#39;s commonly used to represent an ECDSA (Elliptic Curve Digital Signature Algorithm) key pair. This library provides methods for creating, importing, and manipulating elliptic curve key pairs, which are essential for cryptographic operations such as digital signatures and public-key encryption.</p><p>tiny-secp256k1 is a lightweight library used by BitcoinJS for low-level elliptic curve operations, specifically on the secp256k1 curve. This includes key pair generation, signature generation and verification, public key recovery and others.</p><p>To install these libraries in your project, use the node package manager commands below.</p><pre>npm install ecpair<br><br>npm install tiny-secp256k1</pre><p><strong>2. Import the libraries to your project:</strong></p><pre>const bitcoin = require(&#39;bitcoinjs-lib&#39;)<br>const ECPairFactory = require(&#39;ecpair&#39;).default;<br>const ecc = require(&#39;tiny-secp256k1&#39;);</pre><p><strong>3. Set the network and ECPair:</strong></p><pre>const ECPair = ECPairFactory(ecc);<br>const network = bitcoin.networks.testnet</pre><p><strong>4. Create a transaction</strong></p><pre>// create a simple transaction<br>async function createTransaction(<br>privateKeyWIF, <br>previousTxid, <br>receiverAddress, <br>previousHex<br>) {<br><br>//  take the WIF-encoded private key (privateKeyWIF) and network information <br>// and create a keyPair that we&#39;ll use for signing the transaction<br>    const keyPair = ECPair.fromWIF(privateKeyWIF, network);<br><br>// create a transaction builder and pass the network. The bitcoin-js <br>// Psbt class is used to do this. <br>    const txb = new bitcoin.Psbt({ network });<br>    <br>// while these are default version and locktime values, you can set <br>// custom values depending on your transaction<br>    txb.setVersion(2);<br>    txb.setLocktime(0);<br><br>// add inputs: previous transaction Id, output index of the funding transaction<br>// and, since this is a non segwit input, we must also pass the full previous <br>// transaction hex as a buffer <br>    txb.addInput({<br>        hash: previousTxid,<br>        index: 0,<br>        nonWitnessUtxo: Buffer.from(previousHex, &#39;hex&#39;),<br>    });<br><br>// add outputs as the buffer of receiver&#39;s address and the value with amount<br>// of satoshis you&#39;re sending.<br>    txb.addOutput({<br>        script: Buffer.from(receiverAddress, &#39;hex&#39;),<br>        value: 20000,<br>    }); // Sending 0.0002 BTC<br><br>// sign with the generate keyPair and finalize the transansction <br>    txb.signInput(0, keyPair);<br>    txb.finalizeAllInputs();<br><br>//  extract the transaction and get the raw hex serialization<br>    const tx = txb.extractTransaction();<br>    return tx.toHex();<br>}<br><br>// this calls and executes the function above and then prints <br>// the transaction hex<br>createTransaction(privateKeyWIF, previousTxid, previousHex, myAddress)<br>    .then((transactionHex) =&gt; {<br>        console.log(&#39;Transaction Hex:&#39;, transactionHex);<br>    })<br>    .catch((error) =&gt; {<br>        console.error(&#39;Error:&#39;, error.message);<br>    });</pre><p>Your transaction is now ready to be broadcasted to the Bitcoin network!</p><p><strong>5. Broadcast a transaction</strong></p><p>Broadcasting a transaction refers to the process of propagating a signed transaction to the network so that it can be included in the next block by miners. Broadcasting is essential for making a transaction visible to the decentralized network of nodes, allowing miners to verify and include it in the blockchain.</p><p>To broadcast a transaction on the Bitcoin Testnet, we will use the bitcoin-clicommand-line tool, which is part of the Bitcoin Core software. Ensure that your Bitcoin Core node is configured to run on the Testnet and that it’s fully synced with the Testnet blockchain.</p><p>With your bitcoin core node running, open your terminal and run the following command;</p><pre>bitcoin-cli -testnet sendrawtransaction &lt;transactionHex&gt;</pre><p>The <em>transactionHex</em> used above is what we obtained from step 4 of creating a transaction. If the transaction is successfully broadcasted, the command will return a transaction ID (TxID). You can also check the status of your transaction using various blockchain explorers for the Testnet.</p><p>Broadcasting a transaction is a essential part of the decentralized nature of the Bitcoin network, ensuring that all participants have visibility into the transactions occurring on the network and facilitating the creation of a consensus-driven, immutable ledger.</p><h3>Conclusion</h3><p>Building a transaction using bitcoinjs-lib provides a hands-on experience in understanding the intricacies of bitcoin transactions. As you explore further and experiment with different inputs, outputs, and transaction structures, you’ll discover the power and flexibility that this library offers.</p><h3>Resources:</h3><ul><li><a href="https://github.com/bitcoinjs/bitcoinjs-lib">GitHub - bitcoinjs/bitcoinjs-lib: A javascript Bitcoin library for node.js and browsers.</a></li><li><a href="https://bitcoinjs-guide.bitcoin-studio.com/bitcoinjs-guide/v5/part-two-pay-to-public-key-hash/p2pkh/p2pkh_simple_1_1#_creating_utxo_to_spend">Bitcoin Programming with BitcoinJS, Bitcoin Core and LND</a></li><li><a href="https://medium.com/@idogwuchi/building-your-own-encrypted-wallet-a-developers-guide-to-playing-in-the-mud-61cde41ceed9">Building Your Own Encrypted Wallet: A Developer’s guide to playing in the mud.</a></li><li><a href="https://medium.com/@bitcoindeezy/bitcoin-basics-programming-with-bitcoinjs-lib-4a69218c0431">Bitcoin Basics: Programming with bitcoinjs-lib</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2d9c8ac725d6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting Up a Bitcoin/Lightning Network Sandbox with Polar on Linux]]></title>
            <link>https://medium.com/@nagasha/setting-up-a-bitcoin-lightning-network-sandbox-with-polar-on-linux-9bf8ef2f1d5a?source=rss-b6e1b9e9e191------2</link>
            <guid isPermaLink="false">https://medium.com/p/9bf8ef2f1d5a</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[polar]]></category>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[lightning-network]]></category>
            <dc:creator><![CDATA[Jemimah Nagasha]]></dc:creator>
            <pubDate>Tue, 06 Feb 2024 07:29:17 GMT</pubDate>
            <atom:updated>2024-02-06T07:41:10.927Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Polar website" src="https://cdn-images-1.medium.com/max/1024/1*BPMAfFIjwUWt9uwdSJBJ2A.png" /><figcaption>Polar website</figcaption></figure><p>The <a href="https://lightning.network/">Bitcoin Lightning Network</a> is a second-layer scaling solution built on top of the Bitcoin blockchain. It is designed to enable faster and cheaper transactions. Developing and testing Lightning Network applications can be challenging, but tools like <a href="https://lightningpolar.com/">Polar</a> can simplify the process by providing a user-friendly environment. This article will guide you through the process of setting up a Bitcoin Lightning development environment on Regtest using Polar.</p><p><strong>Prerequisites</strong></p><ol><li>Docker Server (Installation guide <a href="https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04">here</a>)</li><li>Docker Compose (Installation guide <a href="https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-20-04">here</a>)</li></ol><p><strong>Installing Polar</strong></p><p>Polar is a tool developed by Lightning Labs to create and manage Lightning Network nodes for development and testing purposes. To install Polar on Linux, follow these steps:</p><p>Download the Polar application package from <a href="https://lightningpolar.com/">here</a>.</p><p>Because the Polar application is an AppImage package, we will also install the AppImageLauncher to ease the installation of our Polar package.</p><pre>sudo add-apt-repository ppa:appimagelauncher-team/stable<br>sudo apt-get update<br>sudo apt-get install appimagelauncher</pre><p>When the above is complete, double-click the <em>“.AppImage ” </em>package you just downloaded and that will launch your polar application.</p><p><strong>Setting Up Lightning Nodes</strong></p><p>When you run Polar, the following welcome screen will appear.</p><figure><img alt="Polar welcome screen" src="https://cdn-images-1.medium.com/max/1024/0*yEMyhq1A6v5KeC7Z" /><figcaption>Polar welcome screen</figcaption></figure><p>Click either the orange “Create a Lightning Network” button in the middle, or Create Network in the top right corner.</p><figure><img alt="Create a LIghtning Network" src="https://cdn-images-1.medium.com/max/1024/1*LMaeMMMAT06VQhmw55xaSw.png" /><figcaption>Create a Lightning Network</figcaption></figure><p>After clicking Create Network, the above screen will appear. You can specify how many of each node implementations your network will be composed of. For this guide, create a new Lightning Network with the following parameters:</p><pre>Network Name = My Network<br>Number of Managed Nodes:<br>LND = 2<br>Core Lightning = 0<br>Eclair = 0<br>Bitcoin Core = 1</pre><p><strong>Note:</strong> You will always need at least one Bitcoin Core node!</p><p>After clicking the orange Create Network button, Polar will display this new screen.</p><figure><img alt="New Network" src="https://cdn-images-1.medium.com/max/1024/1*XhEckN8LanRoJpA043aKiA.png" /><figcaption>New Network</figcaption></figure><p>Polar allows you to play with any version for any implementation, including those in beta by providing the Network Designer Tab on the far right in the above screenshot. You can add a node of any version by dragging and dropping it onto the canvas to add it to the network you created.</p><p>Initiate your local network by clicking the Start button located in the top right corner, highlighted in orange. Allow a few seconds for the nodes to initialize; you’ll know the process is complete when the indicator lights turn green. After this, select the “Alice” LND node to access the screen tabs below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/385/1*ji-tJTMJ6T3IrX2JzmP2-g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/385/1*aTjBhEUctDINHLb3mA1g5g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/385/1*TmiOFTTcMzE03hBnPDFuew.png" /><figcaption>Overview of the Info, Connect, and Actions tabs available for each node selected</figcaption></figure><p>The details on this screen are mostly straightforward. Currently, the local regtest instance is only at Block Height = 1, resulting in both Alice’s Confirmed Balance and Unconfirmed Balance being 0 sats. To change this, navigate to the Actions tab for Alice, confirm that Deposit Funds is configured to 1,000,000 sats, and then click on Deposit.</p><p>Starting with 1,000,000 sats in test environments like our local regtest instance provides a reasonable amount of satoshis for testing various Bitcoin functionalities without needing to worry about small fractions constantly. It offers enough satoshis to facilitate transactions, create different spending scenarios, and observe their effects.</p><p><strong>Polar’s Mining Simulation</strong></p><p>To mine more blocks, click the backend1 node, in the actions tab. A mine button will be visible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kSzBmpNSKg1HTABm4NuitQ.png" /><figcaption>Mining blocks in Polar</figcaption></figure><p>While Polar’s mining simulation might appear similar to real-world mining, it’s not generating real Bitcoin on the main Bitcoin network. Polar creates a regtest environment, which is a separate, simulated network for testing purposes. Regtest coins have no real-world value and cannot be transferred to the main Bitcoin network.</p><p><strong>Create and Pay an Invoice</strong></p><p>Having funded Alice’s on-chain wallet, the next step is to open a channel. Click on “Open Channel” -&gt; “Outgoing,” choose Bob as the destination, keep the default Capacity at 250,000 sats, and then click the orange “Open Channel” button.</p><p>After successfully opening the channel, select the new green line connecting Alice and Bob’s LND nodes to view the channel details below.</p><figure><img alt="Channel Details" src="https://cdn-images-1.medium.com/max/1024/1*GX2GTL3EzTAQGvTW4Z1ReQ.png" /><figcaption>Channel Details</figcaption></figure><p>Hover over the green dot on Alice’s node to reveal “Source,” and over the blue dot on Bob’s node to display “Destination.” This indicates that the side with a Source Balance of 246,530 sats is Alice’s, while the side with a Destination Balance of 0 sats belongs to Bob.</p><p>Since Bob currently has no Destination Balance, right-click on his node to open an Actions panel. Choose “Create Invoice,” accept the default Amount of 50,000 sats, and click the orange “Create Invoice” button. If done successfully, this action should generate the following screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MjkryY5FD9wdbQxR6oM-YA.png" /><figcaption>Create Invoice</figcaption></figure><p>Select “Copy &amp; Close,” then right-click on Alice’s node and choose “Pay Invoice.” Paste the invoice copied into the Bolt 11 Invoice field and click the orange “Pay Invoice” button. Upon completion, the dashboards for Alice, Bob, and the channel will resemble the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/387/1*c2R4M1zUOF_t7tIRurRK1Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/387/1*4FNrAMlXD0ZirkrUzY0NOg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/387/1*2nhNP7EM-UU84uLbilrWCw.png" /><figcaption>Overview of the Info tabs for the Alice, Bob, and bitcoin core nodes after Invoice Payment</figcaption></figure><p>Congratulations! You’ve made your first successful Lightning Network payment on regtest!</p><blockquote>You may have noticed a “Launch” button below Terminal in the Actions tab of the different nodes. You can run also cli commands directly on each node you created by launching its terminal.</blockquote><p>Polar makes setting up a Bitcoin-Lightning development environment on regtest a breeze. Its intuitive interface and powerful features provide a valuable sandbox for developers to test their applications and gain practical experience working with the Lightning Network.</p><p>I hope this article serves as a helpful guide for setting up your Bitcoin-Lightning development environment with Polar. Feel free to explore the additional resources and documentation available within the Lightning ecosystem to further your knowledge and development efforts.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9bf8ef2f1d5a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>