<?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 Eric Saunders on Medium]]></title>
        <description><![CDATA[Stories by Eric Saunders on Medium]]></description>
        <link>https://medium.com/@ire_and_curses?source=rss-d13f33956247------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*AEmQPqpdRfdu2XmqpX6wdw.jpeg</url>
            <title>Stories by Eric Saunders on Medium</title>
            <link>https://medium.com/@ire_and_curses?source=rss-d13f33956247------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 00:45:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ire_and_curses/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A new Go SDK for the Stellar Network]]></title>
            <link>https://medium.com/stellar-developers-blog/a-new-go-sdk-for-the-stellar-network-7e6c590ebd3b?source=rss-d13f33956247------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e6c590ebd3b</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[stellar]]></category>
            <category><![CDATA[stellar-lumens]]></category>
            <dc:creator><![CDATA[Eric Saunders]]></dc:creator>
            <pubDate>Thu, 02 May 2019 20:51:06 GMT</pubDate>
            <atom:updated>2019-05-02T21:26:48.627Z</atom:updated>
            <content:encoded><![CDATA[<h3>A New Go SDK for the Stellar Network</h3><p>We’re pleased to announce the release of a new Go SDK for the <a href="https://www.stellar.org/">Stellar network</a>. Along with JavaScript and Java, this is the third official SDK supported by the Stellar Development Foundation (SDF).</p><p><a href="https://github.com/stellar/go/tree/master/clients/horizonclient">horizonclient</a> is a package that provides client access to a Stellar <a href="https://github.com/stellar/go/tree/master/services/horizon">Horizon</a> server. It allows you to retrieve ledger information, either as one-time calls or as a continuously updating stream. You can find account balances, check the status of a transaction, or monitor in real-time new offers for an issued token. You can also submit transactions! The client fully supports all the REST endpoints exposed by the <a href="https://www.stellar.org/developers/horizon/reference/index.html">Horizon API</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ced92624c6cf19860c043627f5df1222/href">https://medium.com/media/ced92624c6cf19860c043627f5df1222/href</a></iframe><p>A second package, <a href="https://github.com/stellar/go/tree/master/txnbuild">txnbuild</a>, supports the convenient construction of operations and transactions. These are the building blocks of change in the Stellar system; to make anything happen on the network requires submission of one or more operations, wrapped in a transaction.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bd820278d28f29e9d2efcdbac9f6ffa7/href">https://medium.com/media/bd820278d28f29e9d2efcdbac9f6ffa7/href</a></iframe><p>Transactions built with txnbuild can be easily submitted to any Horizon server for processing via horizonclient.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1ae7b3c4ff88937ce8bbf7990d5e43fb/href">https://medium.com/media/1ae7b3c4ff88937ce8bbf7990d5e43fb/href</a></iframe><p>When do you need each package? A general rule of thumb is that any action that changes the state of the Stellar ledger is built with txnbuild, while horizonclient typically retrieves information from the network. For most applications, you’ll likely need functionality from both packages.</p><h3>Why a new approach?</h3><p>We chose to rewrite the existing Go Horizon client because it needed significant additions, and a new structure (incorporating the best parts of the old client) was the best way to support that. For transaction building, the situation was more nuanced.</p><p>We approached this problem before with a library called build. This previous approach was very general, and undeniably elegant. But it was hard to grok. Unfortunately the <a href="https://godoc.org/github.com/stellar/go/build#CreateAccountBuilder">relevant GoDocs</a> are not your friend here:</p><blockquote>func (b *CreateAccountBuilder) Mutate(muts …interface{})<br>Mutate applies the provided mutators to this builder’s payment or operation.</blockquote><p>This is obscure, because both specific arguments and type information are abstracted away. For a new user, this is almost impossible to understand without an example (or consulting the library source).</p><p>So we decided to take another pass at the problem.</p><p>The official <a href="https://stellar.github.io/js-stellar-sdk/">JS</a> and <a href="https://stellar.github.io/java-stellar-sdk/">Java</a> SDKs use the <a href="https://en.wikipedia.org/wiki/Builder_pattern">builder pattern</a>. The builder pattern is particularly common in Java, because the constructor is so inflexible. Applying the pattern allows construction of the object to be decoupled from the object itself, and allows partial constructions without setting many constructors.</p><p>In Go, the pattern is less common, because i) you can do partial configuration by just setting struct fields, and ii) the pattern screws up Go’s error handling, since method chaining doesn’t play nicely with multiple return values.</p><p>The design philosophy we chose was to be efficient and minimise abstractions. We use expressive structs to make configuration as compact as possible.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4c0158f661a67be8d47c273ee42205a8/href">https://medium.com/media/4c0158f661a67be8d47c273ee42205a8/href</a></iframe><p>All struct fields are easily discoverable during coding. Optional arguments can be left out. Configuration can happen all at once during struct initialisation, or individual fields can be set later in the lifecycle of the object.</p><p>For more complex operations, where the underlying operation semantics allow create/update/delete behaviour, we provide simple factory helpers.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/18821a29641449e467f1de0df98b6622/href">https://medium.com/media/18821a29641449e467f1de0df98b6622/href</a></iframe><h3>Try it out</h3><p>If you’re interested in trying out the code, head to our GitHub repo and grab<br>the <a href="https://github.com/stellar/go/releases">latest release</a>. At our <a href="https://www.stellar.org/developers">developers site</a>, all the Stellar operations are summarised in a <a href="https://www.stellar.org/developers/guides/concepts/list-of-operations.html">handy reference</a>.</p><p>For a more in-depth look at the available functionality, check out the GoDocs<br>for <a href="https://godoc.org/github.com/stellar/go/clients/horizonclient">horizonclient</a> and <a href="https://godoc.org/github.com/stellar/go/txnbuild">txnbuild</a>. These contain many usage examples, including samples for all operations. If you’re ready to build something more involved, there a look at our more extensive command line <a href="https://github.com/stellar/go/tree/master/txnbuild/cmd/demo">demo</a>, which creates and destroys accounts on the Stellar <a href="https://www.stellar.org/developers/guides/concepts/test-net.html">Testnet</a>.</p><p>This library is under active development and we’d love your feedback! Please<br>report bugs and missing functionality <a href="https://github.com/stellar/go/issues">here</a>. For general questions about<br>this SDK, Horizon or other Stellar topics, the <a href="https://stellar.stackexchange.com/">Stellar Stack Exchange</a> is a great resource. Lastly, if you want to chat, join the community! You’ll find myself and other SDF developers hanging out in the <a href="https://keybase.io/team/stellar.public">stellar.public</a> team on Keybase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D7VDqsisoxDYRXQQ_6H0ow.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e6c590ebd3b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/stellar-developers-blog/a-new-go-sdk-for-the-stellar-network-7e6c590ebd3b">A new Go SDK for the Stellar Network</a> was originally published in <a href="https://medium.com/stellar-developers-blog">Stellar Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>