<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>nagasha&apos;s blog</title><description>Bitcoin, Lightning, and open source, written in Kampala.</description><link>https://nagasha.dev/</link><item><title>How Curiosity Led Me from Civil Engineering to Bitcoin Open Source Contribution</title><link>https://nagasha.dev/blog/civil-engineering-to-bitcoin/</link><guid isPermaLink="true">https://nagasha.dev/blog/civil-engineering-to-bitcoin/</guid><pubDate>Fri, 22 May 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;If you had told me a few years ago that I would leave my civil engineering job to work full-time in Bitcoin open source, I probably would have smiled politely and gone back to reviewing construction drawings.&lt;/p&gt;
&lt;p&gt;At the time, my life followed a fairly structured path. I was a civil engineer managing public infrastructure and maintenance projects. But on the side, I had started exploring technology.&lt;/p&gt;
&lt;p&gt;I picked up frontend development as a side hustle, partly because I wanted more flexibility, and partly because I enjoyed building things that people could actually use and interact with.&lt;/p&gt;
&lt;p&gt;But even then, something felt incomplete. I wasn’t just interested in writing code. I wanted to understand systems, how they work, how they scale, how they fail, and most importantly, how they can give people more freedom and control. That curiosity is what eventually led me to Bitcoin.&lt;/p&gt;
&lt;h2 id=&quot;the-first-spark&quot;&gt;The First Spark&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#the-first-spark&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;My real entry point into Bitcoin was a conversation. A friend invited me to the very first BitDevs Kampala event. I didn’t fully know what to expect, but I decided to show up anyway.&lt;/p&gt;
&lt;p&gt;That room changed everything for me. For the first time, I saw Bitcoin not as speculation, hype, or headlines, but as a technical system. A system that people were actively building, questioning, improving, and defending.&lt;/p&gt;
&lt;p&gt;Even more importantly, I met people who deeply cared about the idea of freedom money and permissionless systems. There was something powerful about being in a room with people who were not just talking about Bitcoin, but working to understand it and contribute to it.&lt;/p&gt;
&lt;p&gt;At that same event, I heard about the &lt;a href=&quot;https://www.btrust.tech/builders/apply&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Btrust Builders Program&lt;/a&gt; from an alumnus, &lt;a href=&quot;https://www.btrust.tech/builders/profile/2&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Rukundo&lt;/a&gt;. He described it as a structured, rigorous, and community-driven pathway into Bitcoin open-source development.&lt;/p&gt;
&lt;p&gt;It sounded exactly like the kind of opportunity I had been looking for so I applied.&lt;/p&gt;
&lt;h2 id=&quot;the-btrust-builders-program&quot;&gt;The Btrust Builders Program&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#the-btrust-builders-program&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When I got accepted into Btrust Builders, I was so excited. The first six weeks focused on &lt;a href=&quot;https://pathways.btrust.tech/01/mastering-bitcoin&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;understanding the foundations of Bitcoin&lt;/a&gt;: how it works, why it exists, and the principles behind it. We learned about Bitcoin as a monetary system, a technical system, and a tool for individual freedom.&lt;/p&gt;
&lt;p&gt;This phase was highly engaging, especially because of the weekly collaborative calls with other participants. We shared what we were learning, asked questions, and worked through difficult concepts together.&lt;/p&gt;
&lt;p&gt;During that time, I began to understand Bitcoin’s broader mission more clearly. It is not just about technology for technology’s sake. It is about addressing real problems in traditional money systems and giving people more control over their financial lives. Coming from a context where financial systems do not always work in people’s favour, that idea felt very real to me.&lt;/p&gt;
&lt;p&gt;After the initial phase, I was accepted into the &lt;a href=&quot;https://www.mariblock.com/stories/btrust-builders-kicks-off-inaugural-fellowship-for-bitcoin-developers-in-africa&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Btrust Builders Fellowship&lt;/a&gt;, where we went much deeper into the technical side of Bitcoin.&lt;/p&gt;
&lt;p&gt;We wrote programs to decode transactions, created Lightning channels, worked on group projects to build Bitcoin applications, and also explored existing Bitcoin open-source projects and the problems they were trying to solve. It was intense, demanding, and exactly the kind of structure my curiosity had been missing.&lt;/p&gt;
&lt;p&gt;The fellowship also changed the way I approached learning. I became more comfortable with not knowing everything right away. I learned how to read code I didn’t fully understand yet. I learned how to ask better questions. And slowly, I gained both the technical foundation and the confidence to start contributing to open source.&lt;/p&gt;
&lt;h2 id=&quot;from-learning-to-contributing&quot;&gt;From Learning to Contributing&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#from-learning-to-contributing&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Because of the fellowship, I started contributing to &lt;a href=&quot;https://github.com/jamaljsr/polar&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Polar&lt;/a&gt;, a tool that makes it easier for developers to run Bitcoin and Lightning nodes locally. It was the perfect entry point for me because it’s practical, useful, and directly connected to improving the developer experience.&lt;/p&gt;
&lt;p&gt;My first pull request was a huge learning experience. It was exciting, but also humbling. I had to read the codebase, understand the contribution process, ask questions, make changes, and respond to feedback. But each contribution made the next one a little easier.&lt;/p&gt;
&lt;p&gt;Over time, the codebase started to feel less foreign. It became something I could understand, work with, and eventually help shape.&lt;/p&gt;
&lt;p&gt;Around the same time, I became more involved in the local Bitcoin community. What started as attending &lt;a href=&quot;https://x.com/BitDevsKLA&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;BitDevs Kampala&lt;/a&gt; slowly turned into helping organise it, and eventually leading it in 2025.&lt;/p&gt;
&lt;p&gt;I also joined the Btrust Builders faculty, where I got the chance to share what I had learned with future cohorts. That experience meant a lot to me because it felt like I was passing the knowledge forward and helping create the same kind of supportive path that had helped me.&lt;/p&gt;
&lt;p&gt;Through all of this, I met like-minded people, learned from their experiences, and realised that I was not alone in this journey.&lt;/p&gt;
&lt;p&gt;Building a space where developers could learn together, whether they were completely new or already experienced, reinforced something I now believe deeply: Education and open source are closely connected. In many ways, they are part of the same work.&lt;/p&gt;
&lt;h2 id=&quot;the-btrust-starter-grant&quot;&gt;The Btrust Starter Grant&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#the-btrust-starter-grant&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;All of this was happening while I was still working full-time as a civil engineer. Balancing both worlds was one of the hardest things I have done. There were lots of late nights, early mornings, and weekends spent writing code after long workdays. I loved what I was learning and building, but it was not easy to keep both paths going at the same time.&lt;/p&gt;
&lt;p&gt;Then I applied for the &lt;a href=&quot;https://www.btrust.tech/grants/developer&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Btrust Starter Grant&lt;/a&gt; to work on Polar, and in April 2026, I was awarded the grant. That moment meant a lot to me because it gave me the opportunity to transition into full-time Bitcoin open-source development. I no longer had to squeeze contributions into evenings and weekends, nor wait until after work hours to focus on the thing I cared about deeply. I could finally give it my full attention.&lt;/p&gt;
&lt;h2 id=&quot;building-the-future-i-care-about&quot;&gt;Building the Future I Care About&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#building-the-future-i-care-about&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Today, I work full-time on Bitcoin open source, focusing on improving the developer experience, making it easier for others to build, test, and experiment with Bitcoin and the Lightning Network.&lt;/p&gt;
&lt;p&gt;This journey wasn’t linear, nor was it planned. It was a series of small decisions: showing up to one event, applying to one program, making one contribution, and saying yes to one opportunity. Each step built on the last, but none of them felt obvious or inevitable at the time.&lt;/p&gt;
&lt;p&gt;This journey has given me more than technical skills. It has given me a community, a sense of purpose, and the chance to build tools that make Bitcoin more accessible.&lt;/p&gt;
&lt;p&gt;I hope sharing my story motivates more people, especially those who, like me, didn’t start in traditional computer science paths. You don’t need to have it all figured out. What you need is curiosity, consistency, and a willingness to learn.&lt;/p&gt;
&lt;p&gt;Bitcoin has room for people from many backgrounds, each bringing their own skills and perspective. That is part of what makes it stronger and more resilient.&lt;/p&gt;</content:encoded></item><item><title>How To Build and Broadcast A Bitcoin Transaction Using BitcoinJS (bitcoinjs-lib) on Testnet</title><link>https://nagasha.dev/blog/how-to-build-and-broadcast-a-bitcoin-transaction-using-bitcoinjs-bitcoinjs-lib-on-testnet/</link><guid isPermaLink="true">https://nagasha.dev/blog/how-to-build-and-broadcast-a-bitcoin-transaction-using-bitcoinjs-bitcoinjs-lib-on-testnet/</guid><pubDate>Thu, 29 Feb 2024 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/max/200/1*vmVa9OwTJ_Ci0168ATJAOw.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;bitcoinjs-lib&lt;/p&gt;
&lt;p&gt;Creating bitcoin transactions can feel like a daunting task. However, the &lt;a href=&quot;https://github.com/bitcoinjs/bitcoinjs-lib&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;bitcoin-js library&lt;/a&gt; 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.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt; &lt;strong&gt;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.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3 id=&quot;prerequisites&quot;&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#prerequisites&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;NodeJS&lt;/li&gt;
&lt;li&gt;A Bitcoin Core Node configured to run on testnet&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;create-an-unspent-transaction-output--utxo-tospend&quot;&gt;Create an Unspent Transaction Output ( UTXO) to spend&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#create-an-unspent-transaction-output--utxo-tospend&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;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 &lt;a href=&quot;https://medium.com/@bitcoindeezy/bitcoin-basics-programming-with-bitcoinjs-lib-4a69218c0431&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;create a wallet&lt;/a&gt;, address and send testnet funds to that address using a &lt;a href=&quot;https://bitcoinfaucet.uo1.net/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;faucet&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;After creating this UTXO, store the following information in a secure .env file&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;background-color:#fff;--shiki-dark-bg:#24292e;color:#24292e;--shiki-dark:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;privateKeyWIF = &apos;your_private_key_in_wallet_import_format&apos;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;previousTxid = &apos;transaction_id&apos;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;previousHex =&apos;transaction_hex&apos;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;create-and-broadcast-a-simple-transaction&quot;&gt;Create and Broadcast A Simple Transaction&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#create-and-broadcast-a-simple-transaction&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Setting Up Your Environment:&lt;/strong&gt;&lt;br&gt;
Start by installing bitcoinjs-lib in your project. You can use npm (Node Package Manager) for this:&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;background-color:#fff;--shiki-dark-bg:#24292e;color:#24292e;--shiki-dark:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;npm install bitcoinjs-lib&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In order to manage SECP256k1 keypairs, you also need to install the ecpair and tiny-secp256k1 modules.&lt;/p&gt;
&lt;p&gt;ECPair stands for Elliptic Curve Pair. In Bitcoin, it’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.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;To install these libraries in your project, use the node package manager commands below.&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;background-color:#fff;--shiki-dark-bg:#24292e;color:#24292e;--shiki-dark:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;npm install ecpair&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;npm install tiny-secp256k1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;2. Import the libraries to your project:&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;background-color:#fff;--shiki-dark-bg:#24292e;color:#24292e;--shiki-dark:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;const bitcoin = require(&apos;bitcoinjs-lib&apos;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;const ECPairFactory = require(&apos;ecpair&apos;).default;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;const ecc = require(&apos;tiny-secp256k1&apos;);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;3. Set the network and ECPair:&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;background-color:#fff;--shiki-dark-bg:#24292e;color:#24292e;--shiki-dark:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;const ECPair = ECPairFactory(ecc);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;const network = bitcoin.networks.testnet&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;4. Create a transaction&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;background-color:#fff;--shiki-dark-bg:#24292e;color:#24292e;--shiki-dark:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;// create a simple transaction&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;async function createTransaction(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;privateKeyWIF, &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;previousTxid, &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;receiverAddress, &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;previousHex&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;//  take the WIF-encoded private key (privateKeyWIF) and network information &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;// and create a keyPair that we&apos;ll use for signing the transaction&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    const keyPair = ECPair.fromWIF(privateKeyWIF, network);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;// create a transaction builder and pass the network. The bitcoin-js &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;// Psbt class is used to do this. &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    const txb = new bitcoin.Psbt({ network });&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;// while these are default version and locktime values, you can set &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;// custom values depending on your transaction&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    txb.setVersion(2);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    txb.setLocktime(0);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;// add inputs: previous transaction Id, output index of the funding transaction&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;// and, since this is a non segwit input, we must also pass the full previous &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;// transaction hex as a buffer &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    txb.addInput({&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;        hash: previousTxid,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;        index: 0,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;        nonWitnessUtxo: Buffer.from(previousHex, &apos;hex&apos;),&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    });&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;// add outputs as the buffer of receiver&apos;s address and the value with amount&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;// of satoshis you&apos;re sending.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    txb.addOutput({&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;        script: Buffer.from(receiverAddress, &apos;hex&apos;),&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;        value: 20000,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    }); // Sending 0.0002 BTC&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;// sign with the generate keyPair and finalize the transansction &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    txb.signInput(0, keyPair);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    txb.finalizeAllInputs();&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;//  extract the transaction and get the raw hex serialization&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    const tx = txb.extractTransaction();&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    return tx.toHex();&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;// this calls and executes the function above and then prints &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;// the transaction hex&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;createTransaction(privateKeyWIF, previousTxid, previousHex, myAddress)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    .then((transactionHex) =&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;        console.log(&apos;Transaction Hex:&apos;, transactionHex);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    })&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    .catch((error) =&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;        console.error(&apos;Error:&apos;, error.message);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    });&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Your transaction is now ready to be broadcasted to the Bitcoin network!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;5. Broadcast a transaction&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;With your bitcoin core node running, open your terminal and run the following command;&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;background-color:#fff;--shiki-dark-bg:#24292e;color:#24292e;--shiki-dark:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;bitcoin-cli -testnet sendrawtransaction &amp;#x3C;transactionHex&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;em&gt;transactionHex&lt;/em&gt; 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.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#conclusion&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;h3 id=&quot;resources&quot;&gt;Resources:&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#resources&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/bitcoinjs/bitcoinjs-lib&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;GitHub - bitcoinjs/bitcoinjs-lib: A javascript Bitcoin library for node.js and browsers.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;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&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Bitcoin Programming with BitcoinJS, Bitcoin Core and LND&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://medium.com/@idogwuchi/building-your-own-encrypted-wallet-a-developers-guide-to-playing-in-the-mud-61cde41ceed9&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Building Your Own Encrypted Wallet: A Developer’s guide to playing in the mud.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://medium.com/@bitcoindeezy/bitcoin-basics-programming-with-bitcoinjs-lib-4a69218c0431&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Bitcoin Basics: Programming with bitcoinjs-lib&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content:encoded></item><item><title>Open Source Contributions — How I Started Contributing To Open Source</title><link>https://nagasha.dev/blog/open-source-contributions-how-i-started-contributing-to-open-source/</link><guid isPermaLink="true">https://nagasha.dev/blog/open-source-contributions-how-i-started-contributing-to-open-source/</guid><pubDate>Mon, 31 Oct 2022 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;You’ve probably heard about the open source community by now. You might have even tried your hand at contributing to a project. But how did you get started? Should you just jump on a project and start contributing? I’m going to share with you my experiences in starting out, what worked for me, and what I’ve learned so far.&lt;/p&gt;
&lt;h2 id=&quot;starting-out&quot;&gt;Starting Out&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#starting-out&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;For any tech newbie, contributing to open source projects can seem a daunting fit to accomplish. I chose to start my journey with the &lt;a href=&quot;https://hacktoberfest.com/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Hacktoberfest&lt;/a&gt; 2022 challenge.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Hacktoberfest is a month-long celebration run by DigitalOcean to celebrate and give back to open source projects and software. The initiative is open to everyone, and the goal is to encourage everyone in our global community to contribute to open source.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;During hacktoberfest, maintainers from all around the world tag issues as “hacktoberfest” and “good-first-issue”. Most of the issues are beginner friendly, especially for first time contributors. This was a good time for me to start out because of the worldwide support for contributors.&lt;/p&gt;
&lt;h2 id=&quot;first-pr---hydrogen-social-media-web-app&quot;&gt;First PR - Hydrogen &lt;em&gt;(Social media web app)&lt;/em&gt;&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#first-pr---hydrogen-social-media-web-app&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I found a &lt;a href=&quot;https://github.com/harshmangalam/hydrogen-solidjs-client#hydrogen---social-media-web-app-powered-by-solidjs&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;project&lt;/a&gt; to contribute to through the hacktoberfest discord channel. Whenever I am starting something new, I always want to start with something familiar and easy to get a feel of how things are done before diving into the deep end. This project provided a great starting point for me.
Hydrogen is a social media web app powered by SolidJS. My first &lt;a href=&quot;https://github.com/harshmangalam/hydrogen-solidjs-client/pull/34#event-7502173932&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;issue&lt;/a&gt; was the simplest; adding a delete account tab in the settings section of the web app. The maintainer was very responsive and helpful. Even though this contribution was tiny, having it merged gave me an immense confidence boost.&lt;/p&gt;
&lt;h2 id=&quot;more-prs&quot;&gt;More PRs&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#more-prs&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I had planned to make a total of 4 contributions for the month of October (one for every week). I decided to tackle other issues within the same project, now that I was familiar with the codebase. The other 3 &lt;a href=&quot;https://github.com/harshmangalam/hydrogen-solidjs-client/issues/29#event-7547971991&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;issues&lt;/a&gt; I worked on revolved around fixing accessibility issues for various pages. I learned a lot about accessibility and using the lighthouse tool to make checks and improvements. I’ll be sharing more about making accessible web pages as I learn. I hope you stick around for that 😉&lt;/p&gt;
&lt;h2 id=&quot;lessons&quot;&gt;Lessons&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#lessons&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Hacktoberfest 🎃 has come to an end and I am so glad for choosing to participate. And even though getting swag was not my intention, I managed to qualify for it 🤣 yey! Anyway, here are a few take aways;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Start small. All contributions matter.&lt;/li&gt;
&lt;li&gt;There is always someone in the community willing to help. Don’t be scared to ask.&lt;/li&gt;
&lt;li&gt;Always aim to make meaningful contributions to the projects you commit to.&lt;/li&gt;
&lt;li&gt;Most importantly, before you make that PR, Read the contribution guide.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Thank you for reading this far!😀 Contributing to open source projects and software does not end with Hacktoberfest. Find a &lt;a href=&quot;https://goodfirstissue.dev/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;good first issue&lt;/a&gt; and give back to the world through your contributions.
May the merge be with you 🚀🚀🚀&lt;/p&gt;</content:encoded></item><item><title>Setting Up a Bitcoin/Lightning Network Sandbox with Polar on Linux</title><link>https://nagasha.dev/blog/setting-up-a-bitcoin-lightning-network-sandbox-with-polar-on-linux/</link><guid isPermaLink="true">https://nagasha.dev/blog/setting-up-a-bitcoin-lightning-network-sandbox-with-polar-on-linux/</guid><pubDate>Tue, 06 Feb 2024 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/max/1024/1*BPMAfFIjwUWt9uwdSJBJ2A.png&quot; alt=&quot;Polar website&quot;&gt;&lt;/p&gt;
&lt;p&gt;Polar website&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://lightning.network/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Bitcoin Lightning Network&lt;/a&gt; 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 &lt;a href=&quot;https://lightningpolar.com/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Polar&lt;/a&gt; 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.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Docker Server (Installation guide &lt;a href=&quot;https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Docker Compose (Installation guide &lt;a href=&quot;https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-20-04&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Installing Polar&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;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:&lt;/p&gt;
&lt;p&gt;Download the Polar application package from &lt;a href=&quot;https://lightningpolar.com/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Because the Polar application is an AppImage package, we will also install the AppImageLauncher to ease the installation of our Polar package.&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;background-color:#fff;--shiki-dark-bg:#24292e;color:#24292e;--shiki-dark:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;sudo add-apt-repository ppa:appimagelauncher-team/stable&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;sudo apt-get update&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;sudo apt-get install appimagelauncher&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When the above is complete, double-click the &lt;em&gt;“.AppImage ”&lt;/em&gt; package you just downloaded and that will launch your polar application.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Setting Up Lightning Nodes&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;When you run Polar, the following welcome screen will appear.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/max/1024/0*yEMyhq1A6v5KeC7Z&quot; alt=&quot;Polar welcome screen&quot;&gt;&lt;/p&gt;
&lt;p&gt;Polar welcome screen&lt;/p&gt;
&lt;p&gt;Click either the orange “Create a Lightning Network” button in the middle, or Create Network in the top right corner.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/max/1024/1*LMaeMMMAT06VQhmw55xaSw.png&quot; alt=&quot;Create a LIghtning Network&quot;&gt;&lt;/p&gt;
&lt;p&gt;Create a Lightning Network&lt;/p&gt;
&lt;p&gt;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:&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;background-color:#fff;--shiki-dark-bg:#24292e;color:#24292e;--shiki-dark:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;Network Name = My Network&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;Number of Managed Nodes:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;LND = 2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;Core Lightning = 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;Eclair = 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;Bitcoin Core = 1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You will always need at least one Bitcoin Core node!&lt;/p&gt;
&lt;p&gt;After clicking the orange Create Network button, Polar will display this new screen.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/max/1024/1*XhEckN8LanRoJpA043aKiA.png&quot; alt=&quot;New Network&quot;&gt;&lt;/p&gt;
&lt;p&gt;New Network&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/max/385/1*ji-tJTMJ6T3IrX2JzmP2-g.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/max/385/1*aTjBhEUctDINHLb3mA1g5g.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/max/385/1*TmiOFTTcMzE03hBnPDFuew.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;Overview of the Info, Connect, and Actions tabs available for each node selected&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Polar’s Mining Simulation&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To mine more blocks, click the backend1 node, in the actions tab. A mine button will be visible.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/max/1024/1*kSzBmpNSKg1HTABm4NuitQ.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;Mining blocks in Polar&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Create and Pay an Invoice&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;After successfully opening the channel, select the new green line connecting Alice and Bob’s LND nodes to view the channel details below.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/max/1024/1*GX2GTL3EzTAQGvTW4Z1ReQ.png&quot; alt=&quot;Channel Details&quot;&gt;&lt;/p&gt;
&lt;p&gt;Channel Details&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/max/1024/1*MjkryY5FD9wdbQxR6oM-YA.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;Create Invoice&lt;/p&gt;
&lt;p&gt;Select “Copy &amp;#x26; 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:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/max/387/1*c2R4M1zUOF_t7tIRurRK1Q.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/max/387/1*4FNrAMlXD0ZirkrUzY0NOg.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/max/387/1*2nhNP7EM-UU84uLbilrWCw.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;Overview of the Info tabs for the Alice, Bob, and bitcoin core nodes after Invoice Payment&lt;/p&gt;
&lt;p&gt;Congratulations! You’ve made your first successful Lightning Network payment on regtest!&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;</content:encoded></item><item><title>Understanding Output Script Descriptors in Bitcoin</title><link>https://nagasha.dev/blog/understanding-output-script-descriptors-in-bitcoin/</link><guid isPermaLink="true">https://nagasha.dev/blog/understanding-output-script-descriptors-in-bitcoin/</guid><pubDate>Fri, 03 May 2024 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/max/579/1*OPTQq0cbCdP5JcIrfUBezQ.jpeg&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.globalbrandsmagazine.com/a-technical-overview-of-bitcoins-miniscript-descriptors/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Source&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;Descriptors are visible with several commands such as listunspent and getaddressinfo For instance;&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;background-color:#fff;--shiki-dark-bg:#24292e;color:#24292e;--shiki-dark:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;$ bitcoin-cli getaddressinfo youraddress&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;address&quot;: &quot;str&quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;scriptPubKey&quot;: &quot;hex&quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;ismine&quot;: true|false,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;solvable&quot;: true|false,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;desc&quot;: &quot;str&quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;iswatchonly&quot;: true|false,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;isscript&quot;: true|false,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;iswitness&quot;: true|false,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;pubkey&quot;: &quot;hex&quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;iscompressed&quot;: true|false,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;ischange&quot;: true|false,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;timestamp&quot;: xxx, // numeric&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;hdkeypath&quot;: &quot;str&quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;hdseedid&quot;: &quot;hex&quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;hdmasterfingerprint&quot;: &quot;hex&quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;labels&quot;: [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    &quot;str&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  ]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The “desc” field shows the descriptor of an address.&lt;/p&gt;
&lt;p&gt;Example of an output descriptor:&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;background-color:#fff;--shiki-dark-bg:#24292e;color:#24292e;--shiki-dark:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;pkh([d34db33f/44&apos;/0&apos;/0&apos;]03efdee34c0009fd175f3b20b5e5a5517fd5d16746f2e635b44617adafeaebc388)#4ahsl9pk&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A descriptor is broken into several parts as seen below;&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;background-color:#fff;--shiki-dark-bg:#24292e;color:#24292e;--shiki-dark:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;function([derivation-path]key)#checksum&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Function:&lt;/strong&gt; 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.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Derivation Path:&lt;/strong&gt; 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’/0’/0’) of that seed.&lt;/p&gt;
&lt;p&gt;It’s important to highlight that while derivation paths typically include a fingerprint, you can make it up if it’s not provided. However, maintaining consistency with an existing fingerprint is crucial, as it ensures compatibility when returning to the device that generated it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Key:&lt;/strong&gt; 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.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Checksum:&lt;/strong&gt; 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.&lt;/p&gt;
&lt;h3 id=&quot;usage&quot;&gt;Usage&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#usage&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Output descriptors are used in several key areas of Bitcoin wallet management:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Address Generation: Wallets use descriptors to generate addresses according to the specified script and derivation rules.&lt;/li&gt;
&lt;li&gt;Wallet Import and Export: Descriptors can be used to export wallet information and import it into another wallet software without loss of fidelity.&lt;/li&gt;
&lt;li&gt;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.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;resources&quot;&gt;&lt;strong&gt;Resources&lt;/strong&gt;&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#resources&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;bitcoin/doc/descriptors.md at master · bitcoin/bitcoin&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://bitcoin.stackexchange.com/questions/99540/what-are-output-descriptors&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;What are output descriptors?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.bitcoin.org/reference/rpc/index.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;RPC API Reference - Bitcoin&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content:encoded></item><item><title>Understanding Taproot Assets</title><link>https://nagasha.dev/blog/understanding-taproot-assets/</link><guid isPermaLink="true">https://nagasha.dev/blog/understanding-taproot-assets/</guid><pubDate>Thu, 11 Apr 2024 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/max/1024/1*ITHFp7a24KG7pneVnQ3YlQ.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;Source: &lt;a href=&quot;https://tokeninsight.com/en/research/daily-digest/taproot-asset-bringing-stablecoins-back-to-the-bitcoin-network-crypto-daily-digest-oct.19&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;token insight&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;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 &lt;a href=&quot;https://medium.com/@nagasha/unlocking-the-potential-of-taproot-a-revolutionary-upgrade-to-bitcoin-transactions-a4abdf273ba0&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;recent upgrade to the Bitcoin network&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;what-is-taprootassets&quot;&gt;What is Taproot Assets?&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#what-is-taprootassets&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;h3 id=&quot;taproot-assets-on-lightning-network&quot;&gt;Taproot Assets on Lightning Network&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#taproot-assets-on-lightning-network&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;h3 id=&quot;why-are-taproot-assets-important&quot;&gt;Why are Taproot Assets Important?&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#why-are-taproot-assets-important&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Taproot Assets has the potential to significantly expand the capabilities of the Bitcoin network. Here are some reasons why:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Multi-Asset Functionality:&lt;/strong&gt; Bitcoin can now potentially function like a platform for various digital assets, not just bitcoin itself.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Lightning Network Integration:&lt;/strong&gt; Taproot Assets can be seamlessly integrated with the Lightning Network, enabling fast, low-cost asset transfers.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Scalability:&lt;/strong&gt; By keeping most data off-chain, Taproot Assets avoids congesting the Bitcoin blockchain.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;still-in-its-earlystages&quot;&gt;Still in its Early Stages&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#still-in-its-earlystages&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#conclusion&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;h3 id=&quot;resources&quot;&gt;Resources&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#resources&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://docs.lightning.engineering/the-lightning-network/taproot-assets&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Taproot Assets | Builder’s Guide&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title>Unlocking the Potential of Taproot: A Revolutionary Upgrade to Bitcoin Transactions</title><link>https://nagasha.dev/blog/unlocking-the-potential-of-taproot-a-revolutionary-upgrade-to-bitcoin-transactions/</link><guid isPermaLink="true">https://nagasha.dev/blog/unlocking-the-potential-of-taproot-a-revolutionary-upgrade-to-bitcoin-transactions/</guid><pubDate>Mon, 18 Mar 2024 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/max/1000/1*_POxVotdjhhuCLFqXkhbBQ.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;Source: &lt;a href=&quot;https://whentaproot.org/#intro&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;https://whentaproot.org/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;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?&lt;/p&gt;
&lt;p&gt;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:&lt;/p&gt;
&lt;h3 id=&quot;bip-340-schnorr-signatures&quot;&gt;&lt;strong&gt;BIP 340 (Schnorr Signatures):&lt;/strong&gt;&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#bip-340-schnorr-signatures&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;h3 id=&quot;bip-341-taproot&quot;&gt;&lt;strong&gt;BIP 341 (Taproot):&lt;/strong&gt;&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#bip-341-taproot&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;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 &lt;strong&gt;Merklized Abstract Syntax Trees (MAST).&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/max/726/1*_5G14a8ZupN-nXqvezpxMQ.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://coincodecap.com/bitcoin-taproot#h-mast-merklized-abstract-syntax-trees&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Merklized Abstract Syntax Tree (MAST) Illustration&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;h3 id=&quot;bip-342-tapscript&quot;&gt;&lt;strong&gt;BIP 342 (Tapscript):&lt;/strong&gt;&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#bip-342-tapscript&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;BIP 342 provides a more flexible scripting language, &lt;strong&gt;Tapscript&lt;/strong&gt;, that builds upon BIP 341. Tapscript paves the way for future innovations on the Bitcoin network by simplifying the integration of new features.&lt;/p&gt;
&lt;h3 id=&quot;the-impact-oftaproot&quot;&gt;&lt;strong&gt;The Impact of Taproot&lt;/strong&gt;&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#the-impact-oftaproot&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Taproot’s three-pronged approach offers a multitude of benefits for Bitcoin users and the network as a whole:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Increased Efficiency:&lt;/strong&gt; Transactions become smaller and faster to verify, thanks to Schnorr Signatures. This translates to lower transaction fees and a more scalable network.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Enhanced Privacy:&lt;/strong&gt; By concealing the intricacies of complex transactions, Taproot makes it harder to analyze spending patterns on the blockchain, leading to greater user privacy.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Expanded Functionality:&lt;/strong&gt; Taproot opens doors for more sophisticated smart contracts on the Bitcoin network, potentially enabling new use cases in the future.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;the-adoption-oftaproot&quot;&gt;The Adoption of Taproot&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#the-adoption-oftaproot&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;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 &lt;a href=&quot;https://whentaproot.org/#support&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;whentaproot&lt;/a&gt;, an open-source project tracking Bech32m adoption in Bitcoin software, the majority of Bitcoin projects now support Bech32m.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#conclusion&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;Resources:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://blog.bitmex.com/the-schnorr-signature-taproot-softfork-proposal/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;The Schnorr Signature &amp;#x26; Taproot Softfork Proposal&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://coincodecap.com/bitcoin-taproot#h-mast-merklized-abstract-syntax-trees&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Bitcoin Taproot -  A Technical Explanation 2024 - CoinCodeCap&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content:encoded></item><item><title>Using Polar’s MCP to Build a Lightning Testing Environment with AI</title><link>https://nagasha.dev/blog/using-polars-mcp-to-build-a-lightning-testing-environment-with-ai/</link><guid isPermaLink="true">https://nagasha.dev/blog/using-polars-mcp-to-build-a-lightning-testing-environment-with-ai/</guid><pubDate>Sat, 24 Oct 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/max/1024/0*HZNzOtbUlqbW6ESr&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Image credit:&lt;/em&gt; &lt;a href=&quot;https://popularaitools.ai/blog/model-context-protocol-guide-2026&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;&lt;em&gt;PopularAiTools&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;A while back, I wrote about &lt;a href=&quot;/blog/setting-up-a-bitcoin-lightning-network-sandbox-with-polar-on-linux&quot;&gt;setting up a Lightning sandbox with Polar on Linux&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;That guide walked through creating a network, starting nodes, funding them, opening channels, mining blocks, and configuring an application to connect to those nodes.&lt;/p&gt;
&lt;p&gt;It works, but if you’re developing a Lightning application, you end up repeating those steps every time you need a fresh testing environment.&lt;/p&gt;
&lt;p&gt;Recently, I started exploring Polar’s MCP server, which lets AI agents interact with Polar through tools. Instead of manually configuring a network, I can describe what I need and let an agent carry out the setup.&lt;/p&gt;
&lt;p&gt;In this guide, I’ll show you how to connect an AI agent to Polar, create a local Lightning network using prompts, and test a payment. You don’t need to build your own agent or write automation scripts to get started. You simply need a working Polar installation and an MCP-compatible client.&lt;/p&gt;
&lt;h3 id=&quot;what-is-mcp-and-how-does-polar-useit&quot;&gt;What is MCP, and how does Polar use it?&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#what-is-mcp-and-how-does-polar-useit&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://modelcontextprotocol.io/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;MCP (Model Context Protocol)&lt;/a&gt; is a standard that allows AI applications to connect to external tools and services.&lt;/p&gt;
&lt;p&gt;An AI agent can understand your request and decide which tools to call, but it needs a way to interact with your local development environment. MCP provides a standard interface for discovering and using those tools.&lt;/p&gt;
&lt;p&gt;For example, if you ask an agent to create a Bitcoin regtest network with two Lightning nodes, it can use Polar’s MCP tools to create the network, start the nodes, open a channel, and mine blocks.&lt;/p&gt;
&lt;p&gt;Polar’s MCP setup has three main components:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Your AI agent:&lt;/strong&gt; A client such as Claude, Codex and others. This is where you describe what you want to accomplish.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The Polar MCP server:&lt;/strong&gt; A server that exposes Polar’s functionality as tools the agent can call.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The Polar desktop app:&lt;/strong&gt; The application that manages your local Bitcoin and Lightning networks.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The MCP server communicates with Polar through a local HTTP bridge at &lt;code&gt;localhost:37373&lt;/code&gt;. The server acts as an interface to the functionality provided by the running Polar app.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;One important detail: Polar needs to be open for its MCP tools to work.&lt;/strong&gt; If your agent cannot reach Polar, check that the desktop application is running before investigating anything else.&lt;/p&gt;
&lt;p&gt;The tools cover network management, Bitcoin operations such as mining blocks and funding nodes, Lightning operations such as opening channels and making payments, and Taproot Assets.&lt;/p&gt;
&lt;p&gt;You can find more technical details in &lt;a href=&quot;https://github.com/jamaljsr/polar/blob/master/docs/mcp-architecture.md&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Polar’s MCP architecture documentation&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;setting-up-polarmcp&quot;&gt;Setting up Polar MCP&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#setting-up-polarmcp&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Let’s connect Polar to an AI agent.&lt;/p&gt;
&lt;h4 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#prerequisites&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;You’ll need:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://lightningpolar.com/&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Polar&lt;/a&gt; version 4.0.0 or later.&lt;/li&gt;
&lt;li&gt;Docker and Docker Compose.&lt;/li&gt;
&lt;li&gt;Node.js 20 or later, for running the MCP server via npx.&lt;/li&gt;
&lt;li&gt;An MCP-compatible AI client.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Make sure Docker is running and open the Polar desktop application.&lt;/p&gt;
&lt;h4 id=&quot;1-connect-your-aiagent&quot;&gt;1. Connect your AI agent&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#1-connect-your-aiagent&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;If you’re using Claude Code, run:&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;background-color:#fff;--shiki-dark-bg:#24292e;color:#24292e;--shiki-dark:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;claude mcp add polar -- npx -y @lightningpolar/mcp&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This registers Polar’s MCP server with Claude Code. The npx command runs the package, downloading it if necessary.&lt;/p&gt;
&lt;p&gt;If you’re using Claude Desktop, Cursor, or another client that uses a JSON configuration, the configuration generally looks like this:&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;background-color:#fff;--shiki-dark-bg:#24292e;color:#24292e;--shiki-dark:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;mcpServers&quot;: {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    &quot;polar&quot;: {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;      &quot;command&quot;: &quot;npx&quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;      &quot;args&quot;: [&quot;-y&quot;, &quot;@lightningpolar/mcp&quot;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The location of the configuration file and the exact setup process depend on your client. For client-specific instructions, see the &lt;a href=&quot;https://github.com/jamaljsr/polar-mcp&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Polar MCP repository&lt;/a&gt;.&lt;/p&gt;
&lt;h4 id=&quot;2-check-that-the-connection-works&quot;&gt;2. Check that the connection works&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#2-check-that-the-connection-works&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;With Polar open, use &lt;code&gt;/mcp&lt;/code&gt; in Claude Code to check whether the polar server is connected.&lt;/p&gt;
&lt;p&gt;Then ask the agent:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;List my Polar networks.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The agent should call the &lt;code&gt;list_networks&lt;/code&gt; tool and return the networks already configured in Polar.&lt;/p&gt;
&lt;p&gt;This is a good first test because it verifies that the agent can interact with Polar without creating or modifying anything.&lt;/p&gt;
&lt;p&gt;If it doesn’t work, check that Polar is running, confirm the MCP server is configured correctly, and review your client’s connection status.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/max/782/1*XkBSeEx8I9UQ6WbrqrBA-g.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Claude Code showing the Polar MCP server connected&lt;/em&gt;&lt;/p&gt;
&lt;h3 id=&quot;creating-a-lightning-network-with-aprompt&quot;&gt;Creating a Lightning network with a prompt&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#creating-a-lightning-network-with-aprompt&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Now for the interesting part.&lt;/p&gt;
&lt;p&gt;Suppose we’re developing a Lightning application and need two LND nodes connected through a funded channel.&lt;/p&gt;
&lt;p&gt;Normally, we’d open Polar, create a network, configure the nodes, start the network, and open a channel. With MCP, we can describe the outcome we want instead.&lt;/p&gt;
&lt;p&gt;Try this prompt:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Create a Polar network called my-app-regtest with two LND nodes and a bitcoind node. Start the network, open a 250,000 sat channel from Alice to Bob, and mine enough blocks to confirm the channel.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The agent can translate this request into a sequence of tool calls.&lt;/p&gt;
&lt;p&gt;For example, the network creation request would look something like this:&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;background-color:#fff;--shiki-dark-bg:#24292e;color:#24292e;--shiki-dark:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;name&quot;: &quot;my-app-regtest&quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  &quot;nodes&quot;: [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;      &quot;implementation&quot;: &quot;LND&quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;      &quot;count&quot;: 2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    },&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;      &quot;implementation&quot;: &quot;bitcoind&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;    }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  ]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After creating the network, the agent needs to start it, wait for the nodes to become ready, open the channel, and mine blocks to confirm it.&lt;/p&gt;
&lt;p&gt;The relevant operations include &lt;code&gt;create_network&lt;/code&gt;, &lt;code&gt;start_network&lt;/code&gt;, &lt;code&gt;open_channel&lt;/code&gt;, and &lt;code&gt;mine_blocks&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;You don’t need to know every tool call before getting started. You describe what you want to accomplish, and the agent uses the available tools to work toward that result.&lt;/p&gt;
&lt;p&gt;Polar supports several node implementations, including LND, c-lightning (Core Lightning), eclair, litd, tapd, and bitcoind. The implementations you can use depend on the supported node types and images available in your Polar setup.&lt;/p&gt;
&lt;p&gt;Polar assigns names such as Alice, Bob, and Carol to nodes in sequence. You can refer to these names in subsequent prompts.&lt;/p&gt;
&lt;h3 id=&quot;testing-a-lightning-payment&quot;&gt;Testing a Lightning payment&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#testing-a-lightning-payment&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Once the network is running and the channel is confirmed, let’s test whether payments work.&lt;/p&gt;
&lt;p&gt;Ask the agent:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Create a 5,000 sat invoice on Bob and pay it from Alice. Tell me whether the payment succeeded.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The agent can create an invoice on Bob using &lt;code&gt;create_invoice&lt;/code&gt; and then pass that invoice to &lt;code&gt;pay_invoice&lt;/code&gt; to initiate the payment from Alice.&lt;/p&gt;
&lt;p&gt;This gives us a simple end-to-end test of the local Lightning network without manually switching between nodes or issuing commands ourselves.&lt;/p&gt;
&lt;p&gt;However, the channel needs sufficient usable liquidity for the payment, and the agent needs to check the result rather than simply assume that calling the tool means the payment succeeded.&lt;/p&gt;
&lt;p&gt;That’s one of the useful things about working with an AI agent: you can ask it to carry out a sequence of operations and report the outcome. You should still verify important results, especially when building a test workflow you intend to rely on.&lt;/p&gt;
&lt;h3 id=&quot;connecting-your-application-topolar&quot;&gt;Connecting your application to Polar&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#connecting-your-application-topolar&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Once your network is running, you can use its nodes to test your application. An LND integration, for example, typically needs the node’s REST URL, TLS certificate, and admin macaroon.&lt;/p&gt;
&lt;p&gt;Your local configuration might look like this:&lt;/p&gt;
&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark&quot; style=&quot;background-color:#fff;--shiki-dark-bg:#24292e;color:#24292e;--shiki-dark:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;&quot; tabindex=&quot;0&quot; data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;LND_REST_URL=https://127.0.0.1:8081&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;LND_TLS_CERT_PATH=/path/to/tls.cert&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;LND_ADMIN_MACAROON_HEX=...&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;These are illustrative values; retrieve the actual ports and credentials from your Polar network. Core Lightning, Eclair, and Bitcoin Core have different connection and authentication requirements.&lt;/p&gt;
&lt;p&gt;Keep credentials in a local configuration file such as .env.local, excluded from version control, and avoid exposing secrets in logs or agent output.&lt;/p&gt;
&lt;h3 id=&quot;making-the-workflow-repeatable&quot;&gt;Making the workflow repeatable&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#making-the-workflow-repeatable&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;MCP handles individual tasks, but a reliable development workflow often needs more: reusing a specific network, waiting for nodes to become ready, setting up consistent channel liquidity, and preparing connection details before tests run.&lt;/p&gt;
&lt;p&gt;That’s where a reusable agent skill helps. It encodes the workflow and its constraints so the agent can follow the same process across sessions.&lt;/p&gt;
&lt;p&gt;I built a &lt;code&gt;polar-network&lt;/code&gt; skill for this purpose, with network-ownership safeguards, node-readiness checks, and a helper script. I’ll cover the implementation in a follow-up article.&lt;/p&gt;
&lt;p&gt;Explore the code in the &lt;a href=&quot;https://github.com/Jem256/polar-skills&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;polar-skills repository&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;bringing-ittogether&quot;&gt;Bringing it together&lt;a class=&quot;heading-anchor&quot; aria-hidden=&quot;&quot; tabindex=&quot;-1&quot; href=&quot;#bringing-ittogether&quot;&gt;&lt;span class=&quot;icon icon-link&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Polar’s MCP server makes it possible for an AI agent to create networks, configure channels, and retrieve connection details through natural-language instructions.&lt;/p&gt;
&lt;p&gt;Give it a try and explore how an AI agent can simplify your Lightning development workflow. If you encounter rough edges or have ideas for improving the MCP tools, contribute or report an issue in &lt;a href=&quot;https://github.com/jamaljsr/polar&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Polar’s GitHub repository&lt;/a&gt;.&lt;/p&gt;</content:encoded></item></channel></rss>