<?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 John Quarnstrom on Medium]]></title>
        <description><![CDATA[Stories by John Quarnstrom on Medium]]></description>
        <link>https://medium.com/@inveth?source=rss-3f82e3ca7617------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Ctr_Eiz0kCjinFsWCeALbA.jpeg</url>
            <title>Stories by John Quarnstrom on Medium</title>
            <link>https://medium.com/@inveth?source=rss-3f82e3ca7617------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 12:50:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@inveth/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[Ethereum Public Registry: Stablecoins]]></title>
            <link>https://medium.com/coinmonks/ethereum-public-registry-stablecoins-d4aa122573b9?source=rss-3f82e3ca7617------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4aa122573b9</guid>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[libraries]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <dc:creator><![CDATA[John Quarnstrom]]></dc:creator>
            <pubDate>Mon, 13 Aug 2018 00:02:42 GMT</pubDate>
            <atom:updated>2018-08-13T07:56:17.546Z</atom:updated>
            <content:encoded><![CDATA[<h4>Implementation of an Ethereum smart contract for simple and streamlined access to ERC20-Stablecoins (for developers).</h4><p>by John Quarnstrom</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*T3NiliS7A9sPwQV9.jpg" /><figcaption>Accessing decentralized information in a centralized registry.</figcaption></figure><p><strong>What are public registries?</strong></p><p>A centralized collection of information that is readily available to the public. In the case of Ethereum, developers would benefit from an extensive list of all available ERC20-Stablecoins which is a smart contract itself — this enables direct access of information through another smart contract.</p><p><strong>Why an Ethereum registry?</strong></p><p>An enhanced public registry provides direct access to the functionality of any desired smart contract — this makes developing and designing your own smart contracts easier, by nature of condensing functionality into a single line.</p><p>Developers often require three key pieces of information / functionality from any Stablecoin they are working with (assuming it’s ERC20 or ERC223).</p><ol><li><strong>The address of a Stablecoin smart contract.</strong> <em>This is the address that stores the balances of all parties and enables transfers or allowances.</em></li><li><strong>The balance of an address for that Stablecoin. </strong><em>This will enable certain logic implementations, in the case of payment processing.</em></li><li><strong>The transfer mechanism. </strong><em>This allows someone to send their Stablecoins to another party.</em></li></ol><p>Here is an example of the Stablecoin registry:</p><pre><strong>// State variable.</strong><br>mapping(bytes32 =&gt; address) public StablecoinRegistry;</pre><pre><br><strong>// Constructor.</strong><br>constructor StablecoinRegistry() public { ... }</pre><pre><br><strong>// Populate the registry.</strong><br>function addStablecoin(bytes32 _name, address _stablecoinAddress) {</pre><pre>    <strong>// Prevent overwrite.</strong><br>    require(StablecoinRegistry[_name] == 0x0);</pre><pre>    <strong>// Add address to mapping.</strong><br>    StablecoinRegistry[_name] = _stablecoinAddress;</pre><pre>}</pre><p>Once this contract is deployed on the network and populated with the addStablecoin( ) method by the Owner, anyone can access it as an interface.</p><p>A short example on using this smart contract registry is below.<br><em>We assume the previous contract was deployed at 0x123 for simplicity.</em></p><pre><strong>// Interface for ERC20 contract.</strong><br>contract ERC20 {<br>  <strong>function</strong> balanceOf(address tokenOwner) returns (uint balance);<br>  <strong>function</strong> transfer(address to, uint tokens) returns (bool success);<br>}<br></pre><pre><strong>// Example contract (some code omitted).</strong><br>contract Example {</pre><pre>  <strong>// State variable.</strong><br>  address public Registry = 0x123;</pre><pre>  <strong>// Constructor.</strong><br>  constructor PaymentManagement() public { ... }</pre><pre>  <strong>// Feature 1 - Balance<br>  </strong>function returnBalance(address _user, bytes32 _contract) {<br>      ERC20 = ERC20( Registry.StabelcoinRegistry[_contract] );<br>      return ERC20.balanceOf(_user);<br>  }</pre><pre><strong>  // Feature 2 - Transfer<br>  </strong>function transferTo(address _user, bytes32 _contract, uint _amt) {<br>      ERC20 = ERC20( Registry.StabelcoinRegistry[_contract] );<br>      return ERC20.transfer(_user, _amt);<br>  }</pre><pre>}</pre><p>Again — the key here is building a library that all developers across the network can access. Arguably, having a public registry for all ERC20 tokens and not just Stablecoins would prove valuable if a trustworthy party can maintain the authenticity and relevancy of its data.</p><p>Remember that the transfer function above will only transfer tokens that are held within the smart contract itself (for escrow purposes). Unless the smart contract you issue specifically has an allowance within the main Stablecoin smart contract, it will not be able to transfer tokens for other users.</p><blockquote><strong>John Quarnstrom</strong><br>www.inveth.io (Temporarily Offline)</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4aa122573b9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/ethereum-public-registry-stablecoins-d4aa122573b9">Ethereum Public Registry: Stablecoins</a> was originally published in <a href="https://medium.com/coinmonks">Coinmonks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Solidity and Prime Numbers]]></title>
            <link>https://medium.com/coinmonks/solidity-and-prime-numbers-2fe5dad33d4a?source=rss-3f82e3ca7617------2</link>
            <guid isPermaLink="false">https://medium.com/p/2fe5dad33d4a</guid>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[solidity]]></category>
            <dc:creator><![CDATA[John Quarnstrom]]></dc:creator>
            <pubDate>Sun, 12 Aug 2018 21:32:48 GMT</pubDate>
            <atom:updated>2018-08-13T05:56:51.378Z</atom:updated>
            <content:encoded><![CDATA[<h4>A thought experiment in reducing parameters passed through the constructor of an Ethereum smart contract.</h4><p>by John Quarnstrom</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*k_Um12LpQyZdNsyE.jpg" /></figure><p>Let’s imagine we are writing a “factory” smart contract — one that will act as a blueprint for issuing hundreds of other, unique contracts. We intend to manage payment preferences through these contracts, as they will accept one or more Stablecoins as “payment” for the contract’s specific use-case.</p><p><strong>Challenge: </strong>Users have different preferences — some will accept DAI or Tether, others will accept TrueUSD and DAI, and some will <em>only </em>accept Basis.</p><p>How can we manage all of these preferences in a seamless way through the constructor function? For this example, let’s assume there are five different Stablecoins that merchants/traders/whoever want to accept.</p><p><strong>Option #1 </strong>(Lame) — Pass through five different boolean parameters in the construction function and assign them to individual boolean variables:</p><pre><em>constructor (bool _dai, bool _trueusd, bool _tether, ... ) {</em></pre><pre><em>    DAI_Accepted = _dai;</em></pre><pre><em>    TrueUSD_Accepted = _trueusd;</em></pre><pre><em>   Tether_Accepted = _tether;</em></pre><pre><em>}</em></pre><p>This option is acceptable. We can use modifiers to check whether the state variables (e.g. DAI_Accepted) are true or not when accepting payments.</p><p>Is there an easier way, that doesn’t require passing through 5+ parameters?<br><em>Yes.</em></p><p><strong>Option #2 </strong>(Cool) — Pass through one uint that is a multiple of prime numbers corresponding to a truth table.</p><p>Let’s imagine we have five different stablecoins:<br><strong>DAI</strong>, <strong>TrueUSD</strong>, <strong>Tether</strong>, <strong>Basis</strong>, and <strong>Haven </strong>(Havven?)</p><p>Instead of passing five boolean parameters, let’s create a binary truth table that utilizes sequences of 1’s and 0’s which result in multiplication of a prime number to create one unique <strong>uint</strong> that will store the payment preferences of that specific smart contract.</p><p>This would be a sequence of 5 1’s and 0’s, resulting in 2⁵ combinations (32), as written in the table below. The first position on the left represents DAI and whether or not the smart contract will accept it (0 = No, 1 = Yes). The second position represents TrueUSD, and so forth.</p><p>The very top column represents the prime number which we will multiply to acquire the final “Payment Preference” number on the right. Whether this number is part of our equation or not is determined by the corresponding 0/1.</p><pre><strong><em>DAI — TrueUSD — Tether — Basis — Haven</em></strong></pre><pre><strong>3–5–7–11–13</strong></pre><pre>0–0–0–0–0 = <strong>2</strong> … no Stablecoin accepted<br>0–0–0–0–1 = <strong>13 </strong>… only Haven accepted<br>0–0–0–1–0 = <strong>11</strong> … only Basis accepted<br>0–0–0–1–1 = <strong>143</strong><br>0–0–1–0–0 = <strong>7</strong> … only Tether accepted<br>0–0–1–0–1 = <strong>91</strong><br>0–0–1–1–0 = <strong>77</strong><br>0–0–1–1–1 = <strong>1,001</strong><br>0–1–0–0–0 = <strong>5</strong> … only TrueUSD accepted<br>0–1–0–0–1 = <strong>65</strong><br>0–1–0–1–0 = <strong>55</strong><br>0–1–0–1–1 = <strong>715</strong><br>0–1–1–0–0 = <strong>35</strong><br>0–1–1–0–1 = <strong>455</strong><br>0–1–1–1–0 = <strong>385</strong><br>0–1–1–1–1 = <strong>5,005</strong><br>1–0–0–0–0 = <strong>3</strong> … only DAI accepted<br>1–0–0–0–1 = <strong>39</strong><br>1–0–0–1–0 = <strong>33</strong><br>1–0–0–1–1 = <strong>429</strong><br>1–0–1–0–0 = <strong>21</strong><br>1–0–1–0–1 = <strong>273</strong><br>1–0–1–1–0 = <strong>231</strong><br>1–0–1–1–1 = <strong>3,003</strong><br>1–1–0–0–0 = <strong>15</strong> … only DAI &amp; TrueUSD accepted (my preference!)<br>1–1–0–0–1 = <strong>195</strong><br>1–1–0–1–0 = <strong>165</strong><br>1–1–0–1–1 = <strong>2,145</strong><br>1–1–1–0–0 = <strong>105</strong><br>1–1–1–0–1 = <strong>1,365</strong><br>1–1–1–1–0 = <strong>1,155</strong><br>1–1–1–1–1 = <strong>15,015</strong> … all stablecoins accepted</pre><p>The resulting number on the right can be referenced later using modulo calculations within modifiers.</p><p>Let’s imagine a unique financial contract that accepts a stablecoin in return for releasing the escrowed funds (Ethereum, ERC20 Tokens, ERC721 Trinkets). These funds are already present within the contract, and we are assuming there is one unique buyer who will receive the funds (public address Buyer).</p><pre>// Contract is initialized with _paymentMethod = 15, then stored in the Payment_Preference variable. This will enable payments of either DAI or TrueUSD.</pre><pre>constructor (uint _paymentMethod) {<br>    Payment_Preference = _paymentMethod;<br>}<br></pre><pre>// A modifier to determine if payment is valid.</pre><pre>modifier isValid(uint _mod) {<br>    require( (Payment_Preference % _mod) == 0);<br>    _;<br>}<br></pre><pre>// A set of functions to initiate payment acceptance.</pre><pre>function acceptDAI()     isValid(3) { ... }<br>function acceptTrueUSD() isValid(5) { ... }<br>function acceptTether()  isValid(7) { ... }<br>function acceptBasis()   isValid(11) { ... }<br>function acceptHaven()   isValid(13) { ... }</pre><p>The next step would be to modularize payment acceptance functions, condensing all functions of the form accept&lt;Stablecoin&gt;() into a single modular function that accesses a key:value pair structure corresponding to the Stablecoin and prime number used for division.</p><p>Does this optimize our gas costs? <em>Maybe — it could potentially increase them.</em></p><p>Can this lead to more modularity in our code? <em>Definitely.</em></p><p>Ultimately, this is a method I’m experimenting with to reduce the number of arguments passed through a constructor function. It could lead to more useful applications as other mechanisms are introduced to a smart contract.</p><blockquote><strong>John Quarnstrom</strong><br>www.inveth.io (Temporarily Offline)</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2fe5dad33d4a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/solidity-and-prime-numbers-2fe5dad33d4a">Solidity and Prime Numbers</a> was originally published in <a href="https://medium.com/coinmonks">Coinmonks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Inveth — March Update]]></title>
            <link>https://medium.com/inveth/inveth-march-update-731b605195f8?source=rss-3f82e3ca7617------2</link>
            <guid isPermaLink="false">https://medium.com/p/731b605195f8</guid>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[John Quarnstrom]]></dc:creator>
            <pubDate>Sun, 25 Mar 2018 03:58:48 GMT</pubDate>
            <atom:updated>2018-03-25T07:42:26.580Z</atom:updated>
            <content:encoded><![CDATA[<p>Inveth is now developing Smart Contracts for call and put options.</p><p>The ERC50 protocol will facilitate call options.<br>The ERC51 protocol will facilitate put options.</p><p>These two new financial instruments will allow cryptocurrency holders to hedge their assets during volatile markets. Each protocol allows decentralized users to trade options on Ethereum, ERC20 &amp; ERC223 tokens, and ownership of ERC721 contracts.</p><p>If you are unfamiliar with options, they are simply financial contracts that give the buyer the right to buy or sell an underlying asset at a fixed rate, sometime in the future. Here are two examples:</p><p><strong>Call Option</strong>, <em>Vanilla</em><strong><br></strong>The right to buy 10 ETH @ 600 DAI anytime over the next two weeks.</p><p><strong>Put Option</strong>, <em>European</em><strong><br></strong>The right to sell 500 NEO @ 5 DAI, in exactly four weeks.</p><p>For each option, there are two sides: The seller and the buyer. The seller is responsible for creating the contract, the buyer is allowed to purchase it.</p><p><strong>Use-Cases</strong><br>Inveth is targetting a few groups that will benefit greatly from these new financial instruments. The first group are commercial miners that have difficulty locking in fixed rates for their profits. The second group are retail clients that accept cryptocurrency payments, and need a way to hedge their holdings against market swings. The third group are high net-worth clients or institutions that are looking to speculate against market swings.</p><p><strong>Registration<br></strong>Inveth will offer early registration for users that meet certain requirements. We will release more information on who is eligible over the next few weeks. If you are interested in learning more, contact us.</p><p><em>John Quarnstrom<br>founder@inveth.io</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=731b605195f8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/inveth/inveth-march-update-731b605195f8">Inveth — March Update</a> was originally published in <a href="https://medium.com/inveth">Inveth</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Inveth — Introducing Ethereum Forwards]]></title>
            <link>https://medium.com/inveth/inveth-introducing-ethereum-forwards-9a8d970b2679?source=rss-3f82e3ca7617------2</link>
            <guid isPermaLink="false">https://medium.com/p/9a8d970b2679</guid>
            <category><![CDATA[lamden]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[inveth]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[crypto]]></category>
            <dc:creator><![CDATA[John Quarnstrom]]></dc:creator>
            <pubDate>Wed, 31 Jan 2018 22:56:29 GMT</pubDate>
            <atom:updated>2018-01-31T22:59:56.175Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/663/1*p-27N0PFVfCFIondRWobmg.jpeg" /><figcaption>Visit our official website at <a href="http://www.inveth.io/">www.inveth.io</a></figcaption></figure><p>The Ethereum community is ready for forwards, a unique way of trading and exchanging their Ethereum and ERC20 tokens.</p><p><strong>What are forwards?</strong></p><p>Traditionally, forwards are customized agreements between two parties to exchange goods at a fixed rate in the future. <em>In the context of cryptocurrencies, </em>forwards take on a whole new role.</p><p>Businesses that derive utility from coins, as well as traders, often find themselves in a position where trading large quantities of coins <strong>drastically affects the exchange-rate</strong> across various exchanges. In order for someone to manage expenses and/or lock in profits, they can utilize forwards.</p><p><strong>What is an example</strong>?</p><p>Thomas sends 5 ETH into a forward contract, requesting 10,000 PRL (ERC20) — this contract remains active for exactly 24 hours. When creating the forward Smart Contract, Thomas specifies the settlement date is 2 weeks.</p><p>John, looking to liquidate his PRL for a fixed rate, would then send his PRL to the same forward contract. In exactly two weeks, the contract would settle and Thomas could claim 10,000 PRL and John could claim 5 ETH.</p><p><strong>“Interesting … is there more functionality than that?”</strong></p><p>Yes! We are exploring more functionality and flexibility within forward contracts to ensure traders have more options.</p><p>One elegant improvement to a forward contract, is enabling either side to liquidate their position by selling ownership. In the previous example, John may want to exit his position one week into the two week contract.</p><p>To do this, he would enable liquidation of the Smart Contract, enabling an outside buyer to purchase the contract for the current market-rate of ETH (<em>given that John would receive 5 ETH in one week, and not PRL</em>). If an outside party buys the forward contract, John would receive their purchase price, and the new party would have the ability to claim 5 ETH in one week’s time.</p><p><strong>Development Status</strong></p><p>Wireframe: Completed, minor adjustments needed.</p><p>Smart Contracts: Advanced design in progress, basic forward contract ready for deployment to test-net. In contact with multiple auditing companies.</p><p>Front-End: Smart Contract event listener developed, tracking of deployed Smart Contracts in progress.</p><h3>Announcing Lamden &amp; Inveth Parternship</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*4nhJod_wBSzMqrkNZhi8tg.png" /><figcaption>Lamden’s atomic cross-chain swap protocol, Clove, will substantially improve Inveth’s capabilities.</figcaption></figure><p>Inveth is proud to announce a strategic partnership with Lamden. Stu, the mastermind and CEO of Lamden, has an extraordinary vision for the development of Clove — an atomic cross-chain swap protocol.</p><p>Clove has numerous applications for forwards, and will prove immeasurably helpful when expanding upon the current capabilities of Ethereum forwards. We look forward to working hand-in-hand with Lamden to bring businesses and traders new opportunities within the cryptocurrency landscape.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9a8d970b2679" width="1" height="1" alt=""><hr><p><a href="https://medium.com/inveth/inveth-introducing-ethereum-forwards-9a8d970b2679">Inveth — Introducing Ethereum Forwards</a> was originally published in <a href="https://medium.com/inveth">Inveth</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>