<?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 Lukas Lukac on Medium]]></title>
        <description><![CDATA[Stories by Lukas Lukac on Medium]]></description>
        <link>https://medium.com/@lukas.lukac?source=rss-3ce678da9bb7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ewAaVLWd7qxz58zIVjDIEA.jpeg</url>
            <title>Stories by Lukas Lukac on Medium</title>
            <link>https://medium.com/@lukas.lukac?source=rss-3ce678da9bb7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 11:30:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@lukas.lukac/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[How DApp users can interact with your Smart Contracts with ZERO ETH]]></title>
            <link>https://medium.com/coinmonks/how-dapp-users-can-interact-with-your-smart-contracts-with-zero-eth-d0b664b355ce?source=rss-3ce678da9bb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0b664b355ce</guid>
            <category><![CDATA[meta-transactions]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[solidity]]></category>
            <dc:creator><![CDATA[Lukas Lukac]]></dc:creator>
            <pubDate>Mon, 23 Sep 2019 07:50:22 GMT</pubDate>
            <atom:updated>2020-08-26T11:29:58.566Z</atom:updated>
            <content:encoded><![CDATA[<h4>Your blockchain users shouldn’t have to pay for your infrastructure if you want mainstream adoption.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rPVk9s0UyrlxTOZvfLKXZQ.png" /><figcaption>Lightstreams RelayServer on Sirius Test Network</figcaption></figure><p>The problem is well known. In order to perform a transfer transaction or interact with a specific application smart contract, you need to pay the infrastructure cost (gas) in Ether. No user, especially new to the blockchain ecosystem, is going to be willing to do so. There is a reason why FREEMIUM model is so widely implemented in the current Web2 stack. Taste before you buy.</p><p>In this article, you will learn how to pay transactions on behalf of your users by implementing a <strong>new Ethereum concept called GSN into your DApp in 5 steps.</strong></p><h3>Gas Station Network</h3><p>GSN is a concept designed and developed by a cyber security firm <a href="https://www.tabookey.com/">TabooKey</a>. TabooKey submitted an official <a href="https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1613.md">EIP-1613</a> design draft in December 2018.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*wO8eqrFNoX2vCi3UV_nCgA.png" /><figcaption>src: <a href="https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1613.md">https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1613.md</a></figcaption></figure><p>Complicated?</p><p>No worries. The concept was later adopted and enhanced by established Ethereum auditing company <a href="https://openzeppelin.com/">OpenZeppelin</a> (OZ) who developed a friendly set of JS helper tools to ease the GSN usage.</p><h4>STEP 0: Choose your Ethereum-compatible blockchain network</h4><p>I will demonstrate the usage on <a href="https://github.com/lightstreams-network/lightchain">Lightstream’s PoA Ethereum compatible blockchain</a> powered by Tendermint consensus.</p><p>Why?</p><ul><li>Addressing gas issues is just part of the solution. Mainstream apps need to be responsive. Ethereum’s 15s blocks without a guarantee a TX won’t be reverted is unfortunately insufficient for any user facing, interactive DApp. Lightstreams provides instant finality in 3s blocks.</li><li>Already deployed RelayHub and active <a href="https://gsn.sirius.lightstreams.io/getaddr">RelayServer</a> means you don’t have to worry about half of the previously visualised complicated GSN diagram and <strong>can ONLY FOCUS on your app business-case</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o5ivHmUgnJcIQcEkRtQJUg.png" /><figcaption>Pre-deployed Lightstream’s RelayServer</figcaption></figure><h4>STEP 1: Take YOUR existing Smart Contract</h4><p>E.g, given you, have a simple Voter.sol smart contract and your users can either up-vote or down-vote some arbitrary value.</p><pre>contract Voter {<br>    uint256 public count;<br><br>    event Voted(uint256 newCount, address account);<br><br>    function upVote() public {<br>        address lastVoter = _msgSender();<br>        count++;<br><br>        emit Voted(count, lastVoter);<br>    }<br><br>    function downVote() public {<br>        address lastVoter = _msgSender();<br>        count--;<br><br>        emit Voted(count, lastVoter);<br>    }<br>}</pre><h4>STEP 2: Inherit the Gas Free feature</h4><p>Inherit <a href="https://raw.githubusercontent.com/lightstreams-network/lightstreams-js-sdk/master/contracts/utils/GSN.sol">GSN.sol</a> to convert your traditional SC to a GSN compatible one. The GSN.solis extending the official <a href="https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/GSN/GSNRecipient.sol">OpenZeppelin, TabooKey contracts</a>.</p><pre>npm i --save lightstreams-js-sdk<br>import &quot;@lightstreams-js-sdk/contracts/utils/GSN.sol&quot;;<br><br>contract Voter is GSN {</pre><h4>STEP 3: Register the Voter.sol SC in a global RelayHub</h4><p>Deploy the Voter.sol and call the initialize method. As RELAY_HUB argument specify “<a href="https://explorer.sirius.lightstreams.io/addr/0xecf278654f73000f9cb3b05858158ac49c29ed68">0xECf278654f73000F9cB3b05858158AC49c29ed68</a>”.</p><p>This is a official RelayHub deployed on Lightstream’s <strong>Sirius</strong> test network.</p><pre>voter.initialize(RELAY_HUB)</pre><h4>STEP 4: Pay for your users transactions</h4><p>The users transactions will be free but the voting application still has to pay for it. This is done by pre-funding the SC you want to be gas-free in RelayHub.</p><p>Install OZ GSN Helpers:</p><pre>&quot;@openzeppelin/gsn-helpers&quot;: &quot;0.1.9&quot;,</pre><p>Import the fundRecipient method:</p><pre>const { fundRecipient } = require(&#39;@openzeppelin/gsn-helpers&#39;);</pre><p>Fund the Voter.sol with as many PHTs you are willing to pay for your users transactions gas costs:</p><pre>await fundRecipient(web3, {<br>  recipient: voter.address,<br>  relayHubAddress: RELAY_HUB,<br>  amount: web3.utils.toWei(&quot;10&quot;, &quot;ether&quot;),<br>  from: YOUR_PHT_ACCOUNT<br>});</pre><h4>STEP 5: Let users perform FREE transactions</h4><p>In order to do this, you will need a special Web3 lib decorated with HTTP Relay functionality. Why? Because the users gas-free transactions will be now submitted to previously mentioned <strong>HTTP Relayer Server </strong><a href="https://gsn.sirius.lightstreams.io/getaddr">https://gsn.sirius.lightstreams.io/getaddr</a> and decorated before they are broadcasted to blockchain.</p><p>Require the Lightstream’s adjusted OZ Network library:</p><pre>const { fromConnection } = require(&#39;@lightstreams-js-sdk/node_modules/openzeppelin/network&#39;);</pre><p>Create a new GSN powered Web3 object:</p><pre>gsnCtx = await fromConnection(<br>  web3.eth.currentProvider.host, {<br>    gsn: {<br>      dev: false,<br>      signKey: emptyAcc.privateKey<br>    }<br>});</pre><pre>web3 = gsnCtx.lib;</pre><blockquote>Execute the gas-free TX!</blockquote><pre>const voterGSN = await new gsnCtx.lib.eth.Contract(voter.abi, voter.address);<br><br>const tx = await <strong>voterGSN.methods.upVote</strong>().send({<br>  from: <strong>emptyAcc.address</strong>,<br>  gasPrice: gasPrice,<br>  gasLimit: &quot;1000000&quot;,<br>});</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uFGawvOQ_SJBC9Ci26MBrQ.png" /><figcaption>PS: Notice the fast ~3s block time</figcaption></figure><p>Full source code available <a href="https://raw.githubusercontent.com/lightstreams-network/lightstreams-js-sdk/master/test/04_gsn_voter.js">HERE</a>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/df301ed5e8fb1fca2e81623bb1ebd45e/href">https://medium.com/media/df301ed5e8fb1fca2e81623bb1ebd45e/href</a></iframe><p><strong>I have a few more questions, who can I ask and where?</strong></p><p>First of all, thank you for your interest! Drop a comment below or <a href="https://www.linkedin.com/in/llukac/">DM me on LinkedIn</a> and I will be happy to support your GSN integration.</p><h3>Conclusion</h3><p>Blockchain mainstream adoption is around the corner if you combine the right technologies together.</p><p>Visit Lightstreams docs to start developing mainstream, responsive applications today.</p><p><a href="https://docs.lightstreams.network/">https://docs.lightstreams.network</a></p><p><strong><em>PS:</em></strong><em> Special thanks to OpenZeppelin team (Andrew, Nicolas, Igor and Marti) for supporting us in the GSN integration!</em></p><blockquote><a href="https://coincodecap.com/?utm_source=coinmonks">Get Best Software Deals Directly In Your Inbox</a></blockquote><figure><a href="https://coincodecap.com/?utm_source=coinmonks"><img alt="" src="https://cdn-images-1.medium.com/max/584/0*OJ-qb5G6i863msBB.png" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0b664b355ce" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/how-dapp-users-can-interact-with-your-smart-contracts-with-zero-eth-d0b664b355ce">How DApp users can interact with your Smart Contracts with ZERO ETH</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[Is storing encrypted files on IPFS good enough?]]></title>
            <link>https://medium.com/coinmonks/is-storing-encrypted-files-on-ipfs-good-enough-21e050d9de0?source=rss-3ce678da9bb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/21e050d9de0</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ipfs]]></category>
            <dc:creator><![CDATA[Lukas Lukac]]></dc:creator>
            <pubDate>Mon, 12 Aug 2019 07:38:09 GMT</pubDate>
            <atom:updated>2020-08-26T12:14:14.913Z</atom:updated>
            <content:encoded><![CDATA[<h4>Smart Vault, an alternative for storing confidential DApp files.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*owrBvzJAdP1MzxqZI8vkgw.png" /></figure><p>Blockchain transparency is great, but for many use cases involving user data, <a href="https://medium.com/lightstreams/smart-contracts-privacy-vs-confidentiality-6fb90c731fde">privacy and confidentiality</a> are essential.</p><p>When building any application regardless of its centralized or decentralized nature, sooner or later you will need to persist user data.</p><p>It has become a popular method for projects to encrypt and store sensitive data <strong>publicly</strong> on IPFS — essentially making the encrypted data available to everyone! Don’t take me wrong, <strong>encryption is definitely important. </strong>However, wouldn’t it be more secure if <strong>the encrypted</strong> data is <strong>only accessible to authorized parties</strong>?</p><h3>John D. Cook on Twitter</h3><p>The best way to secure data is never to collect it in the first place. Data that is collected is likely to leak.&quot; -- Cory Doctorow</p><p>Is there another way?</p><h3>Smart Vault</h3><blockquote>A permissioned IPFS protocol connected to the blockchain.</blockquote><p>Data is accessed on a need-to-know basis and can be erased forever. <strong>Access is controlled by programmable smart contracts that contain an Access Control List (ACL).</strong> This offers transparent, public and verifiable access without a central controller. <strong>Control is always in the hands of the data owner</strong>, smart contract author, which means it is <a href="https://medium.com/lightstreams/gdpr-for-companies-in-2019-163b338b62cd">GDPR</a> compliant by default.</p><h4>How does it work?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NTxAf2JQvkGipBiFxmCNAQ.jpeg" /></figure><p>Let me walk you through an example for a potential <strong>Decentralized Google Drive Application </strong>where two users (peers) share a confidential document between each other.</p><p><strong>#1, Alice stores a confidential document </strong>in her Smart Vault</p><ul><li>an <strong>ACL</strong> smart contract is deployed on the blockchain</li><li>the document is added to a permission-enhanced <strong>IPFS storage</strong></li><li>the <a href="https://github.com/ipfs/specs/tree/master/merkledag"><strong>IPFS Merkle DAGs</strong></a><strong> are linked to the ACL</strong> smart contract</li><li>a public shareable document reference, <strong>Metadata file, and its hash</strong>, is generated</li></ul><p><strong>#2, Alice</strong> would like to share the document with her colleague Bob, so <strong>she grants him a read access</strong> using the ACL smart contract</p><ul><li>Alice shares the document reference (the hash of the Metadata) with Bob</li></ul><p><strong>#3, Bob attempts to fetch and open</strong> the document</p><ul><li>Bob’s Smart Vault performs a <strong>read request </strong>to all peers</li><li>IPFS protocol resolves the peer holding the document, Alice’s node</li><li>Alice’s Smart Vault performs an authorization check against the confidential document’s ACL before distributing the content</li><li>Bob has been granted access, therefore, the authorization succeeds</li><li>Alice’s Smart Vault sends the document to Bob</li><li>Bob opens the document</li></ul><p><strong>#4,</strong> The document is now stored in <strong>two decentralized Smart Vaults</strong>, protected with the same ACL</p><h4>Adding a file</h4><p>For code lovers, this is how the internals look like in action:</p><figure><img alt="Adding a file to SmartVault" src="https://cdn-images-1.medium.com/max/1024/1*80uQcLdXYjHQlBFNZYYPTQ.png" /><figcaption>Adding a file to Smart Vault</figcaption></figure><h3>How can your project start using Smart Vault today?</h3><p>In order to allow developers to focus only on what really matters, <strong>the DApp business logic</strong>, we abstracted all the technical storage details into a developer-friendly SDK, <strong>Leth</strong>.</p><p>Depending on your project needs, <strong>Leth</strong> allows you to interact with the Smart Vault in multiple ways. Import Leth as a Go library. Execute CLI commands or perform HTTP communication.</p><p>Need a front-end integration? Use the <strong>Leth JS SDK</strong> for wrapping the HTTP calls and directly signing ACL transactions on the client side (browser/mobile) and broadcasting them to blockchain using the smart contract <strong>ABI</strong> and <strong>web3.js</strong> library.</p><h4>HTTP Usage Example</h4><pre>curl -X POST \<br>  http://localhost:9091/storage/add \<br>  -H &#39;Content-Type: multipart/form-data&#39; \<br>  -F owner=0xa92e3705e6d70cb45782bf055e41813060e4ce07 \<br>  -F password=$PWD \<br>  -F file=&quot;@/tmp/secret_file.txt&quot;<br><br>{<br>&quot;meta&quot;:&quot;QmZYSewpHNvdW1TTgska792QAT7Yd6yxZAoybpYFskTZSf&quot;,<br>&quot;acl&quot;:&quot;0xc2DBC8CdAba2df432C821639B80302f0675D6f74&quot;<br>}</pre><h4>CLI Usage Example</h4><pre>leth storage add --nodeid=1 --network=mainnet --owner=0xa92e3705e6d70cb45782bf055e41813060e4ce07 \<br>--file=/tmp/secret_file.txt</pre><h4>Full List Of Available Commands</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wa-XettoloJuabCjDMzUuQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TQBc4kPm17A_7EqzumoXfQ.png" /><figcaption>Leth CLI Docs</figcaption></figure><p>Smart Vault is at the moment in alpha stage with many more requested features are on the way!</p><h3>Let me summarize</h3><p><strong>Do I have to use Lightstreams blockchain to use Smart Vault?</strong></p><p>You can also connect it with Ethereum.</p><p><strong>Is Smart Vault cloud storage?<br></strong>As IFPS, Smart Vault is NOT cloud storage. <strong>It is peer-to-peer storage.</strong> Files are distributed to other devices when they are requested. With our modified version of IPFS, the files are only shared with authorized computers. In an ideal decentralized world, every user is running its own Smart Vault node.</p><p><strong>Can new authorized users access the file after the original owner goes offline?</strong></p><p>Yes, as long as at least one authorized user who already has the content is online. If multiple content holders are online, the content will be seeded from all the peers simultaneously for the best performance in a torrent like style powered by IPFS Bitswap protocol.</p><p><strong>What else can I do with Smart Vault?</strong></p><p>Ecommerce. A few weeks ago we published documentation on how projects can build applications to sell digital content and how users can buy the content without any intermediary! <a href="https://docs.lightstreams.network/products/smart-vault/guides/ecommerce">Peer-to-Peer E-commerce Tutorial</a>.</p><p><strong>I have a few more questions, who can I ask and where?</strong></p><p>First of all, thank you for your interest! Drop a comment below, join our <a href="https://t.me/LightstreamsDevelopers">Telegram</a> group or <a href="https://www.linkedin.com/in/llukac/">DM me on LinkedIn</a>.</p><h3>Conclusion</h3><p>Smart Vault is a developer-friendly, programmable storage for decentralized applications. <strong>Let your users own and control their data.</strong></p><p><a href="https://docs.lightstreams.network/">https://docs.lightstreams.network</a></p><blockquote><a href="https://coincodecap.com/?utm_source=coinmonks">Get Best Software Deals Directly In Your Inbox</a></blockquote><figure><a href="https://coincodecap.com/?utm_source=coinmonks"><img alt="" src="https://cdn-images-1.medium.com/max/584/0*OJ-qb5G6i863msBB.png" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=21e050d9de0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/is-storing-encrypted-files-on-ipfs-good-enough-21e050d9de0">Is storing encrypted files on IPFS good enough?</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[An example e-commerce decentralized application using the Lightstreams Network]]></title>
            <link>https://medium.com/lightstreams/an-example-e-commerce-decentralized-application-using-the-lightstreams-network-feb45ace2b32?source=rss-3ce678da9bb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/feb45ace2b32</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[decentralization]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Lukas Lukac]]></dc:creator>
            <pubDate>Tue, 21 May 2019 13:58:45 GMT</pubDate>
            <atom:updated>2019-05-21T19:02:12.712Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*ygBqCHmI7C6ycvtx7qGo0w.png" /><figcaption>Decentralized digital shop example interface</figcaption></figure><p>This article showcases a decentralized application that enables <strong>people to securely sell &amp; purchase content in a peer-to-peer manner without the need for a central platform or server.</strong></p><h3>Built with React</h3><p>The following example uses React for the UI and connects to a configurable Lightstreams Node (either local or remote).</p><p>Have a look at the example here: <a href="https://example-eshop.lightstreams.io/">https://example-eshop.lightstreams.io</a></p><p>And the source code is on Github: <a href="https://github.com/lightstreams-network/example-eshop">https://github.com/lightstreams-network/example-eshop</a></p><h4>1) Configuring the Lightstreams node provider</h4><p>The first step is to configure a fully synced node that will be responsible for 1) storing files in the “Smart Vault”, 2) managing accounts, and 3) performing the blockchain calls and transactions.</p><p>We highly encourage you to run your own local node, but for the sake of simplicity, you can also connect directly to our public gateway on the Sirius Testnet. The example app itself connects by default to our public gateway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*XpdYt7AGia9Ucd68kEE88A.png" /><figcaption>node configuration</figcaption></figure><h4>2) Configure Your Account</h4><p>Create your Lightstreams blockchain account or login using an existing one. The password will be used to encrypt your private key and lock the account keystore file on the node’s disk.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/559/1*0-x8tWQamt2UCr31N3Z7-A.png" /><figcaption>account creation</figcaption></figure><h4>3) Get some test PHT tokens</h4><p>For creating a shop, you will need some PHT tokens in order to pay the deploy transaction gas fee. Request them on on <a href="https://discuss.lightstreams.network/">community forum</a>.</p><h4>4) Create a shop</h4><p>After you configure your account, you will see a dashboard where you can glance at all the shops created by the Lightstreams community members and all the content being sold.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*DclZZo5bgKsNZqKoXLpM5Q.png" /><figcaption>create new eshop</figcaption></figure><p>Note: To keep this demo simple, I chose to store the list of metadata (i.e. smart contract addresses) for the shops in a real-time Firebase Database. You could very well store these addresses in another smart contract, IPFS or OrbitDB. I may try to do this in the next version of this demo :-). However, please be aware that the actual data for the shops is stored in a decentralised peer-to-peer manner. As a developer, you will decide how decentralized you want to be when developing your own application. Maybe for your application, it is important that metadata needs to also be stored in a decentralised manner also.</p><h4>4.1) Under the hood</h4><p>Creating a shop via the UI will create and deploy a new smart contract on the Lightstreams Testnet, and this Smart Contract will keep track of the digital content you will be selling.</p><p>For full documentation about the internals, visit our technical CLI documentation on <a href="https://docs.lightstreams.network/getting-started/peer-to-peer-ecommerce/">getting started with e-commerce</a>.</p><h4>5) Sell/Buy Content</h4><p>Content for sale is stored in the configured node’s Smart Vault.</p><p>For example, why not purchase a picture of a fountain I took in Mallorca for 15 PHTs? Behind the scenes, the <strong>Smart Vault will grant the buyer a read permission</strong> to access this picture, meanwhile it is securely stored in Lightstreams enhanced &amp; permissioned IPFS storage. When the shop’s Smart Contract receives the funds, it will grant the read access.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fumVxzzBInpUYnhGSUdyXQ.png" /></figure><p><strong>PS:</strong> Of course, if you attempt to access the IPFS hash QmeTvCCzD9C2tFj46ZoXS4kZWvqZ2ScsY9xHz5w7dLrAMy directly, bypassing the purchasing process, you will get an authorization error! Great, that means it works :)</p><h3>Conclusion</h3><p>Thanks to the Lightstreams Network, creating DApps and monetizing commercial content in a decentralized way has just become much easier! If you’d like to build your own shop or application with decentralized shop functionalities, <a href="https://docs.lightstreams.network/getting-started/peer-to-peer-ecommerce/">read the Getting started with e-commerce guide.</a></p><p>N.B. Thanks to <a href="https://medium.com/@ppella">Andrew Zappella</a> for reading and reviewing this article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=feb45ace2b32" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lightstreams/an-example-e-commerce-decentralized-application-using-the-lightstreams-network-feb45ace2b32">An example e-commerce decentralized application using the Lightstreams Network</a> was originally published in <a href="https://medium.com/lightstreams">Lightstreams — The Blockchain for Speed and Privacy</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Update: Lightstreams Presented its Technical Stack at the University of Granada]]></title>
            <link>https://medium.com/lightstreams/update-lightstreams-presented-its-technical-stack-at-the-university-of-granada-c59817f93758?source=rss-3ce678da9bb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/c59817f93758</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Lukas Lukac]]></dc:creator>
            <pubDate>Mon, 06 May 2019 09:15:11 GMT</pubDate>
            <atom:updated>2019-05-06T09:15:11.213Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dYONBoHO2paEZ3thbQ7_kw.jpeg" /><figcaption>Lightstreams at University of Granada</figcaption></figure><p>On March 13th, <a href="https://www.lukaslukac.io/">Lukas</a> and <a href="https://www.linkedin.com/in/ggarri-86/">Gabriel</a>, lead developers at Lightstreams, gave a <a href="https://www.slideshare.net/ggarri/introduction-to-blockchain-development-136144877">blockchain presentation</a> at the University of Granada in order to connect with the Spanish blockchain community. We filled a room with more than 60 knowledge-hungry students for hour an half and it was a great experience!</p><h3>A Gentle Introduction to Blockchain</h3><p>We explained how blockchain, especially Proof-of-Work based Ethereum works internally behind the scenes. We also explained and demonstrated how to interact with the Ethereum or Lightstreams blockchain networks using a developer-friendly SDK, <a href="https://docs.lightstreams.network/cli-docs/leth/">Leth</a>.</p><p>We also showcased our <a href="https://docs.lightstreams.network/cli-docs/leth/storage/">Smart Vault</a> technology designed for peer-to-peer private file sharing in decentralized networks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nVowADiRlG8tOIcwWoDGag.png" /></figure><h3>Result?</h3><ul><li>One of the professors would like to use our technical stack for his blockchain project and collaborate with us more closely</li><li>Several students interested in becoming interns</li><li>We will host another workshop focused on building real world DApps using the Leth SDK connected to our newly launched, <a href="https://medium.com/lightstreams/lightstreams-network-is-live-eeac21d3414c">Mainnet PoA Network</a></li></ul><h4>Students rating:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vm7G215zHZhkknz3xWYLow.png" /></figure><h3>Interferencias on Twitter</h3><p>Empezando la charla sobre #blockchain ahora mismo en el Salón de Grados de la @ETSIIT_UGR. Todavía quedan un par de sitios, estáis a tiempo!</p><p>Visit <a href="https://docs.lightstreams.network/">https://docs.lightstreams.network</a> for more information on how to build fast, secure and decentralized applications of tomorrow on top of Lightstreams Network.</p><p>Thank you University of Granada for hosting us and special thank you to all the attended students!</p><p>Lukas &amp; Gabriel</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c59817f93758" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lightstreams/update-lightstreams-presented-its-technical-stack-at-the-university-of-granada-c59817f93758">Update: Lightstreams Presented its Technical Stack at the University of Granada</a> was originally published in <a href="https://medium.com/lightstreams">Lightstreams — The Blockchain for Speed and Privacy</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to transfer funds on the Ethereum network using the GETH CLI]]></title>
            <link>https://medium.com/free-code-camp/how-to-transfer-funds-on-the-ethereum-network-using-the-geth-cli-b7eac16aa3a9?source=rss-3ce678da9bb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7eac16aa3a9</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Lukas Lukac]]></dc:creator>
            <pubDate>Sat, 08 Dec 2018 00:00:00 GMT</pubDate>
            <atom:updated>2019-01-31T11:06:30.575Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eS0bXFKKeapljk0Ep3tw4A.jpeg" /></figure><p>In my <a href="https://medium.freecodecamp.org/ethereum-69-how-to-set-up-a-fully-synced-blockchain-node-in-10-mins-f6318d7aad40">previous article</a>, you learned how to set up a fully synced blockchain node in 10 mins. It’s now time to learn how to perform a transaction on the Ethereum network using the GETH CLI.</p><p><strong>This is Part 2 of my </strong><a href="https://blog.gophersland.com/tag/learning-ethereum-blockchain-series/"><strong>#learning-ethereum-blockchain-series</strong></a>. To be on the same page, go through all the steps from <a href="https://medium.freecodecamp.org/ethereum-69-how-to-set-up-a-fully-synced-blockchain-node-in-10-mins-f6318d7aad40">previous article</a> first.</p><p>Done? Perfect.</p><p>At this point you know:</p><ul><li>how to run a fully synced Ethereum blockchain node</li><li>how to attach GETH console</li><li>how to query a balance of an Ethereum account</li></ul><pre>geth attach ipc:/home/enchanter/.gophersland_ethereum_r1/geth.ipc </pre><pre>eth.getBalance(&quot;0xceee57f2b700c2f37d1476a7974965e149fce2d4&quot;)</pre><pre>&gt; 7500000000000000000</pre><p>I do, you might think, but wait for a second Lukas…why is 7.5ETH is displayed as 7500000000000000000 in the Geth console?</p><h3>Ether vs Wei</h3><p>The Ethereum Virtual Machine does not support decimals or floats. Apparently, calculations in finance are easier in integers.</p><p>Therefore, to be able to send a fraction of 1 ETH, the Ethereum foundation decided to create their own metric system where the smallest unit would be 1 Wei, and 1 Ether is 1e18 Wei.</p><p>But no worries, there are tools that can make your life easier. For example, I highly recommend the Ether to Wei online converter:</p><p><a href="https://etherconverter.online/">https://etherconverter.online</a></p><p>In order to send $15 worth of Ether, where 1 ETH == $200 (good old times…), you would make a transaction sending 0.0740 ETH which would be, and must be represented in Wei as, 74000000000000000.</p><p><strong>Online Ether to Wei converter:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*YM5fVhiaOzmlLPxz.png" /></figure><p><strong>Overview of the Ethereum metric system:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*H3vJ_yjDUowN2NTx.png" /></figure><p>Practice makes mastery. Let’s actually send 74000000000000000 Wei ($15) to another account.</p><h3>Sending Ether to another account using the GETH CLI</h3><p>In one terminal, remember to run a fully synced blockchain node:</p><pre>geth --rinkeby --datadir=~/.gophersland_ethereum_r1 --port=30304 --cache=2048 --rpc --rpcport=8546 --rpcapi=eth,web3,net,personal --syncmode=fast</pre><p>In another terminal, we will create our second Ethereum account, exactly like in Part 1.</p><pre>ls -la ~/.gophersland_ethereum_r1/keystore/<br><br>&gt; drwx------ 2 enchanter enchanter 4096 sep 24 15:36 .<br>&gt; drwx------ 4 enchanter enchanter 4096 sep 24 15:26 ..<br>&gt; -rw------- 1 enchanter enchanter  491 sep 24 15:36 </pre><pre>UTC--2018-09-24T13-36-43.069452577Z--ceee57f2b700c2f37d1476a7974965e149fce2d4<br><br>geth --datadir=~/.gophersland_ethereum_r1 account new<br><br>&gt; INFO [09-24|15:36:33.566] Maximum peer count ETH=25 LES=0 total=25<br>&gt; Your new account is locked with a password. Please give a password. Do not forget this password.</pre><pre>&gt; Passphrase: <br>&gt; Repeat passphrase: <br><br>&gt; Address: {7aa4a14286a25e3a275d7a122c23dc3c107a636a}<br><br>ls -la ~/.gophersland_ethereum_r1/keystore/<br><br>&gt; drwx------ 2 enchanter enchanter 4096 oct 25 20:14 .<br>&gt; drwx------ 4 enchanter enchanter 4096 oct 25 19:48 ..<br>&gt; -rw------- 1 enchanter enchanter  491 sep 24 15:36 </pre><pre>UTC--2018-09-24T13-36-43.069452577Z--ceee57f2b700c2f37d1476a7974965e149fce2d4</pre><p>Now, let’s attach the Geth Console to the currently running blockchain node as we did in the previous article in order to transfer $15 to this newly created account by executing the eth.sendTransaction command.</p><pre>geth attach ipc:/home/enchanter/.gophersland_ethereum_r1/geth.ipc </pre><pre>eth.sendTransaction({<br>from: &quot;0xceee57f2b700c2f37d1476a7974965e149fce2d4&quot;,<br>to: &quot;0x7aa4a14286a25e3a275d7a122c23dc3c107a636a&quot;, <br>value: &quot;74000000000000000&quot;})</pre><p><strong>Error: authentication needed: password or unlock.</strong></p><p>You should get an error. This is because sending Ether is a “transaction,” and a transaction changes state, costs gas, and spends funds. Which means it needs to be signed with our Private Key that is stored in the <strong>Keystore.</strong> In order to decrypt the key, we must provide a password, or in other words, unlock the account.</p><p>Execute the following command to unlock your account for the next 60s, and execute the sendTransaction command once again.</p><pre>web3.personal.unlockAccount(web3.personal.listAccounts[0], null, 60) </pre><pre>eth.sendTransaction({<br>from: &quot;0xceee57f2b700c2f37d1476a7974965e149fce2d4&quot;, <br>to: &quot;0x7aa4a14286a25e3a275d7a122c23dc3c107a636a&quot;, <br>value: &quot;74000000000000000&quot;})</pre><p>We could have also passed the password as a second argument instead of null. But this way is safer as your password is only in a buffer and not stored in any log or visible on the screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*3GwsZPe8_YLzezca" /></figure><p><strong>This time the command succeeded, and a Transaction hash receipt was returned! Oh yeah!</strong></p><p>As we are connected to the Rinkeby network, we can take advantage of the Rinkeby GUI explorer to check the status of this transaction, gas spent, gas price, etc.</p><ol><li>Open the <a href="https://www.rinkeby.io/#explorer">explorer</a></li><li>Paste the Transaction receipt hash to the search bar</li><li>Done, we spent 21,000 of Gas (standard for sending funds) and the Transaction succeeded!</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*QKI62VRbv2SvQd3_" /></figure><p>You can now query the balances of both accounts and see the changed state:</p><pre>eth.getBalance(&quot;0xceee57f2b700c2f37d1476a7974965e149fce2d4&quot;) <br>&gt; 7425979000000000000 </pre><pre>eth.getBalance(&quot;0x7aa4a14286a25e3a275d7a122c23dc3c107a636a&quot;) <br>&gt; 74000000000000000</pre><p><strong>Works like a charm.</strong></p><p>Congratulations! You:</p><ul><li>learned the difference between Ether and Wei and how to convert them</li><li>submitted your first transaction across global Ethereum test network, Rinkeby</li></ul><h3>Follow BlocksByLukas for more</h3><p><a href="http://twitter.com/BlocksByLukas">Blocks by Lukáš (@BlocksByLukas) | Twitter</a></p><p>Do enjoy the blocks,</p><p><em>Originally published at </em><a href="https://blog.gophersland.com/ethereum-how-to-transfer-funds-using-geth-cli"><em>blog.gophersland.com</em></a><em> on December 8, 2018.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7eac16aa3a9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/how-to-transfer-funds-on-the-ethereum-network-using-the-geth-cli-b7eac16aa3a9">How to transfer funds on the Ethereum network using the GETH CLI</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ethereum 69: how to set up a fully synced blockchain node in 10 mins]]></title>
            <link>https://medium.com/free-code-camp/ethereum-69-how-to-set-up-a-fully-synced-blockchain-node-in-10-mins-f6318d7aad40?source=rss-3ce678da9bb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/f6318d7aad40</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Lukas Lukac]]></dc:creator>
            <pubDate>Tue, 16 Oct 2018 23:18:46 GMT</pubDate>
            <atom:updated>2021-04-23T06:49:13.648Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*oS4hnBtXtJ5h0hIJ0LHnyg.jpeg" /></figure><p>Welcome in the first article of our new go-ethereum series!</p><p>In the next 10 mins you will:</p><ul><li>Learn the first blockchain glossary without any necessary prior ecosystem knowledge</li><li><strong>Setup your fully synced testing node</strong> (“client/server”) <strong>in</strong> <strong>under 10mins</strong></li><li><strong>Create your account</strong> and receive a transaction of 8ETH from the Ethereum foundation for FREE</li></ul><p>Our motto is, practice before theory — so let’s jump straight into the installation of a fully synced Ethereum testing node connected to a Rinkeby test network!</p><h3>Geth</h3><p>Geth is a command line interface (CLI), a compiled binary, program, and client for running a full Ethereum node implemented in Go.</p><p>We will use <strong>Geth</strong> to:</p><ul><li>run a fully synced Ethereum node to connect to a test network called Rinkeby</li><li>create a new account to be able to send and receive transactions</li><li>for reading the EVM state, e.g. checking a balance of any account (want to know how much balance your girlfriend, boyfriend, wife, neighbour has? Sweet transparency!)</li></ul><h3>Installing Geth</h3><p>We can install it directly from the repositories:</p><p><strong>Mac</strong></p><pre>brew tap ethereum/ethereum<br>brew install ethereum</pre><p><strong>Linux</strong></p><pre>sudo apt-get install software-properties-common<br>sudo add-apt-repository -y ppa:ethereum/ethereum<br>sudo apt-get update<br>sudo apt-get install ethereum</pre><p><strong>Windows</strong></p><pre>Good luck :)</pre><p><strong>Verify the installation:</strong></p><pre>which geth<br>&gt; /usr/local/bin/geth</pre><pre>geth version<br>&gt; Geth<br>&gt; Version: 1.8.20-stable</pre><p>Ensure you are running the same version in order to be able to perform a full sync of a Rinkeby network, as described in the next steps because Rinkeby actioned a constantinople hardfork supported by Geth 1.8.20. This detailed <a href="https://blog.gophersland.com/upgrading-geth-to-constantinople-1-8-20-hardfork">blog post</a> explains more details if you are intrigued!</p><h3>Running a blockchain node</h3><p>Well, the devil is in the details…but getting started is actually simple. Kudos to the Ethereum developers.</p><p>Let’s setup a new fully synced <strong>Rinkeby </strong>(Ethereum test network using the Clique PoA protocol) <strong>node</strong>.</p><p>The Rinkeby PoA implementation is much faster but significantly less secure. It is more centralised from the mainnet concensus PoW which is perfectly fine being a test network. Rinkeby manages to approve a new block with a bunch of transactions every 15s.</p><p>Ok, ok, ok...What do those words actually mean?</p><ul><li><strong>Rinkeby:</strong> name of the Proof of Authority test network</li><li><strong>Node:</strong> basically a traditional server executing Ethereum client/server</li><li><strong>Concensus:</strong> an algorithm defining how the transactions will be validated, appended, and persisted in the database on every Node</li><li><strong>Block:</strong> a bunch of transactions in a complicated array dispatched around the wire between all the nodes of the network every 15s</li><li><strong>Transaction:</strong> don’t think about a bank transaction. A blockchain transaction is a <strong>state change. </strong>Renaming the owner of a smart contract from Alice to Bob? Changing balance of your account from 1ETH to 5ETH? Setting variable “foo” value to “foo_value_123” in your smart contract? That’s a transaction.</li></ul><p>You can read more about the Rinkeby PoA proposal here: <a href="https://github.com/ethereum/EIPs/issues/225">https://github.com/ethereum/EIPs/issues/225</a></p><pre>geth --rinkeby --datadir=~/.gophersland_ethereum_r1 --port=30304 --cache=2048 --rpc --rpcport=8546 --rpcapi=eth,web3,net,personal --syncmode=fast</pre><p>The above command will:</p><ul><li>initialize a new directory where all data will be stored in ~/.gophersland_ethereum_r1. The default directory would be:<em> </em>~/.ethereum</li><li>start downloading the Ethereum history necessary to become a new fully valid, synced Node of the network</li><li>the communication will happen over port 30304</li><li>cache, a kind of a buffer, will be set to 2GB to speed up the sync process</li><li>additional RPC API will launch so we can communicate with our node through consoles, nice GUI over on port 8546, later on</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vABGraHKLDKTR5jWoVYsoA.png" /></figure><p>Wait for few hours until the blockchain is fully synced.</p><p>The current block number as of 24th of September is: 3039786. On my AMD Ryzen 5 2600, 3.4Ghz, the sync process took 3 hours. Oh yes, I have a new gaming PC!</p><p>Meanwhile you can follow <a href="http://twitter.com/gophersland">GophersLand on Twitter</a> or prepare dinner, probably breakfast as well, go to the gym… let’s just say, blockchain is not the fastest database :)</p><p>Eventually the printed message will be:</p><ul><li>INFO [&lt;time&gt;] Imported new chain segment count=1</li><li>INFO [&lt;time&gt;] Imported new chain segment count=1</li><li>INFO [&lt;time&gt;] Imported new chain segment count=1</li><li>INFO [&lt;time&gt;] Imported new chain segment count=1</li></ul><p><strong>Congratulation, you are now part of the blockchain revolution in less than 10mins!!!</strong></p><h3>Creating your first blockchain account</h3><h4>Keystore</h4><p>All the Ethereum accounts and their keys are stored in a directory called the “<strong>keystore</strong>”. The directory is empty by default as we haven’t created our own account yet!</p><pre>enchanter@lukas-gaming:~$ ls -la ~/.gophersland_ethereum_r1/</pre><pre>drwx------  4 enchanter enchanter 4096 sep 24 15:26 .<br>drwxr-xr-x 18 enchanter enchanter 4096 sep 24 11:51 ..<br>drwx------  4 enchanter enchanter 4096 sep 24 15:26 geth<br>srw-------  1 enchanter enchanter    0 sep 24 15:26 geth.ipc<br>drwx------  2 enchanter enchanter 4096 sep 23 09:54 keystore</pre><pre>enchanter@lukas-gaming:~$ ls -la ~/.gophersland_ethereum_r1/keystore/</pre><pre>drwx------ 2 enchanter enchanter 4096 sep 23 09:54 .<br>drwx------ 4 enchanter enchanter 4096 sep 24 15:26 ..</pre><h4>Account</h4><p>To create a new account, execute the following, already familiar, <strong>geth</strong> cmd.</p><pre>geth --datadir=~/.gophersland_ethereum_r1 account new</pre><p>You will be prompted to enter a passphrase (this is your SUPER SECRET PASSWORD). This is required for decrypting your newly generated private key associated with your new Ethereum address, as it allows you to use it later on for signing transactions on the blockchain. Note it down somewhere, since we will need it later. But don’t worry if you forget it, this is just a test network anyway.</p><pre>enchanter@lukas-gaming:~$ ls -la ~/.gophersland_ethereum_r1/keystore/</pre><pre>drwx------ 2 enchanter enchanter 4096 sep 23 09:54 .<br>drwx------ 4 enchanter enchanter 4096 sep 24 15:26 ..</pre><pre>enchanter@lukas-gaming:~$ geth --datadir=~/.gophersland_ethereum_r1 account new</pre><pre>INFO [09-24|15:36:33.566] Maximum peer count                       ETH=25 LES=0 total=25</pre><pre>Your new account is locked with a password. Please give a password. Do not forget this password.</pre><pre>Passphrase: <br>Repeat passphrase:</pre><pre>Address: {ceee57f2b700c2f37d1476a7974965e149fce2d4}</pre><pre>enchanter@lukas-gaming:~$ ls -la ~/.gophersland_ethereum_r1/keystore/</pre><pre>drwx------ 2 enchanter enchanter 4096 sep 24 15:36 .<br>drwx------ 4 enchanter enchanter 4096 sep 24 15:26 ..<br>-rw------- 1 enchanter enchanter  491 sep 24 15:36 </pre><pre>UTC--2018-09-24T13-36-43.069452577Z--ceee57f2b700c2f37d1476a7974965e149fce2d4</pre><p><strong>Woohoo! My new Ethereum address is alive: </strong>ceee57f2b700c2f37d1476a7974965e149fce2d4.</p><p>You will normally encounter this address prefixed with “<strong>0x</strong>” to indicate the address encoding, <strong>HEX</strong>.</p><p>The newest format of the keyfiles is: UTC--&lt;created_at UTC ISO8601&gt;-&lt;your address in hex encoding&gt;. The order of accounts when listing is lexicographic, but as a consequence of the timespamp format, it is actually in order of creation.</p><p>If you are curious what is inside of the file, feel free to open it! You will see:</p><ul><li><strong>Address:</strong> your new hex address</li><li><strong>Crypto:</strong> bunch of mathematical variables responsible for representing your private key in encrypted form, don’t worry about that magic for now</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bac60a5ba364ed1e036e2e77c122ecb2/href">https://medium.com/media/bac60a5ba364ed1e036e2e77c122ecb2/href</a></iframe><p><strong>Interesting note: </strong>the account generation happens in offline mode and doesn’t require a synced blockchain node. Curious how is it possible to generate a unique address in an offline mode from the technical perspective? We will check out the <strong>go-ethereum</strong> source code itself in the next article.</p><p><strong>Spoiler:</strong> it’s because the address is a hash of your public key which is based on your unique, private key.</p><p>Okay I have a new shinny Ethereum account, what’s my balance and how do I deposit some testing <strong>Ether</strong>?</p><p>Speaking of Ether… what is it actually?</p><h4>Ether</h4><p>Ether is the cryptocurrency powering the Ethereum network. It’s used as a unit of value and for paying miners for validating, appending, and persisting the transactions to the collective DB. But mainly its a technique for preventing SPAM because miners are rewarded 5 (since last month “just” 3) ETH for each successfully mined block. Yes, that’s $600 at the current price on 24th of September, every 15s. Not a bad business.</p><h3>How to receive a transaction of 8ETH from the Ethereum foundation for FREE</h3><h4>Checking account balance</h4><p>Let’s make sure our account balance is 0 first, unless someone already managed to send some Ether out of the goodness of their heart.</p><p><strong>Geth</strong> provides a JavaScript console that can be attached to the executable binary for interacting with the blockchain conveniently. We can connect to it by specifying a socket file that is exposed once <strong>Geth</strong> boots up. Socket files are very useful for “inter process communication on the same machine”, aka IPC.</p><p>You can locate this file in the the default data directory while the Geth program is running:</p><pre>enchanter@lukas-gaming:~$ ls -la ~/.gophersland_ethereum_r1/</pre><pre>drwx------  4 enchanter enchanter 4096 Sep 24 15:44 .<br>drwxr-xr-x 18 enchanter enchanter 4096 Sep 24 15:47 ..<br>drwx------  4 enchanter enchanter 4096 Sep 24 15:44 geth<br><strong>s</strong>rw-------<strong>  1 enchanter enchanter    0 Sep 24 15:44 geth.ipc</strong><br>drwx------  2 enchanter enchanter 4096 Sep 24 15:47 keystore</pre><p>Let’s interact with the Rinkeby network using the “<strong>geth attach</strong>” cmd in another terminal while your blockchain node is still running. Make sure to pass the absolute path to the IPC file, otherwise you will get an error.</p><pre>enchanter@lukas-gaming:~$ <strong>geth attach ipc:/home/enchanter/.gophersland_ethereum_r1/geth.ipc</strong></pre><pre>Welcome to the Geth JavaScript console!</pre><pre>instance: Geth/v1.8.15-stable-89451f7c/linux-amd64/go1.10.1<br>coinbase: 0xceee57f2b700c2f37d1476a7974965e149fce2d4<br>at block: 3044891 (Mon, 24 Sep 2018 16:42:36 CEST)</pre><pre>datadir: /home/enchanter/.gophersland_ethereum_r1<br>modules: admin:1.0 clique:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0</pre><pre>&gt; <strong>eth.accounts</strong><br>[&quot;0xceee57f2b700c2f37d1476a7974965e149fce2d4&quot;]</pre><pre>&gt; <strong>eth.syncing</strong><br>false</pre><pre>&gt; <strong>eth.getBalance(&quot;0xceee57f2b700c2f37d1476a7974965e149fce2d4&quot;)</strong><br>0</pre><h4>Query blockchain:</h4><p><strong>eth.accounts:</strong> to check your currently available accounts</p><p><strong>eth.syncing:</strong> to make sure our state, DB is fully up to date with rest of the network to ensure the getBalance response will be based on the latest state</p><p><strong>eth.getBalance(“&lt;your address&gt;”):</strong> to query the DB.</p><h4>Receiving a transaction of 8ETH from the Ethereum foundation for FREE</h4><p>The Ethereum foundation has a very neat program called “<strong>Faucet</strong>” available online for assigning Ether to accounts requesting it in real-time.</p><p>Requesting Ether:</p><ol><li>Publish your account address on one of the public social networks</li><li>E.g, post a tweet containing your Ethereum address anywhere in the tweet like this one <a href="https://twitter.com/EnchanterIO/status/1044238559224483841">https://twitter.com/EnchanterIO/status/1044238559224483841</a>, make sure you tag <a href="https://twitter.com/BlocksByLukas">@BlocksByLukas</a> and <a href="https://twitter.com/freecodecamp">@freeCodeCamp</a> and let us know if you like the tutorial!</li><li>Open <a href="https://www.rinkeby.io/#faucet">https://www.rinkeby.io/#faucet</a> and paste the tweet URL</li><li>Click on “Give me Ether”, choose between 3, 7.5 or 18.75 Ether</li><li>Wait few seconds</li><li>Query your account balance again</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Zd4RuYRAIiyqy8Jf" /><figcaption>Rinkeby Faucet</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TM_yQ3hRp8c8tyf8" /></figure><p>Voilà</p><p>You are rich… in a test network.</p><p>BUT, <strong>continue exploring the blockchain ecosystem.</strong></p><p>Do you want to know how blockchain works behind the scenes? What components are needed? How to program the core blockchain functionalities?</p><h3>Build a blockchain from scratch with Go!</h3><p>Follow the story of a software developer who is looking to revolutionize his local bar by implementing blockchain technology for its payment system.</p><p><a href="https://www.freecodecamp.org/news/build-a-blockchain-in-golang-from-scratch/">https://www.freecodecamp.org/news/build-a-blockchain-in-golang-from-scratch/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6318d7aad40" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/ethereum-69-how-to-set-up-a-fully-synced-blockchain-node-in-10-mins-f6318d7aad40">Ethereum 69: how to set up a fully synced blockchain node in 10 mins</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lightstreams Alpha Release]]></title>
            <link>https://medium.com/lightstreams/lightstreams-alpha-release-38fb614718d4?source=rss-3ce678da9bb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/38fb614718d4</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[ico]]></category>
            <dc:creator><![CDATA[Lukas Lukac]]></dc:creator>
            <pubDate>Fri, 21 Sep 2018 13:17:41 GMT</pubDate>
            <atom:updated>2018-09-21T13:17:41.441Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FhmmHTiXpwYZNhxq8wX98A.jpeg" /><figcaption>Leth v0.1.0-alpha</figcaption></figure><p>We are happy to announce the release of our brand new Lightstreams Alpha version, <strong>Leth v0.1.0-alpha.</strong> It can be downloaded and installed today!</p><h4>From Proof of concept to Alpha</h4><p>Our previous version of Lightstreams proved a lot of core concepts of Lightstreams were possible, as it was developed specifically for our proof of concept demo application.</p><p>We wanted to show that an authorization mechanism, coupled with decentralised storage was feasible and could pave the way for new decentralised applications (Dapps). Once our proof of concept was done, we went back to the drawing board and sought where we could improve the design and performance of the secure storage.</p><h4>Leth Alpha Release</h4><p>We decided to create a Lightstreams command-line interface (CLI) that would enable Dapps to use our secure storage. The Lightstreams CLI, which we call <strong>Leth</strong>, is a modular, stable, and developer friendly tool that enables users to run their own Lightstreams node and access the core Lightstreams features.</p><p>The current alpha version contains the following core features:</p><ul><li><strong>Secure file upload and download </strong>— The ability to upload and download files in a decentralised manner.</li><li><strong>Access control management </strong>— The ability for the file owner to manage file access permissions via a smart contract. Once the file has been seeded, the content will continue to be distributed to those with valid permissions (as defined by the smart contract) without requiring the owner’s node to be online.</li><li><strong>Distributed private file sharing</strong> — The ability for multiple nodes to simultaneously share private content with those that are granted permission without a dependency on a centralised entity.</li><li><strong>Command-line interface </strong>— A CLI that enables users to access all the above features, as well as core blockchain capabilities.</li></ul><h4>Next steps</h4><p>As previously discussed in our <a href="https://medium.com/lightstreams/lightstreams-roadmap-1-0-75992962d5a8">Roadmap 1.0</a>, Lightstreams will launch in two stages. During the first stage, the Lightstreams node will launch on the Ethereum network where Lightstreams’ tokens (PHT) will be sold as ERC20 tokens. Accordingly, our Alpha version is able to interface with the Ethereum network and can be tested using the Rinkeby Test Network.</p><h4>Getting started with Lightstreams</h4><p>Instructions on how to download, install and run a Lightstreams Node (Leth) can be found here: <a href="https://wiki.lightstreams.network/getting-started-with-lightstreams-node/">Getting Started with the Lightstreams Node</a>.</p><p>We’d love to hear your feedback and issues you encounter! Please contact me or one of our team members via our <a href="https://t.me/lightstreams">Telegram Group</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=38fb614718d4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lightstreams/lightstreams-alpha-release-38fb614718d4">Lightstreams Alpha Release</a> was originally published in <a href="https://medium.com/lightstreams">Lightstreams — The Blockchain for Speed and Privacy</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is Go an Object Oriented language?]]></title>
            <link>https://medium.com/gophersland/gopher-vs-object-oriented-golang-4fa62b88c701?source=rss-3ce678da9bb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/4fa62b88c701</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Lukas Lukac]]></dc:creator>
            <pubDate>Fri, 07 Sep 2018 19:43:52 GMT</pubDate>
            <atom:updated>2021-01-15T08:19:52.329Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*Rnv21Rbo54O_7M0iGa9YYQ.jpeg" /></figure><p>The first technical article is dedicated to a slightly opinionated topic but an important one. Soon after you write your <a href="https://gobyexample.com/functions">first Go program</a>, you will start thinking about how to organise your code. Should I write a <a href="https://tour.golang.org/basics/4">Function</a>? Should I create a new <a href="https://gobyexample.com/structs">Struct</a>?</p><p>Eventually it all comes to the same question.</p><blockquote><strong>Is Go an object oriented language?</strong></blockquote><p><em>Yes and no. Although Go has types and methods and allows an object-oriented style of programming, there is no type hierarchy. The concept of “interface” in Go provides a different approach that we believe is easy to use and in some ways more general. There are also ways to embed types in other types to provide something analogous — but not identical — to subclassing. Moreover, methods in Go are more general than in C++ or Java: they can be defined for any sort of data, even built-in types such as plain, “unboxed” integers. They are not restricted to structs (classes).</em></p><p><em>Also, the lack of a type hierarchy makes “objects” in Go feel much more lightweight than in languages such as C++ or Java.</em></p><p><a href="https://golang.org/doc/faq#Is_Go_an_object-oriented_language"><em>Quote from an afficial GoLang FAQ page.</em></a></p><h3>About Author</h3><p>I was doing PHP/Java for 7 years by now. I developed a bidding applications handling 100s of millions of bids from advertisers such as Booking.com or Expedia. I created a poker social network TiltBook and even published a Udemy course on “Object Oriented Programming”!</p><p>Now I teach How to Build a Blockchain from Scratch in Go: <a href="https://github.com/web3coach/the-blockchain-bar">https://github.com/web3coach/the-blockchain-bar</a></p><h3>About OOP</h3><p>Before we are able to decide if Go is OO or not, we must first define an OO language.</p><p>When I started writing this article, I defined OOP based on the <a href="https://en.wikipedia.org/wiki/Object-oriented_programming">Wikipedia</a> definition:</p><ul><li>is a <a href="https://en.wikipedia.org/wiki/Programming_paradigm">programming paradigm</a> based on the concept of “<a href="https://en.wikipedia.org/wiki/Object_(computer_science)">objects</a>”, which may contain <a href="https://en.wikipedia.org/wiki/Data">data</a>, in the form of <a href="https://en.wikipedia.org/wiki/Field_(computer_science)">fields</a>, often known as <em>attributes;</em> and code, in the form of procedures, often known as <a href="https://en.wikipedia.org/wiki/Method_(computer_science)"><em>methods</em></a></li><li>an Object’s procedures can access and often modify the attributes of the object with which they are associated</li><li>an Object’s <strong>internal state is protected</strong> from outside world (encapsulated) leveraging <strong>private/protected/public </strong>visibility of attributes and methods</li><li>an Object is frequently defined in OO languages as an instance of a Class</li></ul><p>The above concept properties are implemented in most popular OO languages, Java and C++ by mechanics such as:</p><ul><li>Encapsulation (<strong>possible </strong>on package level in Go)</li><li>Composition (<strong>possible </strong>through <a href="https://golang.org/doc/effective_go.html#embedding">embedding</a> in Go)</li><li>Polymorphism (<strong>possible</strong> through <a href="https://golang.org/doc/effective_go.html#interfaces">Interface</a> satisfaction in Go. Type satisfies Interface without manually implementing it if it defines all the Interface methods. Since almost anything can have methods attached, even primitive types such as Int, almost anything can satisfy an interface)</li><li>Inheritance (Go <strong>does not provide</strong> the typical, type-driven notion of subclassing because it’s fragile and considered a bad practice, inferior to Composition)</li></ul><h4>OOP Original Conception</h4><p>After I published the article, I realised the concept of Objects from historical perspective is extremely complex and subjective.</p><p>What surprised me the most is the fact, the creator of the term “object oriented”, Dr Alan Kay didn’t based the methodology on previously mentioned mechanics (Encapsulation, Composition, Polymorphism and Inheritance), those evolved further as side effects.</p><p>Alan Kay’s original conception was based on the following properties (thx <a href="https://twitter.com/citizen428">Michael Kohl</a> for providing this resource):</p><ol><li><strong>Messaging </strong>(<strong>possible </strong>via<strong> </strong><a href="https://blog.golang.org/pipelines">Channels</a> in Go)<strong><br></strong>In terms of communication between<strong> </strong>Objects, how modules, objects communicate should be designed rather than what their internal properties and behaviors should be</li><li><strong>Local retention</strong>, protection, and hiding of state-process (<strong>possible</strong> by defining <strong>public/private</strong> attributes and methods in Go)</li><li><strong>Extreme late-binding of all things </strong>(<strong>possible </strong>via higher-order-functions and <strong>Interfaces </strong>in Go)<br>A higher order function is a function that takes a function as an argument, or returns a function.</li></ol><pre>- I thought of objects being like biological cells and/or individual <br><br>computers on a network, only able to communicate with messages (so <br><br>messaging came at the very beginning -- it took a while to see how </pre><pre>to do messaging in a programming language efficiently enough to be <br><br>useful).<br><br><br>- I wanted to get rid of data. The B5000 almost did this via its <br><br>almost unbelievable HW architecture. I realized that the <br><br>cell/whole-computer metaphor would get rid of data, and that &quot;&lt;-&quot; <br><br>would be just another message token (it took me quite a while to <br><br>think this out because I really thought of all these symbols as </pre><pre>names for functions and procedures.<br><br><br>- My math background made me realize that each object could have <br><br>several algebras associated with it, and there could be families of <br><br>these, and that these would be very very useful. The term <br><br>&quot;polymorphism&quot; was imposed much later (I think by Peter Wegner) and <br><br>it isn&#39;t quite valid, since it really comes from the nomenclature of <br><br>functions, and I wanted quite a bit more than functions. I made up a <br><br>term &quot;genericity&quot; for dealing with generic behaviors in a <br><br>quasi-algebraic form.</pre><p>Additional deep sources on OOP:</p><ul><li><a href="http://userpage.fu-berlin.de/~ram/pub/pub_jf47ht81Ht/doc_kay_oop_en">http://userpage.fu-berlin.de/~ram/pub/pub_jf47ht81Ht/doc_kay_oop_en</a></li><li><a href="http://www.carlopescio.com/2012/12/ask-not-what-object-is-but.html#more">http://www.carlopescio.com/2012/12/ask-not-what-object-is-but.html#more</a></li><li><a href="https://medium.com/@atherlangga/retracing-original-object-oriented-programming-f8b689c4ce50">https://medium.com/@atherlangga/retracing-original-object-oriented-programming-f8b689c4ce50</a></li></ul><h3>Local retention, protection, and hiding of state-process</h3><h4>In other words, Encapsulation</h4><p><em>is an object-oriented programming concept that binds together the data and functions that manipulate the data, and that keeps both safe from outside interference and misuse.</em></p><blockquote>Yet, everybody uses <strong>setters</strong> (a guaranteed way to ruin your state) and gets OOP wrong right at the beginning but that’s a topic for another discussion.</blockquote><p>Encapsulation is all about maintaining your objects in a valid state and data hiding. Majority of OOP codebases are monoliths. Well, at least until 2017 before the whole Microservices boom…</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FqAWA4afkTGKRi%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FqAWA4afkTGKRi%2Fgiphy-downsized.gif&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FqAWA4afkTGKRi%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="326" frameborder="0" scrolling="no"><a href="https://medium.com/media/0c63eef9524224e0735c44db46cde499/href">https://medium.com/media/0c63eef9524224e0735c44db46cde499/href</a></iframe><p>Monoliths apps have usually one big state, shared memory and state access is controlled using famous <strong>private/protected/public</strong> attributes/methods.</p><p>You know what? That works <strong>very well</strong> for a wide range of applications if you follow DDD and achieve a proper encapsulation!</p><blockquote>OOP strengths: Individualism, Encapsulation, Shared memory, Mutable State</blockquote><p>How is encapsulation and shared memory achieved in object oriented languages?</p><pre><strong>public</strong> class FirstGopherlandCodeSnippet<strong> </strong>{<br>    <strong>private</strong> boolean excitementLvl = 99;<br>}</pre><h3>What makes GoLang special?</h3><p>The rise of multicore CPUs argued that a language should provide first-class support for some sort of concurrency or parallelism. And to make resource management tractable in a large concurrent program, garbage collection, or at least some sort of safe automatic memory management was required.</p><p>All this is very hard to achieve in current Object Oriented languages such as Java. Go took a different approach.</p><blockquote>Do not communicate by sharing memory; instead, share memory by communicating</blockquote><p>The <strong>number 1</strong> feature of GoLang is the exact opposite definition of what OOP stands for. The alone definition, should be a sufficient first hint, suggesting a different implementation/way of thinking must be adapted.</p><p>This efficient communication is achieved especially using:</p><ul><li><a href="https://blog.golang.org/pipelines">Channels</a></li><li><a href="https://en.wikipedia.org/wiki/Pure_function">Pure Functions</a></li><li>Action/Reaction; Request/Response function call design</li><li>Chain/Impulses/Stream of events</li></ul><p>What about encapsulation? How is encapsulation achieved in GoLang?</p><h4>Encapsulation</h4><p><em>in Go is done on a package level by exporting </em><strong><em>Structs</em></strong><em> and </em><strong><em>Functions</em></strong><em> by capitalizing their first character.</em></p><pre>package tar</pre><pre>// Private, available only from within the tar package<br>type header struct {<br>}</pre><pre>// Public, available from other packages<br>func <strong>E</strong>xport() {<br>}</pre><pre>// Private, available only from within the tar package<br>func <strong>d</strong>oExport(h header) {<br>}</pre><p>I like to think about it in this way:</p><blockquote>A GoLang package is the equivalent of a typical<strong>*Manager/*Handler</strong> Class in Java.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LggA1w9ENfbLpag5qrLx_Q.png" /><figcaption>ArchiveManager, TarManager, ZipManager…</figcaption></figure><p>Therefore, when designing your package specific scope encapsulation, <strong>start by designing a public API by defyining the minimum set of FUNCTIONS that shall be exposed to the outsite world.</strong></p><p>An usage example of a standard library <a href="https://golang.org/pkg/crypto/rsa/">RSA</a> pkg with clear input/output API:</p><pre><strong>package </strong>rsa</pre><pre><em>// EncryptPKCS1v15 encrypts the given message with RSA and the padding scheme from PKCS#1 v1.5.<br></em><strong>func </strong>EncryptPKCS1v15(rand io.Reader, pub *PublicKey, msg []byte) ([]byte, error) {<br>    return []byte(&quot;secret text&quot;), nil<br>}</pre><pre>cipherText, err := rsa.EncryptPKCS1v15(rand, pub, keyBlock)</pre><p>There is <strong>no need</strong> to jump into creating a <strong>Struct</strong> straight away just because we are used to create Classes such as RsaEncryption<strong>Manager</strong>/Rsa<strong>Handler</strong> for everything all the time from previous, <strong>differently designed languages.</strong></p><p><strong><em>KISS.</em></strong></p><p><strong><em>Keep it simple stupid.</em></strong></p><p><strong><em>Keep it a function.</em></strong></p><h3>Struct vs Object</h3><p>The responsibility of an <strong>Object</strong> is to:</p><ul><li>hide data from outsite world</li><li>define behaviour</li><li>perform messaging</li><li>maintain a valid state</li></ul><p>The responsibility of a <strong>Struct </strong>is to:</p><ul><li>maintain a valid state if implemented via pointers</li><li>group together multiple fields, even of a different type</li></ul><p><em>Go’s structs are </em><strong><em>typed collections</em></strong><em> of fields. They’re useful for </em><strong><em>grouping data</em></strong><em> together to form </em><strong><em>records</em></strong><em>.</em></p><p>Ability to directly<em> </em>attach methods should be done to specific, small Structs, before things get messy. Just because there isn’t yet a term “<strong>GodStruct</strong>” (well, now there is), it doesn’t mean a Struct is excused to look like this monstrosity:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/556c8a00bb45df1cd87ce71365acd311/href">https://medium.com/media/556c8a00bb45df1cd87ce71365acd311/href</a></iframe><p>I think the biggest “illusion” why Go looks like an Object Oriented language is due to the fact a Struct and an Object look so freaking simillar therefore is natural for developers coming from OO languages to write Go in such a manner. Except. They are not.</p><p>How does a Struct look like?</p><pre>type MyFakeClass struct {<br>    attribute1 string<br>}</pre><p>Can such a Class (Struct) also have methods? Sure.</p><pre>func (mc MyFakeClass) printMyAttribute() {<br>    fmt.Println(mc.attribute1)<br>}</pre><p>Perfect. Except… We have been both fooled like Instagram fanboys/fangirls by filters and convenient angles of that girl/guy from next doors…</p><p>The above <strong>method with a receiver argument </strong>(the Go term), can be also written as a regular <strong>function</strong>.</p><pre>func printMyAttribute(mc MyFakeClass) {<br>    fmt.Println(mc.attribute1)<br>}</pre><blockquote>This is the version Go compiler actually uses behind the scenes!</blockquote><p>Thank you Mihalis Tsoukalos, author of a book <strong>Mastering Go</strong> for this epiphany!</p><blockquote>Imagine you would be writing all your code in this manner, would you still create a GodStruct and pass it around by value all the time?</blockquote><h3>Struct vs Object behaviour</h3><p>The difference is noticable from the following example.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dd3b9d22493d90da814e7f948b560c0e/href">https://medium.com/media/dd3b9d22493d90da814e7f948b560c0e/href</a></iframe><p>We could achieve the desired “Object Oriented” behaviour by implementing a common <strong>pointer receiver function</strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c18655dd088cb43de2c2bc2a1fb54ccc/href">https://medium.com/media/c18655dd088cb43de2c2bc2a1fb54ccc/href</a></iframe><p>While this is a common pattern (technically, the only possible way to update a Struct without creating a new instance) and a recommended way of updating a Struct, I believe pointers should be used with a caution. But then, I am a huge fun of immutability so I may be slightly bias.</p><p>In the next section I am going to share my experience and some researched points when to use a Value Receiver and when a Pointer Receiver.</p><h3><a href="#38b0">Value vs Pointer Receiver</a></h3><h4>When to use a Value Receiver:</h4><ul><li>if the receiver is a <strong>map</strong>, func or <strong>chan</strong></li><li>if the receiver is a <strong>slice</strong> and the method doesn’t reslice or reallocate the slice</li><li>if the receiver <strong>doesn’t mutate</strong> its state</li><li>if the receiver is a small/medium array or struct that is naturally a value type (for instance, something like the time.Time type, XY coordinates, basically anything representing collection of fields), a <strong>ValueObject</strong> one could say</li></ul><h4>Advantages of a Value Receiver:</h4><ul><li>concurrently safe, compatible with GoRoutines (that’s why I use Go in first place)</li><li>Value Copy Cost associated with Value Receivers is not a performance bottleneck issue in absolute majority of applications</li><li>can actually reduce the amount of garbage that can be generated; if a value is passed to a value method, an <strong>on-stack copy</strong> can be used instead of allocating on the <strong>heap. </strong>The <strong>stack</strong> is <strong>faster</strong> because the access pattern makes it trivial to allocate and deallocate memory from it (a pointer/integer is simply incremented or decremented), while the <strong>heap</strong> has much more complex bookkeeping involved in an allocation or free</li><li>it directly, conciously forces to design small Structs</li><li>easier to argue about encapsulation, responsibilities</li><li>keep it simple stupid. Yes, pointers can be tricky because you never know the next project’s dev and Go surely is a young language</li><li>obvious I/O</li><li>unit testing is like walking through pink garden (slovak only expression?), means easy</li><li><strong>no NIL if conditions </strong>(a NIL can be passed to a pointer receiver and cause a panic attack)</li></ul><h4>Advantages of a Pointer Receiver:</h4><ul><li>more efficient once allocated in terms of CPU and Memory (are those few ms actually a business requirement?)</li><li><strong>can maintain and mutate state</strong></li></ul><h4>When to use a Pointer Receiver:</h4><ul><li>working with large datasets, Pointer Receiver is more efficient</li><li>if the developer writes high performance analytical application like NewRelic or a new Blockchain DataStore DB</li><li>if the receiver is a Struct that contains a sync.Mutex or similar synchronizing field, the receiver must be a pointer to avoid copying (Why <strong>mutex</strong> in first place? Use <strong>channels</strong>)</li><li>if the receiver performs mutation (can be mostly avoided by designing pure functions with clear intention and obvious I/O)</li><li><strong>if a Struct is maintaining state, e.g.</strong> <strong>TokenCache</strong></li></ul><pre>type <strong>TokenCache</strong> struct {<br>    cache map[string]map[string]bool<br>}</pre><pre>func (c *TokenCache) Add(contract string, token string, authorized bool) {<br>    tokens := c.cache[contract]<br>    if tokens == nil {<br>        tokens = make(map[string]bool)<br>    }</pre><pre>tokens[token] = authorized<br>    c.cache[contract] = tokens<br>}</pre><p><strong>My personal rules when designing a Struct to maintain its state:</strong></p><ul><li>I make sure ALL attributes are PRIVATE, interaction is possible only via defined method receivers</li><li><strong>I don’t pass this Struct to any goroutine</strong></li></ul><h4>General rule for both types</h4><p>If your Struct has a Value Receiver method, all other methods of this Struct should be Value Receivers.</p><p>The same for pointers.</p><p>If your Struct has a Pointer Receiver method, all other methods of this Struct should be Pointer Receivers.</p><p>Consistency FTW!</p><h4>Personal ultimate 2 rules:</h4><ul><li>Write as many <strong>First Class Functions </strong>as possible and <strong>KISS.</strong></li></ul><p><em>Programmers new to Go are often surprised by its support for function types, functions as values, and closures. The </em><a href="https://golang.org/doc/codewalk/functions/"><em>First Class Functions in Go</em></a><em> code walk demonstrates these features with a simulation of the dice game </em><a href="http://en.wikipedia.org/wiki/Pig_(dice)"><em>Pig</em></a><em>. It is a pretty program that </em><strong><em>uses the language to great effect</em></strong><em>, and a fun read for Go beginners and veterans alike.</em></p><pre>func roll(s score) (score, bool) {<br>	outcome := rand.Intn(6) + 1 // A random int in [1, 6]<br>	if outcome == 1 {<br>		return score{s.opponent, s.player, 0}, true<br>	}<br>	return score{s.player, s.opponent, outcome + s.thisTurn}, false<br>}</pre><ul><li>Abstract business complexity into separate functions, even tight 1 function interfaces such as famous standard library <strong>io.Reader, io.Writer </strong>and comfortably pass them as <strong>function arguments, </strong>unit testing and mocking will become extremely convenient (more on this topic in incoming blog post)</li></ul><pre><strong>type </strong>Reader <strong>interface </strong>{<br>   Read(p []byte) (n int, err error)<br>}</pre><pre><strong>type </strong>Writer <strong>interface </strong>{<br>   Write(p []byte) (n int, err error)<br>}</pre><pre><strong>func </strong>JSON(reader io.Reader) (ABI, error) {</pre><p>Extra resources on topic Value vs Pointer vs Function in Go:</p><ul><li><a href="https://golang.org/doc/faq#methods_on_values_or_pointers">https://golang.org/doc/faq#methods_on_values_or_pointers</a></li><li><a href="https://blog.golang.org/first-class-functions-in-go-and-new-go">https://blog.golang.org/first-class-functions-in-go-and-new-go</a></li><li><a href="https://stackoverflow.com/questions/27775376/value-receiver-vs-pointer-receiver-in-golang">https://stackoverflow.com/questions/27775376/value-receiver-vs-pointer-receiver-in-golang</a></li><li><a href="https://github.com/golang/go/wiki/CodeReviewComments#receiver-type">https://github.com/golang/go/wiki/CodeReviewComments#receiver-type</a></li></ul><h3>Summary</h3><p>Go was not designed to be <strong>primarely</strong> Object Oriented language in the way languages such as Java/PHP/C++ were but the comparison is necessary because those are the languages majority of developers are coming from as fresh Gophers, bringing old solutions, techniques with them that may not necessarily be good solutions in Go environment.</p><p><strong>Go is a combination of paradigms.</strong></p><ul><li>It satisfies majority of Object Oriented characteristics (both mainstream and original ones, as stated at the beginning of the article) to solve general software extendibility issues and provide a way for developers to design domains more naturally</li><li>It masters Functional/Procedural/Objects characteristics and Messaging to solve problems with concurrency and parallelism in the era of multicore CPU hardware architecture</li></ul><h3>Bonus</h3><p><strong>Go is fantastic for distributed and decentralized systems:</strong> blockchain.</p><p>With Web 3.0 and blockchain becoming more mainstream every day, do you know what blockchain is?</p><p>Forget everything you’ve heard about blockchain from social media.</p><p><strong>Now, you will build a blockchain system from ground zero in Go</strong> to really understand the ins and outs of this peer-to-peer, distributed technology.</p><p><strong>Continue at:</strong> <a href="https://github.com/web3coach/the-blockchain-bar">https://github.com/web3coach/the-blockchain-bar</a></p><p><a href="https://github.com/web3coach/the-blockchain-bar">web3coach/the-blockchain-bar</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4fa62b88c701" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gophersland/gopher-vs-object-oriented-golang-4fa62b88c701">Is Go an Object Oriented language?</a> was originally published in <a href="https://medium.com/gophersland">GophersLand</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GoLang School IS LIVE]]></title>
            <link>https://medium.com/gophersland/golang-school-is-live-e5fba8254b1e?source=rss-3ce678da9bb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/e5fba8254b1e</guid>
            <category><![CDATA[community]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[gopher]]></category>
            <category><![CDATA[gophersland]]></category>
            <dc:creator><![CDATA[Lukas Lukac]]></dc:creator>
            <pubDate>Sat, 01 Sep 2018 17:44:44 GMT</pubDate>
            <atom:updated>2019-01-31T10:54:23.609Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>A kingdom where Gophers of all kind live in peace, share, educate and develop <strong>HQ pragmatic, idiomatic</strong> GoLang software.</blockquote><p><strong>Welcome</strong> to our first blog post ever posted!!!</p><p>I am extremely excited to launch an online GoLang School dedicated to:</p><ul><li>writing pragmatic, <strong>maintainable</strong> GoLang</li><li>providing sufficient theory to understand the fundamentals of various complicated topics such as <strong>encodings, hashing, ciphers, parallelism, concurrency</strong> and countless more in order to implement them in GoLang for solving real business, human pain points</li><li>gathering <strong>frequent</strong>ly used <strong>snippets</strong> from day-to-day coding world</li><li>presenting <strong>deep analyses</strong> produced by reverse engineering the most technically-interesting projects such as IPFS (InterPlanetary File System), Ethereum blockchain and others!!!</li><li>building the most <strong>constructive</strong> and <strong>kind</strong> community of Gophers living aside, sharing, educating and having fun :)</li></ul><h3>UPDATE</h3><p>The school pivoted its domain and main focus changed from purely Go to <strong>Go + Blockchain</strong> because I believe this combination is more beneficial for developers pursuing their skills and passion, as well for the world in general.</p><p>If you are curious how Go can be used to develop decentralized applications, checkout my personal site: <a href="https://www.lukaslukac.io/">https://www.lukaslukac.io</a></p><p>Thank you for understanding Gophers,</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e5fba8254b1e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gophersland/golang-school-is-live-e5fba8254b1e">GoLang School IS LIVE</a> was originally published in <a href="https://medium.com/gophersland">GophersLand</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding the impact of variance in life]]></title>
            <link>https://medium.com/@lukas.lukac/understanding-the-impact-of-variance-in-life-4bcb9b6e0871?source=rss-3ce678da9bb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/4bcb9b6e0871</guid>
            <category><![CDATA[psychology]]></category>
            <category><![CDATA[motivation]]></category>
            <category><![CDATA[poker]]></category>
            <category><![CDATA[luck]]></category>
            <dc:creator><![CDATA[Lukas Lukac]]></dc:creator>
            <pubDate>Tue, 15 Aug 2017 11:24:47 GMT</pubDate>
            <atom:updated>2017-10-15T20:28:11.590Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*He3zm2lE2CpRnxMmCtePAw.jpeg" /></figure><blockquote>The man who said I would rather be lucky than good, saw deeply into life. Woody Allen, Match Point.</blockquote><p>There is always going to be a factor in your life, affecting your success, that you won’t be able to control.</p><p>First things first. <strong>Most of the time when you will fail to achieve a goal is simply your fault.</strong> Badly chosen strategy, lack of experience, not enough effort, etc… Don’t use this article as an excuse. For rest of the cases where you failed even thought you did everything as best as you could and you were 100% sure it’s going to work out, it could be simply the variance effect playing with your life.</p><p>The following paragraphs will be heavily inspired by poker terminology and I will borrow several quotes from a great book on this topic called: “The Mental Game of Poker”.</p><p>I was 19 when facing a decision which career path to go. I was deciding between playing professionally online poker or becoming a software developer.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FxT9DPlAUKTl1GeZjC8%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FxT9DPlAUKTl1GeZjC8%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FxT9DPlAUKTl1GeZjC8%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="217" frameborder="0" scrolling="no"><a href="https://medium.com/media/21fccc34d67c366d1c0f48e839c1b8bf/href">https://medium.com/media/21fccc34d67c366d1c0f48e839c1b8bf/href</a></iframe><p>I loved playing poker and I earned quite a lot of euros in that time but there was one thing I was really, really bad at… and still am. Mentally handling variance and swings. As you may know, online poker became widely popular due to the opportunity it offers to amateurs players. Win a lot of money even against professionals in a short term. At the end, I decided to fully focus on my skills of writing software as it was always my dream with the benefit of having a stable monthly income.</p><p>Let’s start with a horribly technical definition of variance:</p><blockquote>In probability theory and statistics, the variance is the expectation of the squared deviation of a random variable from its mean, and it informally measures how far a set of (random) numbers are spread out from their mean. The variance has a central role in statistics.</blockquote><p>Or a way more understandable my definition:</p><blockquote>Variance is the downswings and upswings caused by a third party over which you don’t have the control.</blockquote><p>And as to poker, the same rules apply to various aspects of life. In order to don’t go too much into poker environment, I am going to demonstrate this principle on a topic that many young people, especially guys but girls as well, will find waaay too familiar.</p><p>You walk into a bar to have fun, socialise, meet some new people, maybe even with a bit of “luck” to find the guy/girl of your dreams. Let’s say it’s not your first time and you have already some Friday night’s behind you. You are socially calibrated, fun to be around not seeking anything, able and willing to provide a great experience for BOTH you and the girl/guy. You notice the future mother/father of your kids, you collect all the courage you are able in that moment and you approach him/her.</p><p>What will be the result?</p><p>Well, you may end up having a great conversation for hours, she/he may directly ignore you or you just chit chat to nowhere and your paths split. Let’s scale the example a bit. You approach several girls/guys over several nights with the same attitude and you realise that even though most of your approaches are very similar you get very different results in each scenario.</p><p>What changed? How is possible that by doing the same thing for 4 nights, the first 2 nights all the girls/guys ignored you, in the 3rd week everyone you talk to falls in love with you and the next Friday, during 4th night, nothing works out again?</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FBiW4r1OAGwin6%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FBiW4r1OAGwin6%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FBiW4r1OAGwin6%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="355" frameborder="0" scrolling="no"><a href="https://medium.com/media/247f5c4a4e3b04ecc88002a20ccc84dc/href">https://medium.com/media/247f5c4a4e3b04ecc88002a20ccc84dc/href</a></iframe><p>It’s quite simple. As in poker, sometimes you are unstoppable, winning for months in a row when a downswing comes and you are not able to win a single tournament for next 6 months. Just ask some professional full-time players.</p><p>For illustration, this is a June’s graph of one of the best online poker players and notice his crazy ups and downs. Imagine he would give up when he was -15,000€…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*LbVPLGI0wkpB1U2eWVN3mA.jpeg" /></figure><p>Sure, real life is more complicated and I removed a lot of variables from the equation as no girl is the same, you are never at any point in your life exactly the same as before, the natural chemistry but there is a reason why we can remove all of those.</p><p>Did ever happened to you that you came to your boss desk to ask a question and he looked at you like you would dismiss his concentration for next few hours and he screams you out of there? Probably yes. Unfortunately for you, the next day you have to come to ask another question but surprisingly he welcomes you with a smile more than willing to help!</p><p>Did you do something differently? Not really. Was it the same boss? Yes. There is always going to be a factor in your life, affecting your success, that you won’t be able to control. This can be frustrating, demotivating, depressing and other <strong>D-</strong>words I can tell you but don’t hang yourself just yet! There are ways to get around this!</p><p>The objective should be to accept that variance and luck are always going to be involved in our lives and the only thing left is to keep a calm mind, expect it and do our best every single time while enjoying the process. The results will come.</p><p>I will finish this article by listing some of my favorite passages from the book in order to give you a different perspective on how to think about variance and luck.</p><blockquote>Ultimately, this forced me to operate in a much more logical way. So much of what we poker players deal with is illogical, and my struggles with variance were a big example of it. Jared once asked me, <strong>‘When you look at a weather forecast and it says it’s going to rain, do you get mad when you go out and it’s raining?</strong> So why do you continually get angry when you know variance is going to happen?’ I absolutely hate when I’m being illogical, and as soon as he reminded me that I was, I could instantly tell I was going to handle variance better.</blockquote><blockquote>EMOTION IS NOT THE PROBLEM. It’s the key to mastering your game. The fundamental difference between the common approaches to poker psychology and this book comes down to how emotion is viewed. When emotion is viewed as the cause of problems at the poker table, it makes perfect sense why conventional wisdom would urge you to become robotic, trick your mind, or become desensitised to emotion. In essence, traditional tactics are suggesting that anger, fear, and overconfidence are inherently bad, so you must get rid of them. Of course, your end goal is to get these negative emotions out of your game, but they are the symptom — not the true cause of why you play poorly. Finding the cause of your emotional problems requires digging a little deeper, and when you do, the role of emotion completely changes. Emotion, once seen as the problem, now serves a valuable purpose: highlighting flaws in how you are mentally approaching the game. In essence, emotion is a messenger telling you exactly what to work on in your mental game. (If you have no idea what the messenger is saying, you try to kill it.)</blockquote><blockquote>When the emotional system becomes overactive, it shuts down higher brain functions.</blockquote><h3>What’s the advantage of giving up?</h3><p>… sorry to break it up for you but… none. It’s just an easy way out and every single person is able to take it and complain how the life is against them, how unlucky they are and why they couldn’t go to gym because it was one degree colder/hotter outside than they expected.</p><h3>What’s the advantage of NOT giving up?</h3><p>… unimaginable mental and personal growth followed by the possibility to enjoy the sweetest fruits of all of your desired goals.</p><p>Therefore, I would love to encourage you, <strong>focus</strong> on the process (assuming it’s the right process, otherwise change it and then trust the process).</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F4RpuPZzd2qZJS%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F4RpuPZzd2qZJS%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F4RpuPZzd2qZJS%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="239" frameborder="0" scrolling="no"><a href="https://medium.com/media/1021724d858148ebb9d891d59f06e4f9/href">https://medium.com/media/1021724d858148ebb9d891d59f06e4f9/href</a></iframe><p>Keep learning, trying, experimenting, working out, pushing through and sooner or later the “luck”, <strong>variance</strong>, will be on your side. <strong>But only if you push through!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4bcb9b6e0871" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>