<?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 Simon Hutchison on Medium]]></title>
        <description><![CDATA[Stories by Simon Hutchison on Medium]]></description>
        <link>https://medium.com/@hutch120?source=rss-9326360ecf73------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*4ifx_q8UZPa2K2HOfRD38A.jpeg</url>
            <title>Stories by Simon Hutchison on Medium</title>
            <link>https://medium.com/@hutch120?source=rss-9326360ecf73------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 05:29:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hutch120/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[Bowline Knots]]></title>
            <link>https://medium.com/@hutch120/bowline-knots-f977066a4054?source=rss-9326360ecf73------2</link>
            <guid isPermaLink="false">https://medium.com/p/f977066a4054</guid>
            <dc:creator><![CDATA[Simon Hutchison]]></dc:creator>
            <pubDate>Fri, 09 Dec 2022 22:10:07 GMT</pubDate>
            <atom:updated>2022-12-09T22:10:07.219Z</atom:updated>
            <content:encoded><![CDATA[<p>A loud bang, and flapping headsail informed us that our starboard side headsheet had snapped. With waves on the bay over 1 1/2 meters that evening, and winds gusting to 30 knots it wasn’t totally unexpected.</p><p>Our experienced crew knew the drill, an immediate action to tack in order to maintain our speed and get the headsail trimmed on a starboard tack.</p><p>Once we got the boat back up to full speed, we needed to replace the headsheet in the bucking swell. This is where preparation is key, while rigging the boat, we use a bowline knot to attach the sheet to the headsail.</p><p>What is a bowline knot? The bowline knot is a very useful knot to know for sailors because it is strong and secure. The bowline knot forms a fixed loop at the end of a rope, which makes it perfect for situations where you need to tie a rope to a fixed object such as a sail. Additionally, the bowline knot is easy to untie even after it has been heavily loaded, which is important when you need to quickly release a line in an emergency situation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*BOMm6gK-dBjY1vEohHej9w.png" /></figure><p>To untie a bowline knot, first hold the standing end of the rope in one hand and the loop of the knot in the other hand. Then, gently pull the loop open to loosen the knot. Once the knot is loosened, you can slide it off the end of the rope. It may help to shake the rope to loosen the knot further.</p><p>So, armed with that knowledge, it was just a matter of calmly working though the steps to replace the sheet and get back on port tack and continue racing!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f977066a4054" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Test Driven Development of Web3 Smart Contracts with Reach and Jest]]></title>
            <link>https://medium.com/polynize/test-driven-development-of-web3-smart-contracts-with-reach-and-jest-46ab75e1aaf0?source=rss-9326360ecf73------2</link>
            <guid isPermaLink="false">https://medium.com/p/46ab75e1aaf0</guid>
            <category><![CDATA[test-driven-development]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[reach]]></category>
            <category><![CDATA[algorand]]></category>
            <dc:creator><![CDATA[Simon Hutchison]]></dc:creator>
            <pubDate>Tue, 30 Nov 2021 21:16:58 GMT</pubDate>
            <atom:updated>2021-11-30T23:18:13.544Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G4Pjzbvkh9WQlyNVm7R2rQ.png" /></figure><p>Building software is much more than just understanding an <a href="https://en.wikipedia.org/wiki/Software_development_kit">SDK</a>. Effective engineering requires us to constantly evolve our tools and utilise existing resources to develop the next generation of software.</p><p>This article demonstrates how to setup an efficient <a href="https://en.wikipedia.org/wiki/Test-driven_development">TDD</a> cycle with a local <a href="https://www.algorand.com/">Algorand</a> node, using the <a href="https://docs.reach.sh/ref-install.html">Reach client tools</a>, and utilise <a href="https://jestjs.io/">Jest</a> to iterate over <a href="https://en.wikipedia.org/wiki/Smart_contract">smart contract</a> development locally before moving to <a href="https://testnet.algoexplorer.io/">TestNet</a> and ultimately <a href="https://algoexplorer.io/">MainNet</a>.</p><p>If you haven’t done so already, you should review my <a href="https://medium.com/polynize/aws-integration-to-algorand-blockchain-using-reach-bd80e32c057f">first article</a> about getting setup with Reach. Additionally, if you are not familiar with <a href="https://en.wikipedia.org/wiki/Test-driven_development">TDD</a> then I recommend heading over to the <a href="https://jestjs.io/">Jest website</a> and checking out their testing toolset.</p><p>In the <a href="https://medium.com/polynize/aws-integration-to-algorand-blockchain-using-reach-bd80e32c057f">first article</a> we examined how the <a href="https://github.com/reach-sh/reach-lang">Reach SDK</a> provides a wrapper for interaction with Blockchain technologies like Algorand. We probed the account details and retrieved the balance of an account, now we extend that example to use the real power of Reach that enables us to build, deploy and interact with <a href="https://en.wikipedia.org/wiki/Smart_contract">Smart Contracts</a>.</p><p>This article will look at how to use <a href="https://en.wikipedia.org/wiki/Test-driven_development">TDD</a> to test a smart contract that will transfer a variable amount between two <a href="https://docs.reach.sh/ref-model.html#%28tech._participant%29">Participants</a>, and charge a flat rate platform fee.</p><h3>Setup the environment</h3><ul><li>Download the <a href="https://github.com/Polynize/aws-algorand-reach-poc/releases/tag/test-driven-development-of-web3-smart-contracts-with-reach-and-jest">tagged repo</a> for this article</li><li>Open the <a href="https://github.com/Polynize/aws-algorand-reach-poc/releases/tag/test-driven-development-of-web3-smart-contracts-with-reach-and-jest">repo</a> in VSCode</li><li>If running in Windows, make sure the folder is open in WSL/Ubuntu mode.</li><li>Copy the file secrets_template.js to secrets.js fill it in with valid account phrases.</li><li>Ensure package.json has <a href="https://www.npmjs.com/package/@reach-sh/stdlib?activeTab=versions">latest reach stdlib version</a> (<a href="https://github.com/raineorshine/npm-check-updates">ncu</a> can help)</li><li>Open a VSCode terminal</li><li>Load package dependencies</li></ul><pre>yarn install</pre><ul><li>Install the latest <a href="https://docs.reach.sh/ref-install.html">Reach Cli</a> tools in the root folder.</li></ul><pre>curl <a href="https://docs.reach.sh/reach">https://docs.reach.sh/reach</a> -o reach ; chmod +x reach</pre><h3>Create a local Algorand node</h3><p>These commands create docker instances using the Reach client tools.</p><pre>export REACH_CONNECTOR_MODE=ALGO<br>./reach down<br>./reach update<br>./reach upgrade<br>./reach devnet</pre><p>If you encounter issues, checkout the <a href="https://docs.reach.sh/ref-usage.html">Reach doco</a>, and if you are really stuck jump onto <a href="https://discord.com/invite/AZsgcXu">Discord</a> and ask for some assistance.</p><p>When the command completes you should see a bunch of log messages on the screen. You now have a local Algorand node running on you PC, well done! Leave that terminal open, and open a new terminal (plus button on the right).</p><h3>Compile the smart contract</h3><p>We need to compile the smart contract before we can run the tests. Reach client tools provides a command. ./reach compile [somefile.rsh] I have wrapped that command and added some additional arguments into a yarn script in package.json which I will break down further below. For now, just run this command to build the Reach smart contract.</p><pre>yarn reach:build:transfer</pre><p>Two files will be created.</p><ul><li>/src/transfer/build/transfer.main.mjs</li><li>/src/transfer/build/transfer.cjs.js</li></ul><p>The first file is generated by the Reach compiler. The second file is generated from the first using the Babel parser. It wraps the bindings in CJS format so it can be used directly in a node application with require syntax. See package.json for more information on the Babel command syntax, and if you are interested, see <a href="https://irian.to/blogs/what-are-cjs-amd-umd-and-esm-in-javascript/">the differences between mjs and cjs</a>.</p><p>Ok, you are now ready to run a smart contract on the Algorand testnet! Running the following command will start the test run from /src/routes/Routes.test.js</p><pre>yarn test</pre><p>You should see output similar to this</p><pre>{<br>  success: true,<br>  data: {<br>    platformFee: 1,<br>    transferAmount: 5,<br>    beforePlatformBalance: 10,<br>    beforeSenderBalance: 10,<br>    beforeReceiverBalance: 10,<br>    afterPlatformBalance: 10.999,<br>    afterSenderBalance: 4.996,<br>    afterReceiverBalance: 13.995<br>  },<br>  error: &#39;&#39;,<br>  message: &#39;Transfer success&#39;,<br>  statusCode: 200<br>}<br>Test Suites: 1 passed, 1 total</pre><p>You can see from the output that the Platform fee is 1, the transfer amount is 5 and everyone started with 10 tokens. The Sender transferred 5 tokens to the Receiver and the Receiver transferred 1 token to the Platform (and the network used some gas).</p><p>If you got here, awesome, you just ran your first smart contract!</p><p>The Reach smart contract source file is here/src/transfer/transfer.rsh If you want to learn more about how this works please checkout the <a href="https://docs.reach.sh/">Reach docs</a>.</p><pre>&#39;reach 0.1&#39;<br>&#39;use strict&#39;<br>export const main = Reach.App(() =&gt; { <br> const Platform = Participant(&#39;Platform&#39;, {<br>   getParams: Fun([],  Object({ platformFee: UInt }))})<br> const Sender = Participant(&#39;Sender&#39;, { <br>   getParams: Fun([], Object({  transferAmount: UInt }))})<br> const Receiver = Participant(&#39;Receiver&#39;, {})<br> deploy()<br> Sender.only(() =&gt; { const { transferAmount } =<br>   declassify(interact.getParams())})<br> Platform.only(() =&gt; { const { platformFee } = <br>   declassify(interact.getParams())})<br> Sender.publish(transferAmount).pay(transferAmount)<br> commit() <br> Platform.publish(platformFee)<br> commit()<br> Receiver.publish().pay(platformFee)<br> transfer(transferAmount).to(Receiver)<br> transfer(platformFee).to(Platform)<br> commit()<br> exit()<br>})</pre><p>If you want to adapt this for TestNet, update the file /src/utils/Reach.js to run on TestNet and to run the tests set the fundOnDevnet flag to false in/src/routes/Routes.test.js and fund the accounts using the <a href="https://testnet.algoexplorer.io/dispenser">dispenser</a>. Note accounts with zero balance cannot participate in contracts, so make sure to fund all three accounts. I’ve also added a <a href="https://github.com/Polynize/aws-algorand-reach-poc/releases/tag/testnet-test-driven-development-of-web3">release on Github for Testnet</a> with these changes incorporated.</p><p>If you got this far, then welcome to the club. I’ve been hanging out with the Reach.sh community so, please come over to the <a href="https://discord.com/invite/AZsgcXu">discord channel</a> and say hi!</p><p><em>We’re only just getting started building a bridge between Web2 &lt;-&gt; Web3. Plenty more to come! If you’re sparked by this, please </em><a href="/service/mailto:contact@polynize.com"><em>drop us a line</em></a><em>!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=46ab75e1aaf0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/polynize/test-driven-development-of-web3-smart-contracts-with-reach-and-jest-46ab75e1aaf0">Test Driven Development of Web3 Smart Contracts with Reach and Jest</a> was originally published in <a href="https://medium.com/polynize">Polynize</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS integration to Algorand Blockchain using Reach]]></title>
            <link>https://medium.com/polynize/aws-integration-to-algorand-blockchain-using-reach-bd80e32c057f?source=rss-9326360ecf73------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd80e32c057f</guid>
            <category><![CDATA[reach]]></category>
            <category><![CDATA[algorand]]></category>
            <category><![CDATA[integration]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Simon Hutchison]]></dc:creator>
            <pubDate>Mon, 15 Nov 2021 05:50:41 GMT</pubDate>
            <atom:updated>2021-11-29T22:49:55.369Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1DTiz8ZRtc66cntU7l6tOA.png" /></figure><p>As a Software Engineer my background has been developing <a href="https://en.wikipedia.org/wiki/Web_2.0">Web2</a> with AWS, HTTP APIs, and so on. <a href="https://en.wikipedia.org/wiki/Web3">Web3</a> is exciting because it empowers us to build <a href="https://en.wikipedia.org/wiki/Economics">economics</a> right into our products and services rather than integrating something like a payment gateway as an afterthought.</p><p>Today developers and end users are intimately familiar with Web2 and whatever your opinion about <a href="https://developer.algorand.org/docs/get-started/dapps/">DApps</a> vs Apps, we are going to need <strong>bridges </strong>to get from Web2 to Web3. <strong>Technically </strong>we need to transform<strong> </strong>data from existing services like cloud databases, APIs and messaging. <strong>Socially</strong>, adoption of Web3 is going to be much smoother if we can adapt and transform existing services over time rather than attempt to migrate customers who honestly don’t care about Web3 but do care about simplicity and ease of use.</p><p>The following article is a primer with code that demonstrates a basic integration between <strong>AWS </strong>API Gateway/Lambda via <strong>Serverless.com</strong> deployment, and <strong>Algorand </strong>via the blockchain development platform <a href="https://reach.sh/"><strong>Reach.sh</strong></a><strong> </strong>The goal is to be able to interact with the Algorand blockchain via a HTTPS API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/1*DcfARXol0hwSNaHxQGA6tA.png" /><figcaption>Balance of an Algorand account</figcaption></figure><p>The rest of the article is going to break down the major parts of the <a href="https://github.com/Polynize/aws-algorand-reach-poc/releases/tag/aws-integration-to-algorand-blockchain-using-reach">Github repo</a> I’ve written to explain this topic in code and some notes about how to configure and deploy this yourself.</p><h3><strong>Routes.js</strong></h3><p><strong>./src/routes/Routes.js</strong> should be familiar to anyone who has written an Express app, so far we are in Web2 territory.</p><pre>server.post(&#39;/account/phrase/balance&#39;, async (req, res) =&gt; await ret({ res, req, func: AlgoRoutes.getBalance }))</pre><p>The POST endpoint takes a Algorand Wallet account phrase and will return the balance of the account from the Algorand blockchain. Note that we only needed the account address to get the balance, however, as a demo it demonstrates the ability to setup a framework to transact on the Blockchain on behalf of the account.</p><h3>Reach.js</h3><p><strong>./src/account/Reach.js</strong> Setup the reach SDK to connect to the Algorand.</p><pre>const loadStdlib = require(&#39;@reach-sh/stdlib&#39;).loadStdlib<br>const reach = loadStdlib({ ...process.env, REACH_CONNECTOR_MODE: &#39;ALGO&#39; })<br>reach.setProviderByName(&#39;TestNet&#39;)</pre><p>Sets Algorand blockchain as the consensus network to use, and sets the provider to Testnet.</p><h3><strong>Account.js</strong></h3><p><strong>./src/account/Account.js</strong> is where we dive into the Reach SDK and Web3!</p><pre>acc = await reach.newAccountFromMnemonic(phrase)</pre><p>Returns a Promise for a Reach <a href="https://docs.reach.sh/ref-model.html#%28tech._account%29">account</a> abstraction for an <a href="https://docs.reach.sh/ref-model.html#%28tech._account%29">account</a> on the <a href="https://docs.reach.sh/ref-model.html#%28tech._consensus._network%29">consensus network</a> specified by the given mnemonic phrase.</p><pre>const balance = await reach.balanceOf(acc)</pre><p>Returns a Promise for the balance of <a href="https://docs.reach.sh/ref-model.html#%28tech._network._token%29">network tokens</a> (or <a href="https://docs.reach.sh/ref-model.html#%28tech._non._network._token%29">non-network tokens</a> if token is provided) held by the <a href="https://docs.reach.sh/ref-model.html#%28tech._account%29">account</a> given by a Reach <a href="https://docs.reach.sh/ref-model.html#%28tech._account%29">account</a> abstraction provided by the acc argument.</p><h3>Environment Setup</h3><p>To develop using Reach.sh you will need to setup your coding environment. This is somewhat onerous if you are developing on Windows, less so I expect if you are on Linux/Mac. I work primarily on Windows, but have a pretty decent understanding of Linux/Ubuntu which was helpful.</p><p>If you are on Windows, then start by following <a href="https://docs.reach.sh/guide-windows.html">this guide</a> to get your windows system setup with WSL and associated libraries.</p><p>Clone the <a href="https://github.com/Polynize/aws-algorand-reach-poc/releases/tag/aws-integration-to-algorand-blockchain-using-reach">repo </a>and open in <a href="https://code.visualstudio.com/">VSCode</a>. Check project is running in WSL:Ubuntu (Green area at bottom left in VSCode) If not, run in WSL:Ubuntu (click green area and select reopen folder in WSL)</p><p>You will also have to install some additional tooling in Ubuntu to get going, it’s not too bad install <a href="https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-20-04">NodeJS</a>, <a href="https://linuxize.com/post/how-to-install-yarn-on-ubuntu-20-04/">Yarn</a> to start with.</p><p>From the root <a href="https://github.com/Polynize/aws-algorand-reach-poc/releases/tag/aws-integration-to-algorand-blockchain-using-reach">repo</a> directory run <strong>yarn</strong> it will likely fail with errors about missing libraries. Investigate the error messages for missing libraries and basically run <strong>sudo apt install [missing library] </strong>until yarn works.</p><h3>App setup</h3><p>Create an Algorand account using the <a href="https://www.algorandwallet.com/">Algorand Wallet App</a> and fund the account using the <a href="https://testnet.algoexplorer.io/dispenser">dispenser</a>.</p><p>Copy <strong>./src/secrets_template.js</strong> to <strong>./src/secrets.js</strong> and add the Algorand account details to that file. Yes, type in the long phrase shown on your phone. Note the file secrets.js is in <strong>.gitignore</strong> because you should never put account details in code.</p><h3>Testing</h3><p>Run tests by running <strong>yarn test</strong></p><h3>Deploy</h3><p>If you are familiar with Serverless.com then you will recognise <strong>./</strong><a href="https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml/"><strong>serverless.yaml</strong></a><strong> </strong>file. If you are familiar with Github actions you will recognise <a href="https://github.com/features/actions">github actions</a> <strong>.github/workflows/deploy.yml</strong></p><p>Log into Serverless.com. Create a serverless.com app and copy the name from ./serverless.yml for the org/app/service values. Link with your AWS account. Create a serverless.com access key and save it to Github actions as SERVERLESS_ACCESS_KEY</p><h3>Github setup</h3><p>Add secrets</p><pre>ALICE_ACCOUNT_PHRASE<br>SERVERLESS_ACCESS_KEY</pre><p>Now you can check in your code and the deploy process should create your own API endpoint in AWS.</p><p>If you got this far, then welcome to the club. I’ve been hanging out with the Reach.sh community so, please come over to the <a href="https://discord.com/invite/AZsgcXu">discord channel</a> and say hi!</p><p><em>We’re only just getting started building a bridge between Web2 &lt;-&gt; Web3. Plenty more to come! If you’re sparked by this, please </em><a href="/service/mailto:contact@polynize.com"><em>drop us a line</em></a><em>!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd80e32c057f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/polynize/aws-integration-to-algorand-blockchain-using-reach-bd80e32c057f">AWS integration to Algorand Blockchain using Reach</a> was originally published in <a href="https://medium.com/polynize">Polynize</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>