<?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 Pavan Joshi on Medium]]></title>
        <description><![CDATA[Stories by Pavan Joshi on Medium]]></description>
        <link>https://medium.com/@yourpavannn?source=rss-c92b29e83c08------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*354K-aTo18xH42gRGRER9Q.jpeg</url>
            <title>Stories by Pavan Joshi on Medium</title>
            <link>https://medium.com/@yourpavannn?source=rss-c92b29e83c08------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 21:30:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yourpavannn/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[Extending transaction metadata spec for commercial use -week13⚡]]></title>
            <link>https://medium.com/@yourpavannn/extending-transaction-metadata-spec-for-commercial-use-week13-4b49b3c1665d?source=rss-c92b29e83c08------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b49b3c1665d</guid>
            <dc:creator><![CDATA[Pavan Joshi]]></dc:creator>
            <pubDate>Wed, 31 Aug 2022 10:54:42 GMT</pubDate>
            <atom:updated>2022-08-31T10:54:42.795Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*gv9ztl4CssEGjUZy.png" /></figure><p>Extend specification by introducing contentURL field for the metadata data models, so that metadata can be used for commercial purposes as well.</p><p>Transaction metadata can be used for describing transactions which don&#39;t give anything in return to the user (eg. donation) or</p><p>For commercial transactions (after the user buys anything, providing bought content in form of metadata)</p><p><strong>Use case division</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/96/1*8PuwZtmcvekPLPqxc2G9PA.gif" /></figure><p>Users can use transaction metadata spec, to give details about the transaction along with commercial purpose i.e give some content to the user after a successful payment</p><ol><li>Metadata just describes the transaction, no confidential information is shared which shall be protected before payment</li></ol><p><em>Solution</em></p><p>a. don’t provide contentUrl in transaction metadata (as contentUrl field is optional)</p><p>Eg. Transactions which are free, and don’t give any content in return eg. donations</p><p>b. Provide contentUrl in transaction metadata (even if it’s not confidential render it after successful payment only)</p><p>2. Metadata is used for digital content buy and sell purpose</p><p><em>Solution</em></p><p>a. Provide contentUrl field in transaction metadata — wallets render after successful payment)</p><p>b. Don’t provide contentUrl field in transaction metadata — the client can do after actions in sendPayment callback function, eg. downloading a song in user local storage after successful payment</p><p><strong>security aspect of keeping contentUrl field optional::</strong></p><p>Any buying selling action is based on trust between lightning application and user. even if we make this field compulsory, there is no guarantee that the string passed in contentUrl field is a valid URL pointing to the digital content.</p><p><strong>features</strong></p><p>1. after actions can be performed by the client in the sendPayment callback function on the client side or they can be performed on the wallet side after successful payment</p><p>2. In form of contentUrl now content can be accessed right inside the wallet, as well as outside the wallet</p><p>3. field is optional, hence it can be used as per requirement for free as well as in commercial transactions which involve buy and sell activities</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b49b3c1665d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Documentation, Demonstration and use cases of transactions metadata spec: Week11-Week12 Report⚡]]></title>
            <link>https://medium.com/@yourpavannn/documentation-demonstration-and-use-cases-of-transactions-metadata-spec-week11-week12-report-97882dae976d?source=rss-c92b29e83c08------2</link>
            <guid isPermaLink="false">https://medium.com/p/97882dae976d</guid>
            <dc:creator><![CDATA[Pavan Joshi]]></dc:creator>
            <pubDate>Wed, 31 Aug 2022 10:41:32 GMT</pubDate>
            <atom:updated>2022-08-31T10:41:32.700Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*73pxFfvptxAJFb_p.png" /></figure><p>In the previous article, we took a deep dive into how we design databases to store metadata, load metadata and perform after actions and interactive things on metadata.</p><p>In this article, we will demonstrate different use-cases of the transaction metadata with example<strong><em>s</em></strong></p><p><strong><em>a. Documenting the whole process of making payments transactions smart with structured metadata</em></strong></p><p>Any specification means nothing without documentation, documentation provides the real essence of the code I focused on and gave a huge amount of time to build this documentation.</p><p>Official documentation of the specification:-</p><p><a href="https://pavan-joshi.gitbook.io/making-payment-transactions-smart/">Documentation Link</a></p><p><strong>Features of the Documentation</strong></p><p>a. Made all the pages error-free,</p><p>b. ensured correctness and accuracy of the sentences and use of punctuations in right place.</p><p>c. used Grammarly AI to detect error, correctness, accuracy, punctuations and sentence constructions. and corrected them manually.</p><p>d. Most of the pages have a rating of confident, friendly and inspirational levels according to Grammarly AI.</p><p>e. Proper demonstration of specification with suitable charts and mentioning each work stepwise in a detailed way</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WNPIPFX9o2gVE8MQ" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QzklrUbBZwYBSEEy" /></figure><p>To know the ratings and accuracy of all the pages of the documentation:- <a href="https://drive.google.com/drive/folders/1gNMuc9kLYVEA3arNaFHwtPFQFclgBoWr?usp=sharing">Click</a></p><p><strong><em>b. Creating Demonstration Examples</em></strong></p><p><strong><em>Prototype 1- Buy Songs</em></strong></p><p><strong>Features::</strong></p><p>a. Demonstrates AudioObject data model type for the structuring of metadata</p><p>b. Demonstrate use case and difference between url, contentUrl and EmbedUrl by creating separate components</p><p>c. Includes dynamic JSON array constructor, which can be used by any client who wishes to implement the specification</p><p>d. Showcase the use of webLN and lnurl-pay packages to generate invoices dynamically and trigger payment dynamically and pass metadata to the wallet</p><p>e. Demonstrate after actions done on wallet side as well as client-side (after actions done in two ways)</p><p><strong><em>Security for After Actions</em></strong></p><p>a. If the action is performed on the client side in Webln.sendPayment() callback function, then, this provides security, as the callback is triggered only after payment is successfully done.</p><p>In the case of an empty invoice, the callback function is accessible when webLN just starts to execute, here the additional field is introduced which allows access to metadata only when the response is not undefined</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/97a939e655e801497b09d068c904ecef/href">https://medium.com/media/97a939e655e801497b09d068c904ecef/href</a></iframe><p>b. If after the action is performed on the wallet side</p><p>the client passes purchased content in the contentUrl field which is a private field and wallets render them only after payment is successful</p><p><strong>Demonstration::</strong></p><p><a href="https://drive.google.com/file/d/1zNAHCWNO-LowUHGGLKxPbiWiaavt_T5G/view?usp=sharing">https://drive.google.com/file/d/1zNAHCWNO-LowUHGGLKxPbiWiaavt_T5G/view?usp=sharing</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jzfLQCOQfyidnLiY" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*a5vW-a_Q5x3nsIlO" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1neAfvkSQM7LKzNs" /></figure><p><strong><em>Prototype 2 — crypto Realtime</em></strong></p><p><strong>Features:</strong></p><p>1. Connected with coinbase API 24/7 using web socket programming</p><p>2. filter currency-pairs mapped with USD</p><p>3. sort in alphabetical order and create datasets for the currency pair</p><p>4. show realtime price and chart for the given selected currency pair</p><p>5. Demonstrate use of Image Object data model type</p><p>6. Integration of WebLN and LNUrl-pay to generate invoices dynamically</p><p>7. includes all the features of the specification as defined in the features section of <a href="https://docs.google.com/document/d/1OcbppA1NHDKhutekk4k1FKgsfRorap-mdCy8iaNhjSw/edit#heading=h.cjout953sm9h">Prototype 1</a></p><p><strong>Video Demonstration:</strong></p><p><a href="https://drive.google.com/file/d/1NlP11kAMcFrs_wiMI2k-pxmGsbALNfR3/view?usp=sharing"><strong>https://drive.google.com/file/d/1NlP11kAMcFrs_wiMI2k-pxmGsbALNfR3/view?usp=sharing</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fnvtN59hrcWkpzt8" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KzvRZNGlEuNrMydE" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-arGlwPc-QXPophz" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8XiMgw5i_SNWPx5d" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97882dae976d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Database design for transaction metadata: Week9-Week10 Report⚡]]></title>
            <link>https://medium.com/@yourpavannn/database-design-for-transaction-metadata-week9-week10-report-10365977e5bc?source=rss-c92b29e83c08------2</link>
            <guid isPermaLink="false">https://medium.com/p/10365977e5bc</guid>
            <dc:creator><![CDATA[Pavan Joshi]]></dc:creator>
            <pubDate>Wed, 31 Aug 2022 09:49:30 GMT</pubDate>
            <atom:updated>2022-08-31T10:51:41.077Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*n-hVbRUgs61BONL0.png" /></figure><p>In the previous article, we took a deep dive into how we can validate the metadata passed by the client using the webln provider and how we can create a rendering mechanism depending on the type reference of the metadata</p><p>In this article, we will look into</p><ul><li>database design to store metadata in Alby wallet</li><li>After actions which can be performed on the metadata <br>1. On the Client Side<br>2. On Wallet Sid<strong><em>e</em></strong></li></ul><p><strong><em>a. database design to store metadata in Alby wallet</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*WTbhc_9Tke8korCiHjlMPQ.gif" /></figure><p><strong><em>Using Indexed DB</em></strong></p><p>IndexedDB is a way for you to persistently store data inside a user’s browser. Because it lets you create web applications with rich query abilities regardless of network availability, your applications can work both online and offline.</p><p><strong><em>Basic pattern</em></strong></p><p>The basic pattern that IndexedDB encourages is the following:</p><ol><li>Open a database.</li><li>Create an object store in the database.</li><li>Start a transaction and make a request to do some database operation, like adding or retrieving data.</li><li>Wait for the operation to complete by listening to the right kind of DOM event.</li><li>Do something with the results (which can be found on the request object).</li></ol><p><strong><em>Using IndexedDB wrapper — Dexie.js</em></strong></p><p>Dexie.js is a wrapper library for indexedDB.</p><p>Dexie.js solves these main issues with the native IndexedDB API:</p><ol><li><a href="https://dexie.org/docs/The-Main-Limitations-of-IndexedDB#ambivalent-error-handling">Ambivalent error handling</a></li><li><a href="https://dexie.org/docs/The-Main-Limitations-of-IndexedDB#poor-queries">Poor queries</a></li><li><a href="https://dexie.org/docs/The-Main-Limitations-of-IndexedDB#not-reactive">Not reactive</a></li><li><a href="https://dexie.org/docs/The-Main-Limitations-of-IndexedDB#code-complexity">Code complexity</a></li></ol><p>Dexie.js solves these limitations and provides a neat database API. Dexie.js aims to be the first-hand choice of an IDB Wrapper Library due to its well-</p><ul><li>thought-through API design,</li><li>robust <a href="https://dexie.org/docs/API-Reference#exception-handling">error handling</a>,</li><li><a href="https://dexie.org/docs/TutorialBuilding-Addons">extendability</a>, <a href="https://dexie.org/docs/Tutorial/Design#change-tracking">change tracking awareness</a></li><li>extended KeyRange support (<a href="https://dexie.org/docs/WhereClause/WhereClause.equalsIgnoreCase()">case insensitive search</a>, <a href="https://dexie.org/docs/WhereClause/WhereClause.anyOf()">set matches</a> and <a href="https://dexie.org/docs/Collection/Collection.or()">or operations</a>).</li></ul><p><strong><em>Publisher-Subscriber patterns — pubsub.js</em></strong></p><p>In simple words, the publisher and subscriber are unaware of each other. All the communication between them is taken through events which are emitted from the publisher and notifies the subscriber. As shown bellow</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/0*fZxhUQhgXPQewaVb.gif" /><figcaption><em>Pubsub pattern source msd blog</em></figcaption></figure><p><strong><em>Publisher-Pattern in Alby</em></strong></p><p>Once the payment is done by the user, we fetch the status of the payment, and publish an event, here we publish <strong><em>ln.sendPayment.success</em></strong> or <strong><em>ln.sendPayment.failed</em></strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/60f5b01ec2decaee0205d1e6c1ff990f/href">https://medium.com/media/60f5b01ec2decaee0205d1e6c1ff990f/href</a></iframe><p><strong><em>Subscriber Pattern in Alby</em></strong></p><p>The subscriber subscribes to the particular event depending on the publisher response it gets:-</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/39b9e2ff42f1c38faab3d538cd0ef50b/href">https://medium.com/media/39b9e2ff42f1c38faab3d538cd0ef50b/href</a></iframe><p>Here we are subscribing to different events such as</p><p>If payment is successful we:-</p><ul><li>Provide payment success notification to the user</li><li>Persist that successful payment in the wallet</li><li>Persist metadata in the storage</li><li>Update information present in the allowance</li></ul><p>If payment is failed we:-</p><ul><li>Provide payment fail notification to the user</li></ul><p><strong><em>b. Storing Metadata in Alby</em></strong></p><p>Before storing metadata we have to consider the following events and preprocess accordingly before storage of metadata.</p><p><strong><em>Different cases covered before storing metadata::</em></strong></p><ol><li>Non-empty invoice valid metadata</li><li>Non-empty invoice invalid metadata</li><li>Non-empty invoice no metadata</li><li>Empty invoice valid metadata</li><li>Empty invoice invalid metadata</li><li>Empty invoice no metadata</li><li>Validate metadata before making payment</li><li>Allow payments to happen only when metadata is valid</li><li>No metadata passed is equivalent to valid metadata</li></ol><p><strong><em>Database Design to fetch and store metadata in Alby</em></strong></p><p>Create a table, function to store data in storage, and function to load data from storage <strong><em>using dexie.js and indexedDB</em></strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e09507f7fcaa8cd79170ee3a7fedc836/href">https://medium.com/media/e09507f7fcaa8cd79170ee3a7fedc836/href</a></iframe><ul><li>Pass metadata along with the status of the payment using publisher.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/60f5b01ec2decaee0205d1e6c1ff990f/href">https://medium.com/media/60f5b01ec2decaee0205d1e6c1ff990f/href</a></iframe><ul><li>Subscribe to the event <strong><em>PerisistMetadata </em></strong>after successful payment to store metadata</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b4bfe5344284b6c19be2f54f5288c15b/href">https://medium.com/media/b4bfe5344284b6c19be2f54f5288c15b/href</a></iframe><p><strong><em>c. Iterating vs Querying over metadata</em></strong></p><p>Metadata contains a larger number of key-value pairs so we need an efficient mechanism to deal with the rendering and querying of metadata.</p><p>To show metadata on screen we render metadata by storing metadata as a JSON object. We iterate over this object and render it on the screens.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/898f9978476170c31b15a345cd0c0a2c/href">https://medium.com/media/898f9978476170c31b15a345cd0c0a2c/href</a></iframe><p>Sometimes we need some information such as “type reference of metadata” instantly! to retrieve a single key-value pair iteration is not efficient and we use a mechanism to query the metadata.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c7058db373305884ac18bfbcd8c3e940/href">https://medium.com/media/c7058db373305884ac18bfbcd8c3e940/href</a></iframe><p><strong><em>d. Performing After-actions and interacting with stored metadata</em></strong></p><p>Once the user confirms their payment and the transaction gets successful, wallets can play with the received metadata, and lightning-driven web apps can do some after actions after receiving the payments.</p><p><strong><em>After-actions performed on the client side</em></strong></p><p>Once the payment is successful, we can allow the user to access the purchased content; after the successful payment, the client application can permit the user to download a song.</p><p>After actions can be performed in the <strong>SendPayment</strong> callback function as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/97a939e655e801497b09d068c904ecef/href">https://medium.com/media/97a939e655e801497b09d068c904ecef/href</a></iframe><p><strong><em>Interaction and after actions by wallets with Stored Metadata</em></strong></p><p>Wallets can store the metadata in their transaction database and render it so that users to interact with the metadata.</p><p>Metadata can be rendered in transaction lists, providing more insights into each transaction to the user, and making it more interactive. Wallets can interact with metadata in different ways to create visual spending breakdowns from the metadata, letting the user spend a digital coupon provided as metadata and many more.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=10365977e5bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bitcoin transaction metadata validation and rendering: Week7-Week8 Report⚡]]></title>
            <link>https://medium.com/@yourpavannn/bitcoin-transaction-metadata-validation-and-rendering-week7-week8-report-61924ea51f24?source=rss-c92b29e83c08------2</link>
            <guid isPermaLink="false">https://medium.com/p/61924ea51f24</guid>
            <dc:creator><![CDATA[Pavan Joshi]]></dc:creator>
            <pubDate>Wed, 31 Aug 2022 06:56:18 GMT</pubDate>
            <atom:updated>2022-08-31T06:56:18.155Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*n-hVbRUgs61BONL0.png" /></figure><p>In the previous article, we took a deep dive into the architecture design to make payment transactions smart with structured metadata.</p><p>The architecture workflow includes basic 5 steps to be followed::</p><p><strong><em>Workflow</em></strong></p><ul><li>Trigger SendPayment method</li><li>Structure and Pass Metadata</li><li>Validate Metadata</li><li>Render Metadata in Confirmation Dialogue</li><li>Store, Interact and Do After Actions</li></ul><p>In this article, we will take a look at how metadata validation works along with the storage and rendering mechanisms for metadata implementable by the different wallets.</p><p><strong><em>a. Metadata Validation</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*3aiyWnOgCoiHusB_0oc4aA.gif" /></figure><p>Metadata is user-generated. Wallets have to confirm their correctness. Before performing any further action on metadata, wallets have to validate metadata.</p><p><strong><em>What is JSON Schema? 🧐</em></strong></p><p>JSON Schema is a JSON media type for defining the structure of the JSON data. JSON Schema provides a contract for what JSON data is required and how to interact with it.</p><p>JSON schemas can be created and used to validate received data against a predefined data model. There are many validator NPM packages available to validate metadata and provide the functionality to:</p><ul><li>Generate Schema</li><li>Compile Schema</li><li>Validate received data for that particular schema</li></ul><p><a href="https://www.npmjs.com/package/zod"><strong><em>Zod</em></strong></a><strong><em> </em></strong>NPM package<strong><em> </em></strong>is one of the validators used to validate JSON and object schema. The best thing about this package is that it has zero external dependencies involved.</p><p>Schema Created using Zod NPM package</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f096a8230af12c86feedb18f63704f89/href">https://medium.com/media/f096a8230af12c86feedb18f63704f89/href</a></iframe><ul><li>Custom and Reusable Validator function to validate metadata</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/80a060057b2e3d21f25549df7af018bb/href">https://medium.com/media/80a060057b2e3d21f25549df7af018bb/href</a></iframe><p>To Validate metadata, call the function by passing metadata.</p><pre>const isMetadataValid = MetadataValidator(metadata);</pre><p><strong><em>b. Render Metadat in confirmation Dialogue</em></strong></p><p>If metadata is successfully validated, we can show the user the amount the user will be paying along with the metadata content.</p><p>Here users can see the purpose of the transaction by looking over the metadata before paying an invoice with a clear idea of everything before making the payment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*AHBMfsIwL7zRXC8H" /></figure><ul><li>Custom Metadata Renderer function</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dde462464e64d586c68ba81b143edc21/href">https://medium.com/media/dde462464e64d586c68ba81b143edc21/href</a></iframe><ul><li>Call metadataRenderer wherever you want to render metadata (eg. paymentSummary Dialogue or in transaction lists)</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bfc57839315ebd48ac7dc4cd5f6114e6/href">https://medium.com/media/bfc57839315ebd48ac7dc4cd5f6114e6/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=61924ea51f24" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Architecture design, to make payment transactions smart with structured metadata: Week5-Week6…]]></title>
            <link>https://medium.com/@yourpavannn/architecture-design-to-make-payment-transactions-smart-with-structured-metadata-week5-week6-8e4d1034d7f4?source=rss-c92b29e83c08------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e4d1034d7f4</guid>
            <dc:creator><![CDATA[Pavan Joshi]]></dc:creator>
            <pubDate>Tue, 30 Aug 2022 20:34:09 GMT</pubDate>
            <atom:updated>2022-08-30T20:34:09.034Z</atom:updated>
            <content:encoded><![CDATA[<h3>Architecture design, to make payment transactions smart with structured metadata: Week5-Week6 Report⚡</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*n-hVbRUgs61BONL0.png" /></figure><p>In the previous article, we took a deep dive into the permissioned interfaces to communicate with lightning nodes and how we can extend them to pass metadata along with transactions to the wallet.</p><p>In this article, we will take a look at the overview and design of the architecture to make payments transactions smart with structured metadata</p><p><strong><em>Outcomes and Learning achieved during fifth and sixth weeks of internship </em></strong>⚡</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*FIZ0XM_eE_7EnMRNLTXTSg.gif" /></figure><p><strong><em>a. Architecture Design for the Spec</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pjnIb6N0vCwsqQ0V" /></figure><p><strong><em>Workflow</em></strong></p><ul><li>Trigger SendPayment method<br> The lightning web application requests for WebLN provider by triggering SendPayment method. <br>Provider passed by the wallet to the lightning web application shall contain an extended definition of SendPayment method.</li></ul><pre>sendPayment(paymentRequest: string, metadata?: string): Promise&lt;SendPaymentResponse&gt;;</pre><ul><li>Structure and Pass Metadata:-<br>Using SendPayment method, the lightning web application passes an invoice along with additional metadata. <br>WebLN provider delivers such data to the wallets. Before passing metadata to the wallet using the SendPayment method, metadata shall present in a structured form using the data models.</li></ul><pre>webln.sendPayment(invoice, metadata)<br>.then(function (r) {</pre><pre>// Required constraint to protect metadata as a rule while paying empty invoices</pre><pre>if (r != undefined) {</pre><pre>// Provide metadata after successful payment</pre><pre>// Eg. Allow users to download a song after payment is successful</pre><pre>}</pre><pre>})</pre><ul><li>Validate Metadata:-<br> Wallets validate received metadata against predefined data models/schemas.</li><li>Render Metadata in Confirmation Dialogue:-<br>✅ If metadata is passed and is valid, it is rendered in confirmation dialogue along with payment details. <br>❌ If metadata is passed and is not valid, even if the invoice is valid, there might be a possibility of fraud, and wallets don’t allow it to proceed further.</li><li>Store, Interact and Do After Actions:-<br>If metadata passed to the wallet is valid, also an invoice is paid — store, interact and do after actions with metadata.</li></ul><p>b. <strong><em>Deciding standards, to structure metadata</em></strong></p><p>There are different standards such as Schema.org SKOS etc, choosing the right specification among them was a research task.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1d945f7ebca725b9eaf0cfe78edeea77/href">https://medium.com/media/1d945f7ebca725b9eaf0cfe78edeea77/href</a></iframe><p>Schema markup, found at <a href="http://www.schema.org/">Schema.org</a>, is a form of microdata. Once added to a webpage, schema markup creates an enhanced description (commonly known as a rich snippet), which appears in search results.</p><p>Top search engines — including Google, Yahoo, Bing, and Yandex — first started collaborating to create Schema.org, back in 2011.</p><p>Schema.org is a living standard to markup the webpages for better SEO, instead of creating a new specification to structure metadata, we can go with schema.org which is a living standard for markup and stable in its form.</p><p>We create different data models to structure metadata derived from schema.org which users, as well as wallets, follow to structure metadata.</p><p><strong><em>c. Overview of use cases of schema.org for the specification</em></strong></p><p>This specification uses data models derived from standards such as <a href="https://schema.org/">schema.org</a> to deliver structure to metadata and define some standard properties, which we use to describe metadata.</p><p><strong><em>What is schema.org?</em></strong></p><p><a href="http://schema.org/"><strong>Schema.org</strong></a> is a collaborative, community activity on a mission to create, maintain, and promote schemas for structured data on the Internet and web pages, in email messages, and beyond. <a href="http://schema.org/"><strong>Schema.org</strong></a> had founded by the companies such as Google, Microsoft, Yahoo and Yandex.</p><p><a href="http://schema.org/"><strong>Schema.org</strong></a> allows the structuring of data using <strong>JSON-LD</strong> format. <strong>JSON-LD</strong> is a <strong>JSON </strong>having an additional <em>@context</em> field. We use the same schema to structure metadata without the presence of this field.</p><p>Each data model possesses a type with various supported attributes which a lightning web application can utilise to structure metadata. Data model types such as <strong><em>AudioObject, ImageObject, VideoObject </em></strong>and many more are present to structure metadata</p><p>Eg.</p><pre>let metadata: {};</pre><pre>metadata = {</pre><pre>“type”: “AudioObject”,</pre><pre>“name”: “title”,</pre><pre>“creator”: “artist”,</pre><pre>“image”: “image”</pre><pre>}</pre><p>d. <strong><em>data models and type references derived from schema.org</em></strong></p><p>every available type of data model can be used to structure metadata.</p><p>Depending on the implementation of a data model by different wallets, client applications shall cross-check the wallet-specific availability of the data model type, attributes and attribute types before using it to structure metadata.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e0398d5122481dbc2394347edb7dc8fd/href">https://medium.com/media/e0398d5122481dbc2394347edb7dc8fd/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/85c05117ab5f6a86bf9ee203dd4995de/href">https://medium.com/media/85c05117ab5f6a86bf9ee203dd4995de/href</a></iframe><p><strong><em>e. Steps to follow to structure metadata using data models</em></strong></p><ul><li>Check for the Available data model type</li><li>Check for the supported attributes</li><li>Make sure you use the proper type for the attributes mentioned in the table created for each data model type</li><li>Structure metadata in <strong>JSON </strong>format</li><li>Pass Metadata</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e4d1034d7f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Permissioned Interfaces to Communicate with Users Lightning Node: Week3-Week4 Report⚡]]></title>
            <link>https://medium.com/@yourpavannn/permissioned-interfaces-to-communicate-with-users-lightning-node-week3-week4-report-9fe2c8e6b44?source=rss-c92b29e83c08------2</link>
            <guid isPermaLink="false">https://medium.com/p/9fe2c8e6b44</guid>
            <dc:creator><![CDATA[Pavan Joshi]]></dc:creator>
            <pubDate>Tue, 30 Aug 2022 18:53:48 GMT</pubDate>
            <atom:updated>2022-08-30T19:54:44.870Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*n-hVbRUgs61BONL0.png" /></figure><p>In the previous article, we took a deep dive into the transaction metadata. we learnt more about</p><ol><li>What is transaction metadata?</li><li>More about on-chain metadata and off-chain metadata and their implementations</li><li>Different purposes of adding metadata to the transactions</li><li>Use cases, which can be achieved by adding metadata to the transactions</li><li>Different technology standards and interfaces which we can use to achieve the goal of making payment transactions smart and interactive with metadata</li></ol><p>In this article, we will take a look into different types of technology standards and permissioned interfaces to communicate with users’ lightning nodes, right from the web apps.</p><ul><li>WebLN</li><li>WebBTC</li></ul><h3>WebLN</h3><p>WebLN is a set of specifications for Lightning apps and client providers to facilitate communication between web apps and users’ Lightning nodes in a secure way.</p><p>WebLN provides a programmatic, permissioned interface for letting applications ask users to send payments, generate invoices to receive payments, and much more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BiMphdWqek1T1nSQ" /></figure><p><strong><em>WebLN is web3 but for lightning node</em></strong></p><p>WebLN builds on the idea of <a href="https://www.npmjs.com/package/web3">web3.js</a>, a collection of libraries that allow you to interact with a local or remote Ethereum node using HTTP, IPC or WebSocket.</p><p>The WebLN specifications were published in 2018 and since then have continuously improved. In the meantime, several Lightning applications and client providers have been built using this standard.</p><p><strong><em>What things does WebLN bring to the table?</em></strong></p><ul><li><strong>Better UX</strong> WebLN allows for programmatic interactions and reduces friction between a Lapp and the user’s wallet. Users don’t have to switch contexts for scanning a QR code to make a payment anymore. Additionally, they can sign a message with one click to prove ownership of a wallet. If a WebLN client supports autopayments, no prompt is needed and the user is just one click away from sending a payment.</li><li><strong>Ready and secure</strong> WebLN is a specification that only describes how to interact with a Bitcoin Lightning wallet. There is no need to trust and integrate a third-party library. Over the years WebLN has developed and has been recognized as a standard within the community.</li><li><strong>Simple implementation</strong> Initialization and execution of WebLN requires not more than some lines of code of JavaScript — a language that is commonly used for creating web apps.</li><li><strong>Complementary to LNURL</strong> WebLN works well together with <a href="https://github.com/fiatjaf/lnurl-rfc">LNURL</a>, another, more manual standard to make interactions with Lighting easier. If <a href="https://medium.com/building-lightning-apps/best-practices">implemented correctly</a> WebLN provides a great enhancement of the UX. For users without a WebLN provider installed, LNURL can serve as a fallback option.</li></ul><p><strong><em>WebLN Reference:</em></strong></p><p>Available libraries for a quick start</p><p><strong><em>Libraries</em></strong></p><ul><li><a href="https://github.com/joule-labs/webln">WebLN</a>: Typescript library for WebLN</li></ul><p><strong><em>Examples</em></strong></p><ul><li><a href="https://github.com/bumi/webln-demo">webln-demo</a>: Collection of different WebLN samples</li></ul><p><strong><em>Tools</em></strong></p><ul><li><a href="https://lndecode.com/">Lightning Payment Request Decoder</a></li><li><a href="https://lnurl.fiatjaf.com/codec/">LNURL Decoder / Encoder</a></li><li><a href="https://github.com/reneaaron/lapp-template/">Lightning App Template</a> (GitHub)</li></ul><h3>WebBTC</h3><p>WebBTC is a common convention in the Bitcoin web application ecosystem is for key management software (“wallets”) to expose their API via a JavaScript object on the web page. This object is called the common web wallet interface.</p><p>Historically, Provider implementations have exhibited conflicting interfaces and behaviours between wallets. This working group formalizes a Bitcoin extension API to promote wallet interoperability. The API is designed to be minimal, event-driven, and agnostic of transport and RPC protocols. Its functionality is easily extended by defining new RPC methods and message event types.</p><p>Historically, providers have been made available as window.bitcoin or window.webln in web browsers, but this convention is not part of the specification.</p><p><strong><em>WebLN and WebBTC</em></strong></p><p>WebLN is an implementation of the WebBTC specification that focuses only on off-chain Lightning Network functionality, allowing web apps and client providers to communicate with user wallets.</p><p>WebBTC was created to empower everyone to send and receive money on the web. Coupled with the Lightning Network’s ability to send bitcoin instantly and with (almost) no fees, we’re ushering in a new standard for how value moves across the web.</p><p>Integrating WebBTC into the web application is straightforward. Set up support for this new standard and join the era of total Bitcoin Lightning interoperability!</p><p><strong><em>Outcomes and Learning achieved during third and fourth weeks of internship </em></strong>⚡</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*aRfajqoGUSc_A_B7yUo6NQ.gif" /></figure><p><strong><em>a. Extending the SendPayment method</em></strong></p><p>WebLN SendPayment which takes paymentRequest parameter holding the<a href="https://github.com/lightning/bolts/blob/master/11-payment-encoding.md"> Bolt11 Invoice</a>, we can extend this function to add an extra “optional” parameter named metadata which will store metadata as a string and is passed further to the Wallets.</p><p><strong><em>Function Signature:</em></strong></p><pre>sendPayment(paymentRequest: string, metadata?: string): Promise&lt;SendPaymentResponse&gt;;</pre><p><strong>WebLN Provider attached by wallets before</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EvutyFr3FsWRVFOw" /></figure><p><strong>WebLN Provider attached by wallets after implementation of this spec</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*95D71BDAt6rW7srI" /></figure><p><strong><em>b. Draft proposals at WebLN and WebBTC repositories</em></strong></p><ul><li><a href="https://github.com/joule-labs/webln/issues/47">Spec-Proposal: Extend Webln SendPayment method to pass metadata as a optional parameter. · Issue #47 · joule-labs/webln</a></li><li><a href="https://github.com/BitcoinAndLightningLayerSpecs/WebBTC/issues/19">Spec-Proposal: Extend WebBTC SendPayment method to pass metadata as a optional parameter. · Issue #19 · BitcoinAndLightningLayerSpecs/WebBTC</a></li></ul><p>c. <strong><em>Create an example repository which creates and attaches an extended WebLN provider to the client</em></strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/529ff74cc84b16a12742cc953f57fdb4/href">https://medium.com/media/529ff74cc84b16a12742cc953f57fdb4/href</a></iframe><p><a href="https://github.com/pavanjoshi914/Alby-With-extended-Webln">GitHub - pavanjoshi914/Alby-With-extended-Webln</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9fe2c8e6b44" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deep Dive into Bitcoin Transaction Metadata: Week1-Week2 Report]]></title>
            <link>https://medium.com/@yourpavannn/deep-dive-into-bitcoin-transaction-metadata-week1-week2-report-fbdd4d7119a3?source=rss-c92b29e83c08------2</link>
            <guid isPermaLink="false">https://medium.com/p/fbdd4d7119a3</guid>
            <dc:creator><![CDATA[Pavan Joshi]]></dc:creator>
            <pubDate>Tue, 30 Aug 2022 01:48:26 GMT</pubDate>
            <atom:updated>2022-08-30T02:25:31.897Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_al8z7s58fghpmm1ZP-Ujw.png" /><figcaption>Summer Of Bitcoin</figcaption></figure><blockquote>Hey folks! The summer of Bitcoin coding period was officially started on May 17.</blockquote><p>After the community bonding period, this is my first article on the coding period, sharing my first two weeks of coding period experience with</p><p>During these two weeks, I had a deeper look into the transaction metadata and tried to find out answers to the questions such as:-</p><p>What is transaction metadata? 🤔</p><p>What type of purpose does it serve and how it can be helpful (if added)?🤔</p><p>How we can derive different use cases for wallets by adding transaction metadata?🤔</p><p>How and using which technologies we can add metadata to lightning payments?🤔 …and many more!🤔🤔…</p><p><strong><em>Week1-Week2:- Brainstorming Transaction Metadata</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*sigTjKGJtjmJ0pVJLoqLFg.gif" /></figure><p>Bitcoin transactions hold only static data which doesn’t include much more relevant information to look into. What if transactions can have additional information (metadata)?</p><p><strong><em>What is transaction metadata? 🤔</em></strong></p><p>Transaction lists, as we know them from our private bank accounts, are often a simple list of transactions sorted by date. Each transaction has data like sender, receiver, amount, reason and date.</p><p>Similarly, Bitcoin transactions hold static data that doesn’t include much more relevant information to dive into it. What if transactions can have additional information(metadata)?</p><p>Bitcoin has radically changed the way we view transactions of digital assets and value. Transaction metadata can live on-chain as well as off-chain (wallet specific).</p><p><strong><em>On-chain Metadata (Stored in Bitcoin Transaction Blocks using Scripting language)</em></strong></p><p><strong><em>What is OP_RETURN?</em></strong></p><p>OP RETURN is an instruction of the Bitcoin scripting language which allows users to attach metadata to a transaction and therefore save it on the blockchain. There can only exist one OP_RETURN per transaction. The operation stores them in the blockchain, but they are not UTXOs (unspent output from bitcoin transactions). Therefore, they will not consume RAM, but only disk space, resolving the issues and inefficiencies that the previously used methods had.</p><p>OP_RETURN can be used to add metadata to bitcoin transactions and store the on-chain metadata which can represent certain sort of</p><ul><li>A message</li><li>A memo</li><li>An Instruction to utilize specific digital assets</li><li>The certification of documents</li><li>Declaration of access rights and copyrights of the digital document</li><li>And many more</li></ul><p><strong><em>How do I add on-chain metadata to the blockchain?</em></strong></p><p>Essentially, one of the output <a href="https://en.bitcoin.it/wiki/Script">scripts</a> should be</p><pre>OP_RETURN &lt;the data you want to add&gt;</pre><p>Say you want to add the string “Melons.” to the blockchain.</p><ol><li>Convert to binary<br>“Melons.” -&gt; 4d656c6f6e732e</li><li>Add the push-data-onto-stack command at the start. This is the length of your metadata if it’s less than 75 bytes, or OP_PUSHDATAx otherwise.<br>074d656c6f6e732e</li><li>Add OP_RETURN at the start<br>6a074d656c6f6e732e</li><li>Put this in the scriptPubKey of an output of a transaction. I wrote a guide on this <a href="https://bitcoin.stackexchange.com/a/36439/2306">here</a>.</li></ol><p><strong><em>How to find on-chain metadata again?</em></strong></p><p>That’s… trickier. Bitcoin is not optimized for searching the metadata of transactions.</p><p>A few of the possibilities might be:</p><ul><li>Look through all of the transactions you get with something like bitcointools.</li><li>Use a website like <a href="http://coinsecrets.org/">coinsecrets.org</a>.ore…</li></ul><p>Metadata stored in transaction blocks provides uniqueness to the data.</p><p><strong><em>Off-chain metadata (For Lightning Payments)</em></strong></p><p>On the Lightning network, there is no chain and no validated global state. data is just shared p2p between the sender and the receiver and there is no validation that something is unique.</p><p>Metadata added to the lightning payments can be handled by wallets and stored in their <strong><em>databases </em></strong>or can be passed to the lightning using <strong><em>tlv extensions.</em></strong></p><p><strong><em>What is tlv extension?</em></strong></p><p>The tlv_payload is a modification to the way onion packets are created between the 1.0 version and the 1.1 version (current working version) of the BOLT specs. The (optional) feature is named var_onion_optin in BOLT#9.</p><p>In V1.0 of the spec, there was a fixed structure for sending onion payloads to hops along a route, which contained a short_channel_id, a cltv_expiry and an amount_to_forward. In the latest version, implementations can add custom data to be forwarded in addition to the previously required ones. These contain a type and length encoded as a compact size integer, and the value of length bytes is serialized afterwards. Hence Type-Length-Value, or TLV.</p><p>Nodes which support the newer format advertise the var_onion_optin feature when they broadcast a node_announcement the message, by setting bit #9 in the features field of this message.</p><p>In the lnd codebase, the feature folder contains the logic for feature bit vectors. It appears from the manager. go that LND now treats the tlv_payload as enabled by default unless it is disabled as part of the config. Older versions of LND will obviously not support the feature and will use the legacy hop_data payload format.</p><p><strong><em>What type of purpose does it serve and how it can be helpful (if added)?🤔</em></strong></p><blockquote>Transaction metadata can be used to make Payment Transactions smart providing much more interactivity.</blockquote><p>For instance, if added</p><ul><li>Metadata representing what was given away to the user with that particular transaction</li><li>Accessing given away items right away from and out of the wallet (As metadata holds some quality information about the transaction)</li><li>Allow users to interact with transactions depending on the additional information each transaction holds in form of metadata</li></ul><p><strong><em>How we can derive different use cases for wallets by adding transaction metadata?🤔</em></strong></p><p>It allows users to perform actions directly out of the user’s wallet, including:</p><ul><li>Accessing the purchased digital content.</li><li>Renewing the expiring subscriptions.</li><li>Advertising products by passing information as metadata.</li><li>Ask for donations with relevant information as metadata.</li><li>Recollaterize open trades on trading platforms.</li><li>Topping up gift card budgets.</li><li>And many more.</li></ul><p><strong><em>How and using which technologies we can add metadata to lightning payments?🤔</em></strong></p><p>Many different specifications such as LNURL, WebLN and many more bought a better solution to the UX of lightning network and enhanced applications of Bitcoin.</p><p>On top of this, many broad applications such as:</p><ul><li>Instant payments via a web browser using Bitcoin Sats (Eg. Alby)</li><li>Tippings for content writers, podcasts and streamers</li><li>Streaming sats</li><li>Instant purchases on the Web and many more came into working.</li></ul><p>Every transaction can store additional information as metadata which can make specifications such as WebLN more broad and applicative in terms of interactivity and extend the scope of the Bitcoin use cases in numerous ways, building a whole different future for the lightning network and Bitcoin.</p><p>Extending existing technology standards such as <strong>WebLN or LNURL </strong>to enrich transactions with additional information as structured metadata so that transactions containing static data, now contain more meaningful information, gives more interactivity to the transactions.</p><p><strong><em>Outcomes and Learning achieved during first two weeks of internship </em></strong>⚡</p><p>1. Research on different specifications and technologies built on top of the lightning network which allows making lightning payments through browsers — <strong><em>Lnurl, WebLN, WebBTC</em></strong>.</p><p>2. Brainstorming working of such specifications and how can add metadata along with lightning payments using such specifications.</p><p>3. Finalizing the most suitable specification to be extended for passing structured metadata along with payments — WebLN were chosen</p><p><strong>Reasons to go with WebLN:</strong></p><p>a. Most of the lightning wallets support WebLN as a standard</p><p>Different WebLN Providers are as follows:-</p><p><em>Desktop (browser extensions)</em></p><ul><li>​<a href="https://getalby.com/">Alby</a>: a versatile open-source browser extension for the Bitcoin Lightning Network</li><li>​<a href="https://lightningjoule.com/">Joule</a>: a WebLN-enabled browser extension that uses your node</li><li>​<a href="https://github.com/fiatjaf/kwh/">kwh</a>: A firefox/chrome extension for WebLN to your c-lightning node</li></ul><p><em>Mobile wallets</em></p><ul><li>​<a href="https://blixtwallet.github.io/">Blixt Wallet</a>: a non-custodial open-source Lightning Wallet with a WebLN browser</li><li>​<a href="https://bluewallet.io/">BlueWallet</a>: a mobile wallet with a WebLN browser</li><li>​<a href="https://breez.technology/">Breez</a>: a mobile wallet with selected WebLN apps in their marketplace</li></ul><p><em>Mobile</em></p><ul><li>Kiwi Browser with Chrome extension</li></ul><p>b. LNURL doesn’t maintain consistency in its adoption, some wallets support it while some do not.</p><p>c. WebLN is easy to implement and use and can be extended rapidly.</p><p>d. WebLN is not in the form of npm dependency, it is just a standard which can be programmed easily by whoever wishes to integrate it in its way.</p><p>e. Most importantly, now Alby itself is WebLN</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fbdd4d7119a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Community bonding period at Alby- a lightning browser extension ]]></title>
            <link>https://medium.com/@yourpavannn/community-bonding-period-at-alby-a-lightning-browser-extension-d6cd0bf15e53?source=rss-c92b29e83c08------2</link>
            <guid isPermaLink="false">https://medium.com/p/d6cd0bf15e53</guid>
            <dc:creator><![CDATA[Pavan Joshi]]></dc:creator>
            <pubDate>Mon, 29 Aug 2022 18:12:08 GMT</pubDate>
            <atom:updated>2022-08-31T11:11:25.462Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*_al8z7s58fghpmm1ZP-Ujw.png" /></figure><p>The Summer of Bitcoin was just about to kickstart! after a great onboarding session held by the summer of bitcoin admins, it was time to get introduced to the organization and its workflow and deep dive into the Alby codebase.</p><p>During this period I learned more about Alby browser Extension, its architecture, technologies used in the Alby codebase, and potential features offered by the Alby lightning browser extension.</p><p>Along with this, we had weekly chats and heads-together meeting having super fun while working!</p><p><strong><em>What is Alby Browser Extension? </em></strong>🐝</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/0*69ULWpZhaFeYKHIW" /></figure><p>Alby is the Bitcoin Lightning Browser extension that connects to different wallet interfaces and brings deep lightning integration to the web.</p><p>Alby is the power of lightning in your web browser!</p><p>The extension provides deep Lightning Network integration for websites (for payments and authentication flows).</p><p>Alby was created with the purpose to write a minimal web extension to allow browsers to interact with the Lightning Network programmatically. It focuses on the web-payments process and does not try to be a full node UI with advanced channel management or similar features.</p><p>The extension implements the WebLN standard as the interface that allows websites to connect to Lightning Network nodes (to request payments, invoices, signatures, login, etc.) and enable seamless UX of web payments and authentications.</p><p>The extension can connect to different node implementations and supports custodial and non-custodial setups.</p><p><strong><em>Relevant Information about Alby Codebase! </em></strong>📚</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xvZrPJCuxiDEj-ke.png" /></figure><p>Alby is a well-written browser extension for all the major browsers such as</p><ul><li>All <a href="https://en.wikipedia.org/wiki/Chromium_(web_browser)#Browsers_based_on_Chromium">Chromium-based browsers</a> — Chrome Opera, Brave etc.</li><li>Firefox</li><li>And many more coming soon…</li></ul><p>Its development releases are nightly releases with additional features included for testing purposes</p><ul><li><a href="https://nightly.link/getAlby/lightning-browser-extension/workflows/build/master/firefox.xpi.zip">Firefox Nightly</a></li><li><a href="https://nightly.link/getAlby/lightning-browser-extension/workflows/build/master/chrome.zip">Chrome Nightly</a></li></ul><p>Alby is React app with typescript as a template and provides functionality to connect to the different lightning nodes through browsers enabling payments through the browsers.</p><p>It uses WebLN to communicate with different lightning nodes, nodes communicating with lightning networks and returning payment responses which in return is shown by the lightning browser extension.</p><p><strong><em>Some of the features offered by the Alby wallet</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lZ4eI9Vmp5mRRhwabZInug.png" /></figure><ul><li>Custom budgets/allowances for websites to allow payment streams/auto-payments</li><li>Multiple accounts and support for different node backends (lnd, etc.)</li><li>Full WebLN send and receive payment flows (getInfo, sendPayment, fixed makeInvoice support)</li><li><a href="https://xn--57h.bigsun.xyz/lnurl-pay-flow.txt">LNURL-pay</a> support</li><li><a href="https://xn--57h.bigsun.xyz/lnurl-auth.html">LNURL-auth</a> support</li><li>Payment history with additional website metadata</li><li><a href="https://xn--57h.bigsun.xyz/lnurl-withdraw-flow.txt">LNURL-withdraw</a> support</li><li>WebLN signMessage, verifyMessage support</li><li>WebLN dynamic makeInvoice support</li><li>Keysend</li></ul><p><strong>Getting introduced to the mentors</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9N6-_edhQG7dXlIkl7NjOw.png" /></figure><p>Every week we have a community call where we discuss potential problems, their solutions and the future scope to be built for the Alby. This is the place where everyone shares their status of the work and their experience while working on Alby for the current week.</p><p>During community bonding periods we had community calls as well as heads-together chats and meetings to discuss the potential direction of the project to be implemented during the coding period of the summer of bitcoin.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d6cd0bf15e53" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Making Bitcoin Transactions Smart And InteractiveWith Structured Metadata]]></title>
            <link>https://medium.com/@yourpavannn/making-bitcoin-transactions-smart-with-structured-metadata-1c3be0ab428?source=rss-c92b29e83c08------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c3be0ab428</guid>
            <category><![CDATA[lightning-network]]></category>
            <category><![CDATA[we]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[bitcoin]]></category>
            <dc:creator><![CDATA[Pavan Joshi]]></dc:creator>
            <pubDate>Wed, 06 Jul 2022 12:59:19 GMT</pubDate>
            <atom:updated>2022-07-08T04:01:21.466Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PInr7kRSeMEMCkh4nWWdDw.png" /></figure><blockquote>A new future of Bitcoin Transactions exploring numerous use cases, bringing Bitcoin in our day to day life 💰</blockquote><p><strong><em>Abstract </em></strong>⚡</p><p>Specifications such as WebLN bought better solutions to the UX for lightning networks and enhanced applications of Bitcoin.</p><p>On top of this, many broad applications such as 💻 —</p><ul><li>Instant payments via a web browser using Bitcoin Sats (eg. Alby)</li><li>Tippings for content writers, podcasts and streamers</li><li>Sat’s streaming</li><li>Instant purchases on the Web and many more came into working…</li></ul><p>Transaction lists as we know them from our private bank accounts are often a simple list of transactions sorted by date. Each transaction has data like Sender, Receiver, amount, reason and date.</p><p>Similarly, Bitcoin transactions hold only static data which doesn’t include much more relevant information to look into. what if transactions can have additional information(metadata) such as 💫 —</p><ul><li>Purpose of Transaction</li><li>What was bought with that particular transaction</li><li>Accessing bought right out of the wallet</li><li>Allow users to interact with transactions depending on the additional information each transaction will hold</li></ul><p>Every transaction can store additional information in form of metadata which can make specifications such as WebLN more broad and applicative in terms of interactivity and extend the scope of the Bitcoin use cases in numerous ways building a different future for the lightning network and Bitcoin.</p><p>This project aims to extend existing technology standards such as WebLN to enrich transactions with additional information as structured metadata so that transactions containing static data contain more meaningful information giving more interactivity to the transactions.</p><p><strong>What is WebLN? </strong>🤔</p><p>Lightning Web Standard (WebLN) ⚡ is a specification used to build a Bitcoin Lightning-driven web application.</p><p>WebLN is a set of specifications for Lightning apps and client providers to facilitate communication between web apps and users’ lightning nodes in a secure way. It provides a programmatic, permissioned interface for letting applications ask users to send payments, generate invoices to receive payments, and much more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8D4j3sWnsbclRJga" /><figcaption>WebLN Provider Functionality</figcaption></figure><h4>Sending Payments Via WebLN Along With Metadata 🧾</h4><p>WebLN <strong><em>SendPayment</em></strong> which takes <strong><em>paymentRequest</em></strong> parameter holding Bolt11 invoice, we can extend this function to add an extra “optional” parameter named <strong><em>metadata</em></strong> which will hold metadata as a string which can be passed to the Wallets.</p><p><strong><em>Function Signature::</em></strong></p><pre>sendPayment(paymentRequest: string, metadata?: string): Promise&lt;SendPaymentResponse&gt;;</pre><p><strong>WebLN Provider attached by wallets currently</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xH3Ip4lBH_1Xzj0S.png" /></figure><p><strong>WebLN Provider attached by wallets after implementation of spec</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/0*ck3K-T5O2haHBVqy.png" /></figure><h4>Working/architecture of this spec ⚙️</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lz4JHjDty-jrWAV9eqcDPA.png" /></figure><ol><li><strong>Make a Request to Wallet for WebLN Provider Via Triggering SendPayment()</strong></li></ol><pre>sendPayment(paymentRequest: string, metadata?: string): Promise&lt;SendPaymentResponse&gt;;</pre><p>2. <strong>Structure Metadata and pass it to the wallet in Callback</strong></p><p>Use <a href="http://schema.org/"><strong>Schema.org </strong></a>specifications to structure metadata in form of <strong>JSON-LD.</strong></p><p>eg.</p><pre>var Metadata = {};<br>Metadata = {<br> &quot;<a href="http://twitter.com/context">context</a>&quot;: &quot;<a href="https://schema.org/">https://schema.org</a>&quot;,<br> &quot;<a href="http://twitter.com/type">type</a>&quot;: &quot;AudioObject&quot;,<br> &quot;name&quot;: &quot;title&quot;,<br> &quot;creator&quot;: &quot;artist&quot;,<br> &quot;image&quot;: &quot;image&quot; <br> }<br> export var Metadata;</pre><p>Learn more about how to structure metadata for Bitcoin Transactions Visit — <a href="https://github.com/getAlby/lightning-browser-extension/wiki/Structuring-Transaction-Metadata-Using-Schema.org-Specifications"><strong><em>Here</em></strong></a></p><p>3. <strong>Validate Metadata</strong></p><p>Metadata is user-generated, such type of metadata should be cross-checked for its correctness and before performing any further action we have to do validation of metadata.</p><p><em>What is JSON Schema? </em>🧐</p><p>JSON Schema is <strong>a JSON media type for defining the structure of JSON data</strong>. JSON Schema provides a contract for what JSON data is required for a given application and how to interact with it.</p><p>Schemas can be created to validate received data against a predefined data model. To do this many validator plugins are available too -</p><ul><li>Generate Schema</li><li>Compile Schema</li><li>Validate received data for that particular schema</li></ul><p><a href="https://www.npmjs.com/package/zod"><strong><em>Zod</em></strong></a> plugin can be used to validate JSON schemas as well as Object schemas. The best thing about this plugin is that it has zero external dependencies involved.</p><p>Validator function which validates schemas using zod plugin</p><ul><li>Schema Created using Zod plugin</li></ul><pre>import { z } from &quot;zod&quot;;</pre><pre>export const audioObjectSchema = z.object({<br>  type: z.string(),<br>  name: z.string().optional(),<br>  creator: z.string().optional(),<br>  image: z.string().optional(),<br>});</pre><ul><li>Validator function to validate metadata</li></ul><pre>import { audioObjectSchema } from &quot;./audioObjectSchema&quot;;</pre><pre>export function isBase64(str: string) {<br>  if (str === &quot;&quot; || str.trim() === &quot;&quot;) {<br>    return false;<br>  }<br>  try {<br>    return btoa(atob(str)) == str;<br>  } catch (err) {<br>    return false;<br>  }<br>}</pre><pre>export function MetadataValidator(metadata: { [key: string]: string }) {<br>  let hasValidType = false;<br>  let hasValidImage = true;<br>  for (const key in metadata) {<br>    if (key == &quot;type&quot;) {<br>      if (metadata[key] == &quot;AudioObject&quot;) {<br>        const parsed = audioObjectSchema.safeParse(metadata);<br>        if (parsed.success) {<br>          hasValidType = true;<br>        }<br>      }<br>    }<br>    if (key == &quot;image&quot;) {<br>      hasValidImage = isBase64(metadata[key]);<br>    }<br>  }</pre><pre>return hasValidType &amp;&amp; hasValidImage;<br>}</pre><p>To Validate Metadata Just call the function by passing metadata</p><pre>const isMetadataValid = MetadataValidator(metadata);</pre><p><strong>4. Render Metadata in Confirmation Dialogue (If Valid) </strong>🚦</p><p>If metadata is successfully validated, we can show the user the amount the user will be paying along with the content used will be buying in form of metadata.</p><p>Here users can see the purpose of the transaction, looking over the content, the user will be buying through this transaction and will have a clear idea of everything before making the payment.</p><p>5.<strong> Store, Interact and do after actions with Metadata </strong>💾</p><p>Once the user confirms his/her payment and the transaction gets successful -</p><ul><li>In Bitcoin Lightning Wallet</li></ul><p>We can store and render the metadata in the transaction database of the wallet allowing users to interact with the metadata.</p><ul><li>In Lightning Application</li></ul><p>Once the payment is successful , we can allow the user to access his purchased content such as allowing user to download a song, once the payment is successful.</p><pre>webln.sendPayment(Bolt 11 invoice, Metadata)<br>          .then(function(r) {<br>            if(r != undefined){  <br>            // do after payment actions with the metadata. eg. allowing user to download song after payment is done <br>          }<br>          })<br>          .catch(function(e) {<br>            alert(&quot;Failed: &quot; + e.message);<br>            console.log(&#39;err pay:&#39;, e);<br>          });<br>    })<br>    .catch(function(e) {<br>      alert(&quot;Webln error, check console&quot;);<br>      console.log(&#39;err, provider&#39;, e);<br>    });<br>}</pre><h4>Use cases 🔥</h4><p>These new specifications on top of Bitcoin and the lightning network make Transactions happening on top of Bitcoin much more interactive and smart</p><p>The potential of use cases after implementation is vast and transactions no longer only hold details about the performed payment but also include structured metadata of the consumed objects. 💫</p><p>For instance, it allows users to perform actions directly out of their wallet such as accessing purchased digital content, renewing expiring subscriptions, recollaterizing open trades on trading platforms or topping up gift card budgets. ✨</p><p>To demonstrate the concept more clearly, I decided to create a simple prototype through which a visitor can play a song if they like they can buy a song. While buying a song during confirmation payment they get to know about the song name, artist, and song image(send as base64 encoded string, decode on Alby side).</p><p>After successful payment, a song gets downloaded into users’ local storage. 🎉</p><p><a href="https://drive.google.com/file/d/1WUZybY3d-MTbcdlMRGQK_zTJHU7PVeIV/view">bandicam 2022-04-17 14-55-42-241.mp4</a></p><p><a href="https://github.com/pavanjoshi914/Buy-songs-with-Alby-demo-for-transaction-metadata/pull/1">Prototype Code</a></p><p><a href="https://github.com/pavanjoshi914/Alby-With-extended-Webln/commit/ed6f7559de47b7a9c932e655fb45be9481856714">Alby with extended webLN specification</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c3be0ab428" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Summer Of Bitcoin — Intro and Onboarding Week at Bitcoin]]></title>
            <link>https://medium.com/@yourpavannn/summer-of-bitcoin-intro-and-onboarding-week-at-bitcoin-aef781559dda?source=rss-c92b29e83c08------2</link>
            <guid isPermaLink="false">https://medium.com/p/aef781559dda</guid>
            <dc:creator><![CDATA[Pavan Joshi]]></dc:creator>
            <pubDate>Mon, 16 May 2022 00:00:00 GMT</pubDate>
            <atom:updated>2022-05-28T10:07:04.815Z</atom:updated>
            <content:encoded><![CDATA[<h3>Summer Of Bitcoin — Intro and Onboarding Week at Bitcoin</h3><p>Voila, readers 👋! It’s been a week since I started my journey with bitcoin as a Bitcoin Intern. It has been a great learning experience so far.</p><p>If you are willing to know more about Bitcoin Internship, kindly check my previous post — <a href="https://medium.com/@pavan.techie/summer-of-bitcoin-a-global-bitcoin-internship-d5ea58aac743"><strong>Summer Of Bitcoin- A global Internship Program</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*uzwM2clU6ZpB--X_bKy9TQ.jpeg" /></figure><p>During the first week of the Bitcoin Internship, I got the opportunity to meet many Tech Bitcoin experts worldwide. We took a deep dive into the <em>Bitcoin protocol</em> and how we can enhance career opportunities through this Internship.</p><blockquote><strong><em>We got to hold a welcome session conducted by </em></strong><strong><em>Summer of Bitcoin Admin </em>Adi Shankara</strong></blockquote><p>During this session, we learned about different initial tasks like getting started with (TODOs), Stats of Summer of Bitcoin 2022, Expectations of the program from its selected interns and many different perks and opportunities this internship provides. ✨</p><p>For this year, out of <em>20k applications worldwide, only 82 interns from 15 different countries were selected</em>, making it into Summer of Bitcoin in the first attempt and being a part of those 82 interns makes me feel overwhelmed. 🎉</p><p>Session Presentation: <a href="https://drive.google.com/file/d/1B1sPPvJDYH9ao5TnfrmC5lRpU-9QasrM/view?usp=sharing"><em>Here</em></a></p><blockquote><strong><em>The second session was conducted on </em></strong><strong><em>Communication, Collaboration and Career Development by </em>Caralie Chrisco</strong></blockquote><p>During this session, we got to know about various technical interviewing skills and more about technical concepts such as ⏬</p><ul><li>Technical Blogging</li><li>Network Building</li><li>Technical Interviewing</li><li>Resume Making</li><li>Answering Technical Questions</li></ul><p><strong>Resources</strong> 🔽</p><ol><li><a href="https://www.canva.com/">Canva </a>— Free graphic design software 💻</li><li><a href="https://www.grammarly.com/">Grammarly</a> — Check your writing ✍️</li><li><a href="https://hemingwayapp.com/">Hemingway </a>— Improve your writing ✅</li><li><a href="https://medium.com/">Medium </a>— Create your own blog 📃</li><li><a href="https://www.meetup.com/">Meetup </a>— Meet people with similar interests, and build your network! 🧑‍🤝‍🧑</li><li><a href="https://www.break-in.tech/">Break-In</a> — Blog for junior devs, with some relevant articles on technical interviewing 🔰</li></ol><blockquote><strong><em>The third session was conducted on </em></strong><strong><em>Bitcoin and Open-source Development by </em>Adam Jonas</strong></blockquote><p>During this session, we learnt many different aspects of Bitcoin and sessions conducted by chain code <em>labs</em> in order to understand Bitcoin protocol development in a better way. 🔀</p><p>Resources: <a href="https://chaincode.com/"><em>Here</em></a></p><blockquote><strong><em>The fourth and final session of this week was conducted on </em></strong><strong><em>Deep-dive into Bitcoin by </em>Matthew Zipkin</strong></blockquote><p>In this session, we had a quick glance at Bitcoin, Goals of Bitcoin, Cryptography in Bitcoin, Account-based VS Coin based model, Bitcoin OP codes, Proof of Work etc. 🪙</p><p>Session Presentation: <a href="https://drive.google.com/file/d/1m-ex3tgCbx5J9UcIDkbYbQMc1uv9ocLw/view?usp=sharing"><em>Here</em></a></p><p>For more, stay connected !!</p><p>Best Regards ~ <a href="https://github.com/pavanjoshi914">Pavan</a></p><p><em>Originally published at </em><a href="https://pavanjoshi914.github.io/Blog/sob/First-week-of-bitcoin-intern/"><em>https://pavanjoshi914.github.io</em></a><em> on May 16, 2022.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aef781559dda" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>