<?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 Tim Ross on Medium]]></title>
        <description><![CDATA[Stories by Tim Ross on Medium]]></description>
        <link>https://medium.com/@tim_ross?source=rss-fa1867cb3043------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*d5hC-dmZF1AV2DEdie8U1A.jpeg</url>
            <title>Stories by Tim Ross on Medium</title>
            <link>https://medium.com/@tim_ross?source=rss-fa1867cb3043------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 14:25:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tim_ross/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[Stellar Channels: Motivations & More]]></title>
            <link>https://medium.com/@tim_ross/stellar-channels-motivations-more-b655a99d5ab3?source=rss-fa1867cb3043------2</link>
            <guid isPermaLink="false">https://medium.com/p/b655a99d5ab3</guid>
            <category><![CDATA[stellar]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Tim Ross]]></dc:creator>
            <pubDate>Fri, 12 Apr 2019 19:25:01 GMT</pubDate>
            <atom:updated>2019-04-12T19:25:01.246Z</atom:updated>
            <content:encoded><![CDATA[<h4>The channels design pattern offers several benefits to Stellar applications, but the extra complexity means that developers implementing a channels-based approach have choices to make and tradeoffs to consider.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0DJxVN2g965fjDMkDdjEmw.jpeg" /></figure><p>My team spent the last several months <a href="https://itnext.io/exploring-tokens-with-stellar-291172208639">developing a digital asset/tokenization application</a> on top of the <a href="http://www.stellar.org/">Stellar</a> platform. Stellar makes it very easy for any account to issue its own assets, transfer them to another account, make offers on other assets, issue trustlines for other assets, and configure a wide variety of rules, limits, and multi-sig policies. <a href="https://www.stellar.org/developers/guides/concepts/list-of-operations.html">Twelve basic operations</a> serve as the building blocks that can be assembled into atomic transactions that can be submitted to the Stellar network and, if successful, recorded on its immutable append-only ledger.</p><p>When my team first started working with Stellar, we found it sufficient to just create simple transactions in which the originating <strong><em>source account</em></strong> of the transaction was the same account that was acting as the <strong><em>source</em></strong> of whatever operation or operations were contained within that transaction. For example, if we wanted to create a transaction that would allow Arthur’s “artAcct” account to open up a new trustline for Beatrice’s asset “BeaBucks”, we would use “artAcct” as the source account for both the operation <em>and</em> the enclosing transaction.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/97c7824c40cec5e7839252d3e619c64f/href">https://medium.com/media/97c7824c40cec5e7839252d3e619c64f/href</a></iframe><p>Here we explicitly specify “artAcct” as the source account for both transaction and operation, but the source field for operations is actually optional. If not otherwise specified, the source of an operation automatically defaults to the transaction’s source. For multi-operation transactions where the source is constant throughout all of the operations, it may be convenient to omit the redundant field. For example, if the payroll department account needs to pay quarterly bonuses to several employee accounts in a single transaction, we can specify the payroll department account as the source of the entire multi-operation transaction and not even bother with specifying it as the source of the individual payment operations.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b28713235856e7344e2b54bc94e7ea0a/href">https://medium.com/media/b28713235856e7344e2b54bc94e7ea0a/href</a></iframe><p>In both of these cases, there is a single account serving as the source for both the entire transaction as well as the individual operation(s). That means that not only does this single source account act as the main participant in all of the transaction’s operations (making a payment, managing an offer, creating a trustline, setting account options), it is also the one account that must sign the transaction with its secret, pay the Stellar network fees out of its lumens/XLM balance, and consume a sequence number when the transaction is submitted to the Stellar network. (Granted, the single source account may have been configured with additional signers in order to implement multi-sig security, but that’s a bit of a tangent….there is still only one <strong><em>account</em></strong> acting as the source for everything). This single-source approach certainly minimizes the number of accounts involved and signatures required, and there is a nice bit of clarity to the fact that if an account has operations that need to be submitted to the Stellar network, that account has to handle all of the logistical transaction needs and network costs itself. This single-source approach must be the preferred way to set up Stellar transactions, right?</p><h3>Channel Change</h3><p>Well, not necessarily. As it turns out, there is nothing that requires the source account of a Stellar transaction to have any participating role whatsoever in the actual transaction itself. This technicality allows for some interesting architectural options and the emergence of a useful design pattern for Stellar applications: <strong><em>channels</em></strong>. The central idea behind Stellar channels is that you can employ otherwise normal and unrelated Stellar accounts to do the extra-transactional network-related plumbing on behalf of the Stellar accounts that are actually participating in the various operations and transactions of your application. The operations inside a channels-based transaction do not need to change in any way, and they will be executed exactly as they would in a non-channel-based transaction. The main difference when using channels is that the channel account will pay the Stellar network fee and consume a sequence number. The channel account will also join the operation source accounts as required signers on the transaction as a whole; depending on your perspective, this may either be seen as an annoying extra step or a helpful multi-sig security improvement layered on top of the other required signatures.</p><p>Why would you <em>want</em> to use a totally unrelated channel account as the source of your Stellar transaction? Well, the most obvious reason is that channels allow you to greatly increase the rate at which your application can submit transactions to the Stellar network. Any source account that has attempted to submit multiple Stellar transactions to the network within a short period of time (perhaps just as a result of rapid-fire unit test execution) is likely to have at some point encountered the dreaded sequence number error (BAD_SEQ) indicating that a transaction did not have the expected sequence number required for successful execution. This race condition is pretty much unavoidable unless you intentionally delay the submission of each transaction until all previous transactions are successfully recorded in the ledger. But if each transaction can delegate its source duties to a separate channel account created just for that purpose, and if there is no business requirement that transactions arrive in a given order, the transaction submission can be effectively parallelized, and any one transaction doesn’t need to worry about if and when other transactions for that account are submitted and recorded.</p><p>Maximizing transaction throughput is the primary motivation behind Stellar channels, but there are other lesser-known benefits worth enumerating and exploring. Since it’s the source account of a transaction that pays the required network fee, channels afford us the opportunity to logically separate and/or group these fees in a way that makes more sense for our application. In a simple application, requiring each Stellar account to pay-as-you-go might not be such a big deal, but imagine a custodial application with multiple tenants and potentially hundreds of accounts per tenant. In such a scenario, it might be desirable to implement a “separation of concerns” approach, where fee sourcing and fee payments and minimum-balance-replenishing were all handled at a lower infrastructure-level layer of our application, hidden away from users/tenants who are acting on higher-level account abstractions (and potentially getting charged for using our application on a completely different fee schedule). Using channels can make all of this possible, since our behind-the-scenes channel accounts would be the ones to consume sequence numbers, pay network fees, and worry about minimum balances.</p><h3>Channel Choices</h3><p>Now that we think we want to use channels in our application, what would the implementation details look like? How would separate channel accounts be created and managed and assigned for use? One possible approach is to create a dynamically sized “channel pool” from which transaction source accounts could be borrowed and then returned. In much the same way that a database connection pool allows the processes of a web application to efficiently share ready-to-use database resources, a “channel account pool” would allow the separate processes and/or accounts within a Stellar app to utilize a common set of channel accounts as the necessary plumbing and infrastructure for submitting transactions to the Stellar network.</p><p>Jem Mawson’s excellent article <a href="https://www.lumenauts.com/blog/boosting-tps-with-stellar-channels"><em>Boosting TPS with Stellar Channels</em></a> takes this approach, describing how a Scala/Akka channel pool implementation greatly increased the potential transactional throughput of a Stellar application. Mawson also considers some of the trickier account lifecycle concerns: channel creation, account funding, preparing for scale, channel closing. One of the messiest issues with any sort of channel pool is that each account in a pool must be adequately funded in order to be able to pay transaction fees while still maintaining a required minimum balance. Accounts that dip below the minimum required lumens balance will have to be replenished in order to stay in the pool. Where do these funds come from and how do we handle all of the accounting? For multi-tenant applications, how can we cleanly pass along (or at least measure) the fees incurred by the many users and accounts in our system?</p><p>While I was pondering how complicated the management of fee payments from a channel pool could get, I stumbled upon Tyler Van der Hoeven’s <a href="https://www.lumenauts.com/blog/better-stellar-fee-channels"><em>Better Stellar Fee Channels</em></a>, which describes an elegant approach to logically separating out Stellar transaction fees from the end-user accounts taking part in transactions. Tyler’s key insight is that by adding a simple reimbursement operation to any transaction, the fee charge can effectively be re-routed from the official transaction source to any other Stellar account, perhaps one designated to pay all fees for a given account, user, or tenant. Ironically, the “fee channels” implementation Tyler describes is not technically a channels-based approach, since the transaction source account is not a separate channel account but rather one of the accounts participating in the operation. And thus, while this approach has much to offer in terms of accounting purposes, it doesn’t attempt to tackle scalability/concurrency. An account that uses reimbursement-based fee channels in this manner could easily run into sequence number errors if it was submitting multiple transactions to the Stellar network within a given window of time.</p><h3>Channel Conclusions</h3><p>How can we achieve both high transaction rates and a logical separation of fees? Well, what if we found a way to combine the “channel pool” and “fee channel” approaches into the same solution? Imagine a channel pool stocked with ready-to-go channel accounts that could be used by any account, user, or tenant in our system. Similarly, for accounting purposes, each of these accounts/users/tenants would have a designated fee-paying account capable of reimbursing the fees for all operations submitted on their behalf. Each Stellar transaction would include both its standard business-logic operations as well as the corresponding reimbursement operation(s) — and yes, there could be multiple reimbursement operations per transaction if the transaction was being submitted on behalf of multiple operation source accounts. Once a transaction was submitted and successfully recorded on the ledger, the channel pool account’s sequence number would be higher but its balance would remain constant and would not need replenishing….so it could go immediately back into the pool, ready for its next use.</p><p>I am hoping to implement this hybrid “channel pooling + fee channel” solution in the near future, and if I do, I will attempt to follow up this article with a summary of my findings and conclusions. In the meantime, if you are developing Stellar applications, what channels-related issues have you encountered? I am always interested in hearing feedback and ideas from other developers working in this space.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b655a99d5ab3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>