<?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 Mikael Lazarev on Medium]]></title>
        <description><![CDATA[Stories by Mikael Lazarev on Medium]]></description>
        <link>https://medium.com/@mikael.lazarev?source=rss-254bf7e1132d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*VHel11fwmqEkuEQYL_osVA.png</url>
            <title>Stories by Mikael Lazarev on Medium</title>
            <link>https://medium.com/@mikael.lazarev?source=rss-254bf7e1132d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 17:48:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mikael.lazarev/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[Mastering Bitcoin SV. Part II]]></title>
            <link>https://medium.com/@mikael.lazarev/mastering-bitcoin-sv-part-ii-f8b5900ab3c3?source=rss-254bf7e1132d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8b5900ab3c3</guid>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[fintech]]></category>
            <category><![CDATA[blockchain-development]]></category>
            <dc:creator><![CDATA[Mikael Lazarev]]></dc:creator>
            <pubDate>Thu, 03 Sep 2020 17:46:24 GMT</pubDate>
            <atom:updated>2020-09-03T17:46:24.025Z</atom:updated>
            <content:encoded><![CDATA[<p>This is the second part of <a href="https://medium.com/@mikael.lazarev/mastering-bitcoin-sv-contract-part-i-ef104c009046?sk=375a887cd074bcf6ffb5be93f7e7accf">article</a> about developing smarrtcontracts for Bitcoin SV. Some theory you could find in the Part I. In this part we will examine Token Contract in details to understand how it works.</p><h4>Good point to start</h4><p>I strongly recommend to start your learning journey from cloning Scrypt examples repository:</p><p><a href="https://github.com/scrypt-sv/boilerplate">https://github.com/scrypt-sv/boilerplate</a></p><p>It contains many examples of smartcontracts. Let’s focus on token contract: <a href="https://github.com/scrypt-sv/boilerplate/blob/master/contracts/token.scrypt">https://github.com/scrypt-sv/boilerplate/blob/master/contracts/token.scrypt</a></p><h4>Token contract</h4><pre>01 import &quot;util.scrypt&quot;;</pre><pre>02 /**<br>03  * A toy token example between two holders<br>04  */</pre><pre>05<strong> contract Token</strong> {<br>06   <strong>public function transfer</strong>(PubKey sender, <br>07            Sig senderSig, <br>08            PubKey receiver, <br>09            int value /* amount to be transferred */, <br>10            bytes txPreimage, <br>11            int amount) {<br>12        <br>13  // this ensures the preimage is for the current tx<br>14  require(Tx.checkPreimage(txPreimage));</pre><pre>15  // authorize<br>16  require(checkSig(senderSig, sender));</pre><pre>17  // read previous locking script<br>18  bytes lockingScript = Util.scriptCode(txPreimage);<br>19  int scriptLen = length(lockingScript);</pre><pre>20  int pkStart = scriptLen - (Util.PubKeyLen + Util.DataLen) * 2;<br>21  PubKey pk0 = PubKey(lockingScript[pkStart : pkStart + Util.PubKeyLen]);<br>22  int balance0 = unpack(lockingScript[pkStart + Util.PubKeyLen : pkStart + Util.PubKeyLen + Util.DataLen]);<br>23  PubKey pk1 = PubKey(lockingScript[pkStart + Util.PubKeyLen + Util.DataLen : pkStart + 2 * Util.PubKeyLen + Util.DataLen]);<br>24  int balance1 = unpack(lockingScript[scriptLen - Util.DataLen : ]);</pre><pre>25  // only between two holders<br>26  require(sender == pk0 &amp;&amp; receiver == pk1 || sender == pk1  &amp;&amp; receiver == pk0);</pre><pre>27  // transfer<br>28  if (sender == pk0) {<br>29      require(balance0 &gt;= value);<br>30      balance0 = balance0 - value;<br>31      balance1 = balance1 + value;<br>32   } else {<br>33      require(balance1 &gt;= value);<br>34      balance1 = balance1 - value;<br>35      balance0 = balance0 + value;<br>36   }</pre><pre>37   // write new locking script<br>38   bytes lockingScript_ = lockingScript[: pkStart] + pk0 + num2bin(balance0, Util.DataLen) + pk1 + num2bin(balance1, Util.DataLen);</pre><pre>39   Sha256 hashOutputs = hash256(num2bin(amount, Util.OutputValueLen) + Util.writeVarint(lockingScript_));<br>40  require(hashOutputs == Util.hashOutputs(txPreimage));<br>    }<br>}</pre><p>This is a toy example which only 2 tokenholders and provide transfer function.</p><h4>Transferring tokens</h4><p>If you have previously experinece with Ethereum contract, you could be surprised with parameters we’ve passed into transfer function (lines 06–11):</p><pre>06   <strong>public function transfer</strong>(PubKey sender, <br>07            Sig senderSig, <br>08            PubKey receiver, <br>09            int value /* amount to be transferred */, <br>10            bytes txPreimage, <br>11            int amount)</pre><p>Bitcoin SV contracts are more low-level than Solidity, however, the logic is similar:</p><ul><li><strong>PubKey sender</strong> — is a pubkey of sender like msg.sender in Solidity</li><li><strong>Sig senderSig</strong> — is a sender signature. We have to check it in contract to be ensured that sender knows private key. In some Bitcoin SV contracts you could find multiSig, where funtion gets some signature to sign a transaction</li><li><strong>PiubKey receiver</strong> — a pubkey of token receiver. It’s an analog for <em>address to </em>field in ERC-20 contract</li><li><strong>int value </strong>— amount of tokens to transfer. It’s an analog for <em>uint tokens </em>in ERC-20 contact</li><li><strong>bytes txPreimage </strong>— computed tx result. Before invoking a transaction, we have to compute result in our code and send. We will consider this in following chapter.</li><li><strong>int amount</strong> — computed resulted amount of transaction.</li></ul><h4><strong>What is txPreimage?</strong></h4><p>txPreimage is a result of invoking thisfunction which would be stored in blockchain if your function would not throw an exception. So, before calling any function in BitcoinSV contract, you have to compute expected result and provide it as Tx output.</p><p>The concept of txPreimage is amazing for developers, to make a call you have to provide expected result like in unit test. In line #14 we check that preImage is the same like in output:</p><pre>13  // this ensures the preimage is for the current tx<br>14  require(Tx.checkPreimage(txPreimage));To check that your and the last line #40 is used to compare two hashes</pre><p>And after all calculations we compare hash of calculated result with preimage in lines #39–40:</p><pre>39   Sha256 hashOutputs = hash256(num2bin(amount, Util.OutputValueLen) + Util.writeVarint(lockingScript_));<br>40  require(hashOutputs == Util.hashOutputs(txPreimage));</pre><p>It’s very significant concept to understand how smartcontarcts work in BitcoinSV:</p><p>Stage 1. Compute expected result of function call<br>Stage 2. Pass this expected result to function as <em>txPreimage</em> parameter.<br>Stage 3. Check that provided txImage as function parameter is the same like in transaction<br>Stage 4. Compute result using business logic<br>Stage 5. Compare hashes of function result wit provided txPreimage.</p><p>As you remember from <a href="https://medium.com/@mikael.lazarev/mastering-bitcoin-sv-contract-part-i-ef104c009046?sk=375a887cd074bcf6ffb5be93f7e7accf">Part I</a>, Bitcoin SV uses UTXO model, so the process could be dedscribed as following.</p><p>Client create a new TX as set txPreimage as a new contract state(tx state). Smartcontract function checks correctness of actions. If it’s valid tx, it would be saved to blockchain and the state of smartcontact would be updated.</p><h4>Deployment &amp; function calls</h4><p>Scrypt is high-level language, so you have to compile it into byte code (which contains of opCodes) and then use for your transaction. In theory, there is no special deployment operation, you easily set your bytecode as output for your transaction and it’s enough for deployment.</p><p>Let’s go to <em>deployments</em> folder in clone repo and check how it works: <a href="https://github.com/scrypt-sv/boilerplate/blob/master/deployments/token.js">https://github.com/scrypt-sv/boilerplate/blob/master/deployments/token.js</a></p><p>At the beginning, we create 2 accounts to use them in our toy smartcontract:</p><pre>const privateKey1 = new bsv.PrivateKey.fromRandom(&#39;testnet&#39;)  const publicKey1 = bsv.PublicKey.fromPrivateKey(privateKey1)  const privateKey2 = new bsv.PrivateKey.fromRandom(&#39;testnet&#39;)  const publicKey2 = bsv.PublicKey.fromPrivateKey(privateKey2)</pre><p>In next two strings we’ve create an smartcontract instance</p><pre>const Token = buildContractClass(loadDesc(&#39;token_desc.json&#39;))    const token = new Token()</pre><p>Keep in mind, that you have to compile you <em>.scryp</em>t file into ABI (‘token_desc.json’) before using this script. To do this, you could import <em>compileContract(fileName) </em>function from ‘helper.js’, which produces ABI file.</p><p>For the first (funding) transaction we have to set up initial state:</p><pre>// append state as passive data part    <br>// initial token supply 100: publicKey1 has 100, publicKey2 0    token.dataLoad = toHex(publicKey1) + num2bin(100, DataLen) + toHex(publicKey2) + num2bin(0, DataLen)</pre><p>Each time when you’ve updating state, you’ll setup dataload property.</p><p>After that, you have to compute amount of money after tx (line #56), presage (line #61) &amp; signature (line #62). Then you compute transaction script (lines #63–70) and set it as input (line #73).</p><p>Keep in mind! When you call transfer (or other contract methods) it doesn&#39;t mean that you call them — all you job here is to prepare transaction. When transaction is ready, it’s called with sendTx helper which returns tx id.</p><h4>Wrap up</h4><p>In this article, we examine smart contract flow on Bitcoin SV. Just to remind:</p><ol><li>As a developer you should compute new contract state. Smart contract has only one option to prove it and save into blockchain or reject</li><li>There is no arrays and complex data structures, it’s your responsibility to create low-level data structure, parse it inside contract to compute result and in client to provide expected outcome</li><li>Interaction cycle in Bitcoin SV consists of preparing transaction. There is no call (getting data) method as in Solidity</li></ol><p>It looks complex at the first view, but I like this approach. As a developer you could contract how you data is processed and deliver some unique solutions.</p><p>The concept with txPreimage adds unit tests for your contracts from box, and makes contacts more reliable.</p><p><a href="https://medium.com/@mikael.lazarev/mastering-bitcoin-sv-contract-part-i-ef104c009046?sk=375a887cd074bcf6ffb5be93f7e7accf">Part I. Mastering Bitcoin SV contracts</a></p><h4>Further reading/ resources</h4><p><a href="https://svpool.com/tech/smart-contracts-are-possible-on-bitcoin-sv-thanks-to-gearsv/">https://svpool.com/tech/smart-contracts-are-possible-on-bitcoin-sv-thanks-to-gearsv/</a></p><p><a href="https://fsinsight.com/2020/07/28/crypto-special-report-bsv-business-use-cases-of-th/">https://fsinsight.com/2020/07/28/crypto-special-report-bsv-business-use-cases-of-th/</a></p><p><a href="https://bitcoinsv.io/roadmap-new/">https://bitcoinsv.io/roadmap-new/</a></p><p><a href="https://bitcoinassociation.net/video/">https://bitcoinassociation.net/video/</a> recommend the Devcon presentation videos</p><p>This is a video of a walk-through presentation that was done at a meet up recently called sCrypt — How to Program Smart Contracts on BSV</p><p><a href="https://www.youtube.com/watch?v=BDc0UWy6Ylw&amp;feature=emb_logo">https://www.youtube.com/watch?v=BDc0UWy6Ylw&amp;feature=emb_logo</a></p><p>Also there is <a href="http://atlantis.slack.com/">Atlantis.slack.com</a> for engaging with developer community</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8b5900ab3c3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Bitcoin SV contract. Part I]]></title>
            <link>https://medium.com/@mikael.lazarev/mastering-bitcoin-sv-contract-part-i-ef104c009046?source=rss-254bf7e1132d------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef104c009046</guid>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[bitcoin-sv]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[fintech]]></category>
            <dc:creator><![CDATA[Mikael Lazarev]]></dc:creator>
            <pubDate>Sun, 23 Aug 2020 10:28:26 GMT</pubDate>
            <atom:updated>2021-07-29T13:13:20.735Z</atom:updated>
            <content:encoded><![CDATA[<h3>Mastering Bitcoin SV smart contract. Part I</h3><p>As a blockchain developer &amp; co-founder of Saint-Peteresburgr Blockhain Developer Coummunity, I’m instersting in all blockchain technologies. In this article you could find information how to write smart contract for Bitcoin SV.</p><h4>What is Bitcoin SV?</h4><p>Bitcoin SV (Satoshi view) is a fork of orginial Bitcoin, which has unlimited storage for any transaction and cheap transactions.</p><h4>How smart contracts works on Bitcoin SV</h4><p>When we talk about smartcontracts the first thing is come to mind is Ethereum. However, Ethereum wasn&#39;t the first blockchain which offer smartcontracts, Bitcoin also has possibility to write smartcontracts using Script language.</p><p>Let’s start from basics. For understading how contract works, we have to understand a topic called UTXO — the core concept of storing data in Bitcoin:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jlocKsduxt6InEi9x0fU1g.png" /></figure><h4><strong>What is UTXO?</strong></h4><p>There are two different data models: Ethereum uses address based transaction model and Bitcoin used UTXO. In address model (used in Ethereum) blockchain stores data as banks accounts. (pairs of address-values)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*ykR6WQC08uN6hvxPwaqjhg.png" /></figure><p>For UTXO (Unspent transactios outout) Each bitcoin transaction begins with coins used to balance the ledger. UTXOs are processed continuously and are responsible for beginning and ending each transaction. Confirmation of transaction results in the removal of spent coins from the UTXO database. But a record of the spent coins still exists on the ledger.</p><p>It means, that each bitcoin transactions have several inputs and several outputs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*xMfx6bJ7OU6fb7YjNPkxQw.png" /><figcaption>How UTXO works. Image from <a href="https://medium.com/codechain/codechains-utxo-model-fc967901578d">https://medium.com/codechain/codechains-utxo-model-fc967901578d</a></figcaption></figure><p>To evaluate the amount of address, you have to compute all inputs of transaction.</p><p>Each bitcoin input &amp; output has special code (written in Script language, more info: <a href="https://en.bitcoin.it/wiki/Script">https://en.bitcoin.it/wiki/Script</a>) which is executed by miners to proceed transactions. It’s a significant part, even if Alice sends money to Bobs, she adds a special script called Pay to Public Key Hash, and transfering money is a result of invoking this script.</p><p>The script returns a boolean value which proves that transaction is valid. If script returns false, it means that transaction is invalid and miner does not include it into block.</p><p>The most popular code is Pay to Public Key Hash. Lets consider it in details to understand the basic of Script (Here you could see Scrypt — high-level smart contract language for Bitcoin SV):</p><pre>1<strong> contract</strong> P2PKH {<br>2   <strong> Ripemd160</strong> pubKeyHash;<br><br>3   <strong> public function</strong> unlock(Sig sig, PubKey<strong> </strong>pubKey) {<br>4        <strong>require</strong>(hash160(pubKey) == this.pubKeyHash);<br>5        <strong>require</strong>(checkSig(sig, pubKey));<br>6    }<br>7 }</pre><p>The P2PKH script pattern contains a <a href="https://learnmeabitcoin.com/technical/public-key-hash">hashed public key</a> (pubKeyHash — line 2). To solve this script, the owner of the hashed public key above needs to provide the <em>original</em> <a href="https://learnmeabitcoin.com/technical/public-key">public key</a>(line 4), along with a valid signature for it (line 5).</p><p>If any require returns false, the miner consider this transaction is invalid and doesn&#39;t add it to block.</p><h4>Standard and Non Standard Scripts</h4><p>In last many years the usage of script instructions was quite limited due to an idea or a restriction imposed or agreed upon for the acceptance of scripts by miners. This was done for many reasons which are beyond the scope of this book but that limited the possible use of most of the script functionality. This idea was called the standard and non-standard scripts and at some points only accepted scripts by miners was decided to be standard scripts. This does not mean that you cannot write non-standard scripts in your transaction but those transactions would be rejected by most of the miners making the usage invalid. So what are these standards? The code level details of this is present in functions IsStandard() and IsStandardTx() under policy.cpp</p><p><a href="https://github.com/bitcoin-sv/bitcoin-sv/blob/master/src/policy/policy.cpp">https://github.com/bitcoin-sv/bitcoin-sv/blob/master/src/policy/policy.cpp</a></p><h4>Storing data</h4><p>Bitcoin has an option to store data. After OP_RETURN (special opCode which tells virtual machine that the code is finished) you could store any data which miners would ingnored but add to block.</p><p>[ TX: ScriprtCode | Data1] =&gt; [ TX: ScriptCode | Data 2] =&gt; ….</p><p>So, each time script code could update our data based on some parameters andd save to the chain! Its amazing.</p><h4>How to implement business logic</h4><p>To make a real business application, we would create a contract which saves all data to itself. Smartcontract could also read, proceed this data and store it as result of transaction. From one’s perspective, smartcontract on Bitcoin SV works like sending money to itself with different script (it changes cause data changes) and could be considered as state machine.</p><p>[ Address 1: State 1] =&gt; [Address 1: State 2] =&gt;… =&gt; [ Address 1: State N]</p><p>In other word, each transaction is send money to initial address, however, the state is changing (or not changing :) each time it’s invoked.</p><h4>Gathering data</h4><p>To get current state of data, we could find the last transaction, get the script and extract data from it. Of course, we could use Scrypt data primitives, but it has not arrays for example, and usually we need dynamic data size.</p><p>As you know, reading blockchain is very fast, and it’s why Bitcoin SV could become an interesting player for immutable data storage market.</p><p>How to implement this I’ll show you in next article.</p><p>Stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef104c009046" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to become a Monsters in Tezos development?]]></title>
            <link>https://medium.com/@mikael.lazarev/how-to-become-a-monsters-in-tezos-development-400cf14233bf?source=rss-254bf7e1132d------2</link>
            <guid isPermaLink="false">https://medium.com/p/400cf14233bf</guid>
            <category><![CDATA[tezos]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[games]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <dc:creator><![CDATA[Mikael Lazarev]]></dc:creator>
            <pubDate>Fri, 03 Jul 2020 19:22:13 GMT</pubDate>
            <atom:updated>2020-07-03T19:28:01.671Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to become a Monster in Tezos development?</h3><p><em>You could find a game on </em><a href="https://tezos-monsters.com/"><em>https://tezos-monsters.com</em></a><em>, Github: </em><a href="https://github.com/MikaelLazarev/tezos-monsters-server">https://github.com/MikaelLazarev/tezos-monsters-server</a></p><h4>My personal inspiration</h4><p>When I started to learn Tezos a few months ago, I was a little bit confused with many different options: you should choose between Michelson, 3 dialects of Ligo language and SmartPy. I’ve chosen Pascal Ligo and I really like its approach and concepts.</p><p>However, learning was not so simple, there is a lack of learning materials and stackoverflow exapmples (Tezos has their own stackoverflow). Before CoinList hackathon I’ve a question: what I should bring to community to make developer experience better?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iXkoqlWZglK3BzS8UcUtLg.png" /><figcaption>The first screen</figcaption></figure><p>When I started learning Solidity, I’ve completed CryptoZombies and they helped me a lot to understand basics and have a good practise. Gamification really helps to learn with fun. And I decided to build a game with a sotry and some provocative content to make it more unique.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j_g9SkDs2ODybBSs5I3_LQ.png" /><figcaption>Part II. Monster factory task</figcaption></figure><p>As a hero you start from designing simple token smartcontract, and in the Part II you could learn more advanced technics by developing your personal Monster Amazon with blackjack…</p><h4>Inside monster factory</h4><p>For this hackahton I’ve developed full game engine from scratch. The project consist of 5 modules:</p><ul><li>Tezos monster server — which provide game backend</li><li>Tezos monster client — game frontend</li><li>Tezos monster code checker — it checks gamer’s code and provide feedback. I’ve clonde Ligolang WebIDE and make some changes</li><li>Tezos monster story editor — a specal tool for creating story</li><li>Tezos monster factory — a microservice to render monster by their DNA</li></ul><p>One of the most interesting part, which you could not see is a Story Editor:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qx8HpP5-cYiN5RqA46xLPw.png" /></figure><p>For each page, you could edit story, set up answers or initial code and add test cases. Each time, when you submit a code, the server sends your code with provided tests to Code Checker, which computes them and compare with expected result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xbe_7iA2orvitJBR3nKwzQ.png" /><figcaption>Test Cases Editor</figcaption></figure><h4>What’s next</h4><p>I beleive that this game could help blockchain developers to learn Ligo language. I found some great advantages of using Ligo for smart contract:</p><ul><li>Clear idea of data storage, it’s much better that in Solidity</li><li>Functional programming</li><li>Better contract design</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nuEYx6A-KnLI6TZqS0U4dA.png" /><figcaption>A picture of game</figcaption></figure><p>As a co-founder of Saint-Petersburg Blockchain Developers association, I know many blockchain developers, and I sent 250+ messages with asking them to check the game, provide feedback and vote for the project (of course). I also posted game description in many groups in social networks &amp; channels with blockchain topic.</p><p>I got a lot of positive feedback, some of community ideas was already implemented, some of them in backlog. For the moment of writing this article, a game has 80+ registrations and it’s growing day by day.</p><h4>How you could help?</h4><p>If you just started to learn Tezos, please play the game. I would really like to get a feedback from you and ideas how to improve learning experience. It’s really cool to make something that could help other people.</p><p>And please, share link to game or this article for your friends. With better community we could achieve more.</p><p>Game: <a href="https://tezos-monsters.com/">https://tezos-monsters.com</a></p><p>Github: <a href="https://github.com/MikaelLazarev/tezos-monsters-server">https://github.com/MikaelLazarev/tezos-monsters-server</a></p><p>Contact me via telegram: https://t.me/mikael_l</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=400cf14233bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cerberus Wallet. Part 4. Backend development]]></title>
            <link>https://medium.com/@mikael.lazarev/cerberus-wallet-part-4-backend-development-5a04bfdd7f1e?source=rss-254bf7e1132d------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a04bfdd7f1e</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[push-notification]]></category>
            <dc:creator><![CDATA[Mikael Lazarev]]></dc:creator>
            <pubDate>Thu, 07 Nov 2019 11:40:33 GMT</pubDate>
            <atom:updated>2019-11-07T11:40:33.469Z</atom:updated>
            <content:encoded><![CDATA[<p>For the backend, I decided to use Golang for the following reasons:</p><ul><li>It uses strong typing, which means that many errors will be excluded at the compilation stage.</li><li>In my experience it works very stably in production</li><li>It’s convenient to use goroutines to monitor transactions.</li></ul><p>I use MongoDB to store information, and go-ethereum to work with ether</p><h4><strong>User authorisation / registration</strong></h4><p>The current version uses simple login / password authorisation using JWT tokens. Authorisation is required in order to transfer the list of user wallets and provide the ability to receive data. Currently, the binding of wallets to the token for push notifications also uses authorisation.</p><h4><strong>Transaction monitoring</strong></h4><p>The Cerberus Wallet server saves all user wallets and constantly monitors events at connected addresses. To monitor events for each wallet, a separate goroutine is used.</p><p>As soon as the NewPaymentRegistered event occurs, the server sends a push notification to all devices connected by the user. The structure of push notifications includes a code that must be entered to confirm the transaction (more simple logic is currently implemented).</p><h4><strong>Sending push notification</strong></h4><p>As you know, the push notification delivery system is quite reliable and has proven itself in banking applications. In this version I developed only iOS notifications.</p><p>To implement iOS push notifications you need an Apple Developer account and have registered your application.</p><p>Also, in addition to sending push notifications, the system can send notifications to email clients, via SMS and instant messengers (a number of these functions are under development)</p><h4><strong>Transaction Confirmations</strong></h4><p>When the monitoring system detects a new transaction, a push notification is sent to the user, and the transaction itself falls into the list of transactions for confirmation.</p><p>If the user logged in to the application within the specified time, the system will mark this in the database and confirm it upon request from the Oracle Cerberus.</p><p>At the same time, the logic is arranged in such a way that if at least one device rejected the transaction, then it is already impossible to confirm it. This is done to provide greater security.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a04bfdd7f1e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cerberus Wallet. Part 3. Designing a mobile application]]></title>
            <link>https://medium.com/@mikael.lazarev/cerberus-wallet-part-3-designing-a-mobile-application-9b8ba6d04c14?source=rss-254bf7e1132d------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b8ba6d04c14</guid>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Mikael Lazarev]]></dc:creator>
            <pubDate>Tue, 05 Nov 2019 19:31:08 GMT</pubDate>
            <atom:updated>2019-11-06T07:57:24.315Z</atom:updated>
            <content:encoded><![CDATA[<p>This this the third part of series of articles is devoted to the development of the Cerberus Wallet project, which uses crypto transactions for two-factor authorization.</p><p>In this article we will talk about product design for mobile application. IMHO, many interesting crypto applications have poor UX design, and sometimes it’s difficult to use them for non tech-savvy users. So, designing a mobile application, I set the following tasks for myself:</p><ul><li>Convenient and simple interface.<br><em>I like simple applications that perform understandable actions and are not overloaded with “a million features”.</em></li><li>Easy portability on iOS and Android <br><em>This will provide more application coverage</em></li><li>Simple and fast onboarding process<br><em>Even a tech-savvy user should easily understand the app and start using it.</em></li></ul><p>Based on these requirements, I chose React Native, because, firstly, the application can be released for both iOS and Android with minor changes. Secondly, for React Native there are many ready-made libraries, including those for interacting with Web3.</p><p>For the first version, we restrict the following functionality:</p><ul><li>Display a list of recent transactions</li><li>Confirm / Cancel signed transactions</li><li>Display list of connected wallets (accounts)</li><li>Add a new account (wallet)</li><li>Receive push transaction notifications.</li></ul><p>To implement the functionality, it is convenient to use Tab Navigation and three main screens: Transactions, Wallets (Accounts) and Settings. The first version of the user experience flow :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RHFKqFFEHZjv3gksPf_y9Q.jpeg" /></figure><h4>Transaction confirmation flow</h4><p>On the Transaction tab a you could see a list of recent transactions. When you click on a transaction, you will go to the confirmation screen and check whole transaction information. If the transaction is yours, then he clicks confirm. If the transaction is fraudulent, then he clicks cancel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*xbK9tgzCk8fJHz5_D7ZkLg.png" /><figcaption>First transaction confirmation flow mockup</figcaption></figure><p>To improve protection, the following logic has been implemented: a confirmed transaction can be canceled (during confirmation time), but a canceled one cannot be re-confirmed.</p><h4>What to do if your wallet is “hacked” usecase</h4><p>Only those transactions that are signed by the private key are included in the list of transactions, which means that if there appeared a transaction that the owner did not create, then someone knows his private key, and further use of such a wallet is extremely unsafe.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/0*E4yHXWnuCxGGj_Pm.jpg" /></figure><p>In accordance with this logic, upon receiving the first call, the Client creates a new key / wallet and transfers funds to it from this one, leaving the account zero. The advantage of such a system is that information that someone knows your key is made available to you and you can take welcome measures to protect other assets.</p><h4>Wallet connection flow</h4><p>In the first version of the application, I planned to make a big flow for fine-tuning the wallet and its warm from the application:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xS4r2oIapO9ApXOHAZd8Eg.png" /></figure><p>Later, I abandoned this idea, as it became clear that the wallet itself should use the web (metamask) — this is good practice from a security point of view (it is possible to sign transactions using ledger-for example).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MXqMOlbfNMW3au3dczku7Q.jpeg" /><figcaption>Cerberus Wallet Application Screenshot</figcaption></figure><p>Then the idea was born to make a simple flow — to add a wallet, the user only needs to scan it. Developing a past application, I went over several QR-code scanners and chose QR-Scanner (<a href="https://github.com/moaazsidat/react-native-qrcode-scanner">https://github.com/moaazsidat/react-native-qrcode-scanner</a>)</p><p>The next important UX element is an alert, which the user receives after scanning a QR code. This is important, because there may be an error during scanning, and with such Alert the user can always verify the scanned address with what is on his contract.</p><p>If the user selects this address, the application transfers the address to the backend, where it is attached to the user and added to the monitoring system.</p><h4>Panic Mode. User Nervous Care</h4><p>In the current version, I have not yet managed to really implement it — but the presence of PanicMode seems to me an important decision. Imagine that you are in the mountains, in a forest, or in another place with poor communication. And you received a message that someone is trying to transfer your funds. Of course you will click on cancel, but this will add to your concern — after all, information about transactions and lost funds will bother you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/0*MqSt6WNzswi0Or9a.jpg" /></figure><p>By pressing Panic Mode, the user blocks any confirmations for a day and can be calm that the Cerberus server will respond to oracle requests that the transaction has not been completed. In the future, it is planned to connect a special role for the backend in the Smart Contract, which will be able to block transactions for 24 hours. This will further improve the protection of Clients funds.</p><h4>Smart Contract Security Alert (planned)</h4><p>It is also planned to add to the application an additional notification function about possible vulnerabilities and notifications of problems found in the smart contract.</p><p>Having received such a warning, the user will be able to populate a new protected smart contract and transfer his funds there or simply return them to his account.</p><p>In next article we’ll talk about backend development.</p><p>Stay tuned!</p><p>Full code of mobile application could be found on GitHub: <a href="https://github.com/MikaelLazarev/cerberus/tree/master/mobile">https://github.com/MikaelLazarev/cerberus/tree/master/mobile</a></p><h3>All Cerberus Wallet articles:</h3><p><a href="https://medium.com/@mikael.lazarev/cerberus-wallet-part-1-concept-925b80898ca0?sk=c1dd6a5fccc9645107f300bea2594533">Part 1. Concept</a><br><a href="https://medium.com/@mikael.lazarev/cerberus-wallet-part-2-development-of-a-smart-contract-and-external-adapter-for-chainlink-57ecefa0aa98?sk=576081351c5df662a2c48d95718bcd9c">Part 2. Development of a smart contract and external adapter for ChainLink</a><br><a href="https://medium.com/@mikael.lazarev/cerberus-wallet-part-3-designing-a-mobile-application-9b8ba6d04c14?sk=5a901baa47d86353330c2aeca9b1ce9b">Part 3. Designing a mobile application</a><br>Part 4. Backend<br>Part 5. Demo wallet<br>Part 6. Conclusion. Future of the project</p><h3>About Cerberus Wallet:</h3><p>Cerberus Wallet is open source project which adds two factor authentification for your crypto wallet. Even if your private key would be stolen, hacker would not be able to transfer your assets without your confirmation.</p><p>This application was designed from scratch especially for <a href="https://coinlist.co/build/chainlink/">Chainlink + CoinList Hackathon</a>.</p><p>Official site: <a href="https://cerberus.ledger-labs.com/">https://cerberus.ledger-labs.com/</a></p><p>Video presentation: <a href="https://www.youtube.com/watch?v=4S8OyUf7cIA">https://www.youtube.com/watch?v=4S8OyUf7cIA</a></p><p>If you like this project, please vote for it: <a href="https://coinlist.co/build/chainlink/projects/44b65d6e-02f3-40de-b3cc-40d905da76cf">https://coinlist.co/build/chainlink/projects/44b65d6e-02f3-40de-b3cc-40d905da76cf</a></p><h3>Join Cerberus Wallet team:</h3><p>CerberusWallet is an open source project. If you are interested in join the team, please contract me at t.me/@mikael_l. Together, we could create a much-needed technology and make crypto currency safer.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b8ba6d04c14" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cerberus Wallet. Part 2. Development of a smart contract and external adapter for ChainLink]]></title>
            <link>https://medium.com/@mikael.lazarev/cerberus-wallet-part-2-development-of-a-smart-contract-and-external-adapter-for-chainlink-57ecefa0aa98?source=rss-254bf7e1132d------2</link>
            <guid isPermaLink="false">https://medium.com/p/57ecefa0aa98</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[product-management]]></category>
            <dc:creator><![CDATA[Mikael Lazarev]]></dc:creator>
            <pubDate>Tue, 05 Nov 2019 19:10:04 GMT</pubDate>
            <atom:updated>2019-11-06T07:39:28.146Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a continuation of the article on the development of <a href="https://cerberus.ledger-labs.com/">Cerberus Wallet</a>, the beginning can be read at the link: <a href="https://medium.com/@mikael.lazarev/cerberus-wallet-part-1-concept-925b80898ca0?sk=c1dd6a5fccc9645107f300bea2594533">Cerberus Wallet. Part 1. Concept</a>.</p><p><strong>Architecture<br></strong>Developing the contract, I initially wanted to create a large contract that would manage the funds of many users. However, as we know — the more funds on the contract — the higher the chance that it will become a target for hackers.</p><p>Therefore, as an implementation, I chose the option in which each user deploys his own wallet and integrates it with the Cerberus Wallet system. In the future, it is planned to add a bytecode control system in which Cerberus Wallet will verify that the user has installed the correct bytecode.</p><h4><strong>Why a reliable ChainLink oracle system is crucial for this solution</strong></h4><p>Smart Contracts provide the ability to execute tamper-proof digital agreements, which are considered highly secure and highly reliable. In order to maintain a contract’s overall reliability, the inputs and outputs that the contract relies on also need to be secure. Chainlinks provide a reliable connection to external data that is provably secure end-to-end.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9g-Q3buYiNacKnze.png" /></figure><p>In order to receive transaction confirmation, it is very important to have an oracle service that you can trust. Moreover, in order to increase the reliability of the system, this service should be independent of Cerberus Wallet, so that in the event of a hacking of Cerbrus Wallet, attackers do not gain access to the entire system.</p><p>Another ChainLink advantage is its large community and team, which is working on improving the service and checking it for possible volnurabilities.</p><p>It’s also important that if the Cerberus Wallet service is unavailable or a DDOS attack is carried out on it, user funds will not be affected — after all, a smart contract will not transfer without receiving confirmation.</p><p><strong>First draft of smartcontract<br></strong>So, the idea is that user who signed a transaction would have to give confirmation within a specified period (3–5 minutes) and if confirmation is given, then the smart contract would do the transfer.</p><p>I decided to use the <a href="https://docs.chain.link/docs/chainlink-alarm-clock">ChainLink Alarm Clock</a> to implement confirmation delay. This problem can be solved through a repeated transaction, which the user will send after a specified time. However, such a solution greatly spoils the Customer Experience and makes the product complicated and inconvenient.</p><p>After the expiration of the confirmation time, the contract must verify that the confirmation has been received and transfer the funds, if everything is ok.</p><p>In order not to complicate, we will limit the current version of the contract to two functions: deposit money on it and transfer funds to other accounts.</p><h4><strong>Implementation</strong></h4><p>To start development with ChainLink you could download a convenient truffle box:</p><pre>truffle unbox smartcontractkit/chainlink</pre><p>After that you can modify a contract which is provided in the box. I hope you are familiar with Solidity, so let’s focus on interactions with oracles. Here ChainLink is similar to many frameworks for generating requests (requests (python), fetch (js), Alamofire (Swift), etc.).</p><p>Let’s check how to interact with ChainLink Alarm Clock as an example. At first, you should create a request:</p><pre>Chainlink.Request memory req = buildChainlinkRequest(cerberusJobId, this, this.fulfillPaymentRequest.selector);</pre><p>Here:<br><em>AlarmJobId</em> — the identifier for the oracle function (numeric value). You can find it in the documentation, for your services you will receive it during deployment.</p><p><em>this.fulfillConfirmationRequest.selector </em>— callback function of your contract, which will be called after execution.</p><p>After then, you can add parameters for you request:</p><pre>req.add(&quot;id&quot;, bytes32ToStr(_requestId));</pre><p>These parameters would be added to request which will be made by oracle to extrenal API. At the end, you should send the request using the command and get request id which could be used to recognise response:</p><pre>bytes32 reqID = sendChainlinkRequestTo(cerberusOracle, req, cerberusPayment);</pre><p>Here: <br><em>alarmOracle</em> — oracle address to which the request is sent<br><em>alarmPayment </em>— the amount of compensation in LINK tokens for its execution (1 LINK per request for now).</p><p>It’s very convenient way to make requests to external API. <br>If you are going to use your own API, you have to provide specifications (a JSON file which is described <a href="https://docs.chain.link/docs/job-specifications">here</a> and deploy your bridge to ChainLink node).</p><h4>Sending Bytes32 values</h4><p>Developing this smartcontract I had one interesting issue — I needed to use bytes32 value as request parameter. There is no way to simply add bytes32 as request parameters, so I had to convert bytes32 to string.</p><p>Dy default solidity 4.24 doesn’t provide such function from the box, so I had to write my own function to convert bytes32 to string which could be compatible with URL. My implementation:</p><pre>function bytes32ToStr(bytes32 _bytes32) public pure returns (string) {<br><br>  bytes memory bytesArray = new bytes(64);<br>  for (uint256 i; i &lt; 32; i++) {<br>    bytesArray[2*i] = bytes1(uint8(_bytes32[i] &amp; 240 ) / 16 + 65);<br>    bytesArray[2*i+1] = bytes1(uint8(_bytes32[i] &amp; 15) + 65);<br><br>  }<br>  return string(bytesArray);<br>}</pre><h3><strong>How contract works</strong></h3><p>The full version of the contact can be found on GitHub: <a href="https://github.com/MikaelLazarev/cerberus/blob/master/contract/contracts/CerberusWallet.sol">https://github.com/MikaelLazarev/cerberus/blob/master/contract/contracts/CerberusWallet.sol</a></p><p><strong>Deposit money flow<br></strong>Everything is simple here — the usual function for receiving funds.</p><p><strong>Sending money flow</strong></p><ol><li>To send funds, the user calls method <em>sendMoney(address _to, uint256 _amount)</em></li></ol><p>2. The sendMoney method, in turn, emits a <em>NewPaymentRegistered</em> event, which is used to monitor transactions.</p><p>3.<em> sendMoney</em> method also calls ChainLink Alarm Oracle and asks to call the <em>fulfillConfirmationRequest</em> method after the specified time (time to sign the transaction). The method also writes transaction parameters to mapping orders by the key that it received during the request (reqId)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qYuNhdpZ662wIQ88rq2SvA.png" /></figure><p>4. After the specified time has passed, the fulfillConfirmationRequest method is called, which sends a request to Cerberus Oracle to find out if the user has signed the transaction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dp93XCqSirvUq5v0LIBOSw.png" /></figure><p>5. The oracle calls the <em>fulfillPaymentRequest</em> method and passes the result of the confirmation request to the server as the <em>_data</em> parameter. If the answer is yes, then the funds are transferred to the specified address.</p><p><strong>External Adapter</strong></p><p>The task of the external adapter is to make a GET request to the Cerberus Server and pass the received value back to the oracle. For this, the project uses the Bridges framework (<a href="https://github.com/linkpoolio/bridges">https://github.com/linkpoolio/bridges</a>), which makes this task elementary.</p><p>You need to add add bridges library and inherit two methods Run &amp; Opts. Full code could be found at: <a href="https://github.com/MikaelLazarev/cerberus/tree/master/adapter">https://github.com/MikaelLazarev/cerberus/tree/master/adapter</a></p><p>In the <a href="https://medium.com/@mikael.lazarev/cerberus-wallet-part-3-designing-a-mobile-application-9b8ba6d04c14?source=friends_link&amp;sk=5a901baa47d86353330c2aeca9b1ce9b">next article</a> we’ll discuss mobile app design!</p><p>Stay tuned!</p><h4><strong>All Cerberus Wallet articles:</strong></h4><p><a href="https://medium.com/@mikael.lazarev/cerberus-wallet-part-1-concept-925b80898ca0?sk=c1dd6a5fccc9645107f300bea2594533">Part 1. Concept</a><br><a href="https://medium.com/@mikael.lazarev/cerberus-wallet-part-2-development-of-a-smart-contract-and-external-adapter-for-chainlink-57ecefa0aa98?sk=576081351c5df662a2c48d95718bcd9c">Part 2. Development of a smart contract and external adapter for ChainLink</a><br><a href="https://medium.com/@mikael.lazarev/cerberus-wallet-part-3-designing-a-mobile-application-9b8ba6d04c14?sk=5a901baa47d86353330c2aeca9b1ce9b">Part 3. Designing a mobile application</a><br>Part 4. Backend<br>Part 5. Demo wallet<br>Part 6. Conclusion. Future of the project</p><h4><strong>About Cerberus Wallet:</strong></h4><p>Cerberus Wallet is open source project which adds two factor authentification for your crypto wallet. Even if your private key would be stolen, hacker would not be able to transfer your assets without your confirmation.</p><p>This application was designed from scratch especially for <a href="https://coinlist.co/build/chainlink/">Chainlink + CoinList Hackathon</a>.</p><p>Official site: <a href="https://cerberus.ledger-labs.com/">https://cerberus.ledger-labs.com/</a></p><p>Video presentation: <a href="https://www.youtube.com/watch?v=4S8OyUf7cIA">https://www.youtube.com/watch?v=4S8OyUf7cIA</a></p><p>If you like this project, please vote for it: <a href="https://coinlist.co/build/chainlink/projects/44b65d6e-02f3-40de-b3cc-40d905da76cf">https://coinlist.co/build/chainlink/projects/44b65d6e-02f3-40de-b3cc-40d905da76cf</a></p><h4>Join Cerberus Wallet team:</h4><p>CerberusWallet is an open source project. If you are interested in join the team, please contract me at t.me/@mikael_l. Together, we could create a much-needed technology and make crypto currency safer.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=57ecefa0aa98" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cerberus Wallet. Part 1. Concept]]></title>
            <link>https://medium.com/@mikael.lazarev/cerberus-wallet-part-1-concept-925b80898ca0?source=rss-254bf7e1132d------2</link>
            <guid isPermaLink="false">https://medium.com/p/925b80898ca0</guid>
            <category><![CDATA[chain-link]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[product-management]]></category>
            <dc:creator><![CDATA[Mikael Lazarev]]></dc:creator>
            <pubDate>Tue, 05 Nov 2019 18:49:48 GMT</pubDate>
            <atom:updated>2019-11-06T07:38:24.386Z</atom:updated>
            <content:encoded><![CDATA[<p>On an autumn evening, on the CoinList website, I discovered information about ChainLink + CoinList Hackathon, and after reading about the ChainLink project and imagining what great opportunities it opens up to the possibility of integrating the blockchain with information from the real world, I decided to participate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I0akgn3ILrkipXsImMmD5g.png" /></figure><p>While working on this project, I set myself the task of creating a product that could be potentially demanded by the widest possible audience. Of course, using smart contracts, you can easily develop complex financial services, however on me previous experience of promoting the Tokenstarter (<a href="http://tokenstarter.io/">tokenstarter.io</a>) service (protecting the interests of investors by issuing options for tokens), which we developed with my team, I learned that it is extremely important to test hypotheses at the start and try to make a product as simple, understandable and user-friendly.</p><p>To find an idea, I decided to set myself the following restrictions:</p><ul><li>The product must be understandable and relevant to a wide audience.</li><li>The product must carry value for the crypto community</li><li>The product must pass a <a href="https://medium.com/behavior-design/the-toothbrush-trick-used-by-googles-ceo-to-get-customers%20-to-come-back-910d81c272b4">toothbrush test</a>: “something you will use once or twice a day.”</li></ul><p>After spending several days and making a list of possible ideas, I read facebook and stumbled upon a post of my friend that all his crypto assets was stolen:</p><blockquote>Have you ever heard an adult uncle scream? And my neighbours heard. Not the most pleasant sight. You start to panic, hysteria, stupid. Despite the fact that in emergency situations you consider yourself a specialist, when it concerns you and only you, everything is a little different. Control is lost. Yes, this situation is not a matter of life and death (no matter how it may seem), but rather a matter of losing financial independence.</blockquote><blockquote>At the end of August, they hacked my computer and stole 99% of my funds. By the way … the most common compassionate question: “Well, how much?” \ “How many zeros — 1,2,10?” — do you have nothing to do? For your reassurance — there is not not 10, but not 1 either.</blockquote><blockquote>…<br>Everything happened like this:<br>In the morning, without doubting anything, I drank my portion of coffee (I lie, I do not drink coffee), and went about my usual business. For lunch, I made a DAI translation and exchanged them for ETH through the Kyber Swap on-line application. By the way, at first I sinned greatly on them. By the way, they didn’t answer so much.</blockquote><blockquote>After 6–7 hours, I was going to make another transaction, and one of my wallets gave me a balance error. I tried more and more. No, he stubbornly said that there was nothing there. At that moment, I started to get a little worried, opened Etherscan and realized that there was definitely nothing there. More precisely on this wallet. At first I smiled and reloaded the page, then again. Then erased the cookies. Then, realizing that I’m nervous … in general, it does not matter. I realized that they took everything away from this wallet (not counting a couple of shit tokens that could not be withdrawn). In a panic, I wrote a cyber swap to both soap and twitter (they answered after 3 days to a letter saying that everything is ok).</blockquote><blockquote>And then the fun began. At first, I was sure that we were talking about one Ethereum wallet. But after 10 minutes, I (for security reasons) began to open others … and here, as they say, “I got bored,” or rather … no. Panic, hysteria … well, and all that is already described above.</blockquote><blockquote>After some time, I realized (well, or at least it dawned on me) that there was already nothing special to save. The rest of the evening I spent in a trance between this awareness and its absence.</blockquote><p>This post gave me the idea of ​​creating an application that can help any cryptocurrency owner to make its ownership more secure and avoid such situations.</p><p>So, briefly, this idea can be described as “two-factor activation for crypto transactions”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/0*1kvSgyPhmfCagx8E.jpg" /><figcaption>Two factor authorisation</figcaption></figure><p><strong>Formulating the problem<br></strong>Cryptocurrency security is based on the idea that only you have access to the private key. And indeed, today it is impossible to pick up a private key, knowing the public one.</p><p>Despite this, for daily transactions, you must store the private key on your computer or smartphone. Often, hackers gain access to a private key using viruses or trojans.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-Cb09F568kKG-3J1.jpg" /></figure><p>To ensure safety you must follow a lot of rules. One small mistake (for example, accidentally opening a file sent by e-mail) can lead to a complete loss of all crypto assets.</p><p>In addition, you cannot verify that your private key is cracked. Some hackers can store it and control your account to get the most money.</p><h4>Solution</h4><p>Two-factor authorization. In order to transfer funds, you need to confirm the transaction using the Cerberus Wallet mobile application within 3–5 minutes after it got into the blockchain. When the time is up, the smart contract checks the confirmation and sends the money only if the transaction has been confirmed.</p><p>This approach significantly increases the security of a crypto wallet, since two conditions must be met to transfer money:</p><ul><li>Know private key</li><li>Confirm transaction using smartphone</li></ul><p>In addition, if you receive a notification that someone signed a transaction using your private key, it means that your private key has been hacked. Unlike a regular crypto wallet, you can cancel this transaction and then transfer your money to a secure wallet or account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*JXtwMdeTQCK_8WyY.png" /></figure><p><strong>Hypothesis test<br></strong>Before implementing this project, I decided to test the idea on real users and conducted an interview with my friends, and was pleasantly surprised by the reaction — most of them spoke very positively, and most importantly said that they were ready to try MVP when it was ready.</p><p>During the interview, I collected several more insights:</p><ul><li>It’s important that the project is open source — it’s easier to get trust</li><li>It is important that the binding to the phone number is not used — not everyone is ready to associate themselves with wallets</li><li>Using the email confirmed that ok — it is important that you can also receive notifications from transactions on it.</li></ul><p>In the <a href="https://medium.com/@mikael.lazarev/cerberus-wallet-part-2-development-of-a-smart-contract-and-external-adapter-for-chainlink-57ecefa0aa98?source=friends_link&amp;sk=576081351c5df662a2c48d95718bcd9c">next article</a>, I will talk about the development of a smart contract and why a reliable <a href="http://chain.link/">ChainLink</a> oracle system is crucial for this solution.</p><p>Stay tuned!</p><h4>All Cerberus Wallet articles:</h4><p><a href="https://medium.com/@mikael.lazarev/cerberus-wallet-part-1-concept-925b80898ca0?sk=c1dd6a5fccc9645107f300bea2594533">Part 1. Concept</a><br><a href="https://medium.com/@mikael.lazarev/cerberus-wallet-part-2-development-of-a-smart-contract-and-external-adapter-for-chainlink-57ecefa0aa98?sk=576081351c5df662a2c48d95718bcd9c">Part 2. Development of a smart contract and external adapter for ChainLink</a><br><a href="https://medium.com/@mikael.lazarev/cerberus-wallet-part-3-designing-a-mobile-application-9b8ba6d04c14?sk=5a901baa47d86353330c2aeca9b1ce9b">Part 3. Designing a mobile application</a><br>Part 4. Backend<br>Part 5. Demo wallet<br>Part 6. Conclusion. Future of the project</p><h4>About Cerberus Wallet:</h4><p>Cerberus Wallet is open source project which adds two factor authentification for your crypto wallet. Even if your private key would be stolen, hacker would not be able to transfer your assets without your confirmation.</p><p>This application was designed from scratch especially for <a href="https://coinlist.co/build/chainlink/">Chainlink + CoinList Hackathon</a>.</p><p>Official site: <a href="https://cerberus.ledger-labs.com/">https://cerberus.ledger-labs.com/</a></p><p>Video presentation: <a href="https://www.youtube.com/watch?v=4S8OyUf7cIA">https://www.youtube.com/watch?v=4S8OyUf7cIA</a></p><p>If you like this project, please vote for it: <a href="https://coinlist.co/build/chainlink/projects/44b65d6e-02f3-40de-b3cc-40d905da76cf">https://coinlist.co/build/chainlink/projects/44b65d6e-02f3-40de-b3cc-40d905da76cf</a></p><h4>Join Cerberus Wallet team:</h4><p>CerberusWallet is an open source project. If you are interested in join the team, please contract me at t.me/@mikael_l. Together, we could create a much-needed technology and make crypto currency safer.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=925b80898ca0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Alice, Bob and Enrico could use their social networks privately with NuCypher]]></title>
            <link>https://medium.com/@mikael.lazarev/snowden-is-a-new-way-of-sharing-your-thoughts-21b63a4bacc1?source=rss-254bf7e1132d------2</link>
            <guid isPermaLink="false">https://medium.com/p/21b63a4bacc1</guid>
            <dc:creator><![CDATA[Mikael Lazarev]]></dc:creator>
            <pubDate>Tue, 09 Apr 2019 20:58:39 GMT</pubDate>
            <atom:updated>2019-04-12T14:50:45.734Z</atom:updated>
            <content:encoded><![CDATA[<p>In March I was in Munich, me and my friends just finished our Alps vacations and have a walk in the city. The weather was good and there were a lot of people, but what I really like — there was a great meeting against censorship</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xko0uzVBwakvahpqJu9MAw.jpeg" /><figcaption>Photo of one concert place supports Tor browsing</figcaption></figure><p>Many people vote against controlling their communications in internet. Today, many IT giants tried to control what you could post, share etc. The most important point that they are private companies, so you could be banned and your messages could be deleted if somebody in these companies decides to block you.</p><p>For decades ago, society tried to control crucial infrastructure like roads, lakes, air etc. All major decisions should be agreed with public opinion. And society always struggle against with any kind of censorship to protect their rights</p><h4>Artificial Intelligence becomes new censor</h4><p>Today many companies use AI algorithms to filter what you to publish. It makes a huge impact to our freedom and ability to share our thoughts and opinions. IT Giants like Google or Facebook totally control informational space and it’s why I believe that we need new class of protection which could grant anyone a right to share you thoughts freely. Furthermore, in many countries authorities could sue you for post or joke in the net. In AI era it could be scaled and make bad impact to our freedom also.</p><h4>NuCypher technology adds new security layer</h4><p>My solution is based on NuCypher technology which gives us and ability to use end-to-end encryption with re-encryption keys. In other words, post author could encrypt the post and manage access rights.</p><p>What is more important, all rights management is online, so you could cancel subscription for some users and they could not read your posts anymore.</p><h4>Snowden solution</h4><p>Let’s check how it works from technical side. We assume that Alice, Bob and Enrico has installed Snowden Chrome Extension (check snowden.tilda.cc for details).</p><p>This extension based on Chrome Native App technology.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s991EHRyBQhGIS7tHUWVCw.png" /></figure><p>It has frontend (pop-up module) and backend which connects to an app which run natively. Pop-up provides user interface and host app used to encrypt and decrypt messages.</p><p>When host app starts first time it creates two keys. One key is used to manage your own channel (it’s called Channel Manager) and other to read messages (it’s called Channel Reader)</p><ol><li>Alice decides to write a post and open an extension. When she press encrypt button, popup app sends it to host app (via background.js) and host app encrypts this post.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*W_8FAHvAxaxjMb7EJZNV9w.png" /></figure><p>2. Encrypted post converts to real fun smiles. I chose smile cause they are fun and neutral. Nobody wants to ban a post full of smiles :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*khPYbylFo8u8tXpcDNcaxA.png" /></figure><p>At this point, NuCypher technology made a great job. Alice has establish Channel, which has Readers. So when she encrypted her post, all readers who have rights to read it — could read it. No more actions needed!</p><p>3. Alice pressed “Copy to clipboard” button and then pasted it into facebook feed.</p><blockquote>Alice published her smile post in the net. Now her facebook friends could find it. Facebook censors and all other people who are not in list could not even imagine what she wants to share!</blockquote><p>4. Bob is Alice’s friend and he is a list of her readers. He reads news feed and found her smile post. What happens later?</p><p>Snowden extension monitors news feed. When it founds encrypted posts which could be Snowden posts it runs a script which automatically tries them to decrypt. If decryption was successful — these posts are appeared in Read section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*IHQtVjO6SiIdXtBzKaz3UA.png" /></figure><p>5. Let assume that Enrico read Alice’s post and decided to blackmail Alice. If she would publish her post at Facebook, he simply could make a screenshot and blackmail her. At this point Alice manages her posts, and when Enrico would make a first attempt she could simply remove him from readers.</p><blockquote>With Snowden and NuCypher technology you could manager access rights even after your thoughts were posted! It adds additional protection from blackmail!</blockquote><p>Modern cryptography could save many people from censorship and give them a right to manage their words. It’s not a future — this solution works today.</p><p>If you like this article, please vote for this solution in CoinList Hackathon:</p><p><a href="https://coinlist.co/build/nucypher/projects/0ca13d4e-c809-482a-8ca6-1f094f74eff7">Snowden - CoinList</a></p><p>Snowden Landing Page:<a href="http://snowden.tilda.ws/">http://snowden.tilda.ws/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=21b63a4bacc1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ICO Market is Hot… Wait, Maybe Already Not?]]></title>
            <link>https://medium.com/@mikael.lazarev/ico-market-is-hot-wait-maybe-already-not-e04148fa9544?source=rss-254bf7e1132d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e04148fa9544</guid>
            <category><![CDATA[investment-fraud]]></category>
            <category><![CDATA[investment]]></category>
            <category><![CDATA[token-sale]]></category>
            <category><![CDATA[blockchain-technology]]></category>
            <category><![CDATA[ico]]></category>
            <dc:creator><![CDATA[Mikael Lazarev]]></dc:creator>
            <pubDate>Wed, 06 Dec 2017 10:49:43 GMT</pubDate>
            <atom:updated>2017-12-06T11:48:32.599Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Cn32mHqrrHJ1IOqIAEqtw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/4fsCBcZt9H8?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Roberto Júnior</a> on <a href="https://unsplash.com/?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>In January — September, the market of Initial Coin Offerings (ICO) was growing at a blinding speed. But in October its growth suddenly halted. In September tech startups raised in ICOs about $825 million, according to data website Coinschedule.com. In October the result was $600 million, and in November even more modest — about $120 million <em>(Source: </em><a href="https://www.coinschedule.com/stats.php?year=2017"><em>Coinschedule. “Cryptocurrency ICO Stats 2017”</em></a><em>)</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_97XoMp3cPCsAz3JCG6o6Q.png" /><figcaption>Source: <a href="https://www.coinschedule.com/stats.php?year=2017">Coinschedule. “Cryptocurrency ICO Stats 2017”</a></figcaption></figure><p>Yes, I know that the ICO market is proverbially volatile. In 2016 there was a big drop in ICO activity in June and July and then in December <em>(Source: </em><a href="https://www.coinschedule.com/stats.php?year=2016"><em>CoinSchedule. “Cryptocurrency ICO Stats 2016&quot;</em></a><em>)</em>. This year the market decided to take a holiday in August.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UGjo0PHVfcrRi_kIrNt8Fw.png" /></figure><p>But maybe the October decrease was not so sudden? Over the last year we saw crazy returns in the ICO market. A blind investment in every ICO, including the significant number of ICOs that failed, would have delivered an average return of 1,320%, according to venture capital firm Mangrove Capital Partners <em>(Source: </em><a href="http://docs.wixstatic.com/ugd/59bcf2_9c2ec55330ae40dd82c5d09993065bd0.pdf"><em>Mangrove Capital Partners. “Tokenization. Implication for venture capital industry”</em></a><em>)</em>.</p><h3>A Japanese Village, Paris Hilton and Venture Capital</h3><p>Yes, the ICO market is very hot. Apart from traditional players, tech startups, some exotic players also appeared on it. In November a Japanese village said that it considers a municipal ICO to revitalize its economy <em>(Source: </em><a href="https://cointelegraph.com/news/japanese-village-plans-to-conduct-ico-to-revive-its-economy"><em>CoinTelegraph. “Japanese Village Plans to Conduct ICO to Revive Its Economy”</em></a><em>)</em>. But if so, why did the market drop in October?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*8sZyhNpHB9YL6gr3n57QHw.jpeg" /><figcaption>Photo from <a href="https://cointelegraph.com/news/japanese-village-plans-to-conduct-ico-to-revive-its-economy">CoinTelegraph</a></figcaption></figure><p>Surely, there should be a lot of retail investors on this market who snap up tokens indiscriminately. That is why TV star Paris Hilton, boxer Floyd Mayweather and rap artist The Game advertise crypto companies in social media <em>(Source: </em><a href="https://cointelegraph.com/news/japanese-village-plans-to-conduct-ico-to-revive-its-economy"><em>Fortune. “Why Celebrities Like Mayweather Could Face Legal Trouble Over ICOs”</em></a><em>)</em>. Retail investors are their target audience.</p><p>That is why US, European and Japanese financial regulators have been warning about risks involved in ICOs for many months. “The price of the coin or token is typically extremely volatile and investors may not be able to redeem them for a prolonged period”, recently said the European Securities and Markets Authority said <em>(Source: </em><a href="https://www.esma.europa.eu/press-news/esma-news/esma-highlights-ico-risks-investors-and-firms"><em>ESMA. “ESMA highlights ICO risks for investors and firms”</em></a><em>)</em>.</p><p>Maybe, retail investors do not want to hear warnings, but smart money, professional investors, including venture capital, can’t ignore them. I think that it is only logical that they began to stay on sidelines several months ago and the result is that the ICO volume dropped.</p><p>Venture capital dollars may be locked up for at least three years in startups after the ICO. In some startups the lock up period can last for almost a decade. But the failure rate of startups is so high that investors can’t be sure that their money will not be burned during this period.</p><h3>“The Biggest Scam Ever”</h3><p>Between 1990 and 2010 the percentage of venture-backed startups that fail was 60 percent, says Cambridge Associates, a global investment firm based in Boston, that tracked the performance of venture investments in 27,259 startups. In 2000, during the dotcom bust the failure rate was even bigger — 79 percent <em>(Source: </em><a href="https://www.wsj.com/articles/tech-startup-values-reach-the-sky-1419900636"><em>Wall Street Journal. “Startup Values Set Records”</em></a><em>)</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qoCn9t_oRXEXz86pV0zLoA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/uXWPg9uMwt8?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Freddie Collins</a> on <a href="https://unsplash.com/?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><blockquote>“The UET ICO transparently offers investors no value, so there will be no expectation of gains,” its creator, who only goes by UET CEO, writes on its website. “Remember — this is a completely honest ICO, which means I don’t want anyone to mistakenly expect the value of the tokens to go up, either. They’re called Useless Ethereum Tokens for a reason.”</blockquote><p>It looks that the ICO boom will also result in the growth of failure rate. About 50 percent of startups fail in the in first two years, and about 30 percent — in their first year. Curiously enough, many startups that fail went through thorough due diligence conducted by venture funds.</p><p>Startups fail because there is no need on the market for their product, or they run out of cash, or they have a bad team, or get outcompeted, or lack good business model, or pricing of their product is wrong — you name it.</p><p>ICOs also fail because some of startups are a complete scam without a product. According to Jordan Belfort, known as Wolf of Wall Street, five to ten ICOs are scams. Jordan Belfort is someone to be trusted: he went to prison for 22 months for securities fraud. After release from prison in 2005 he works as a motivational speaker. He says that ICOs are the biggest scam ever and far worse than anything he was ever doing <em>(Source: </em><a href="https://www.ft.com/content/739f8954-b61a-11e7-a398-73d59db9e399"><em>Financial Times. “‘Wolf of Wall Street’ warns of impending cryptocurrencies ‘scam’”</em></a><em>)</em>.</p><p>And his words seem to be true. In the middle of November investors of Confido startup that raised $375 000 from ICO learned that the founders of the company vanished and so did their money <em>(Source: </em><a href="https://www.cnbc.com/2017/11/21/confido-ico-exit-scam-founders-run-away-with-375k.html"><em>CNBC. “Cryptocurrency start-up Confido disappears with $375,000 from an ICO, and nobody can find the founders”</em></a><em>)</em>.</p><p>ICO market is so dangerously loosely regulated that some scam startups even do not try to develop a product to offer to investors.</p><p>In July 2017 investors sunk thousands of dollars into joke tokens called Useless Ethereum Token (UET). In three days it raised about $40 000. “I realized that people didn’t really care about the product. They cared about spending a little bit of money, watching a chart and then withdrawing a little bit more money. So why not have an ICO without a product, and do so completely transparently just to see what happened?”, — said anonymous UET CEO to the New York Observer. <em>(Source: </em><a href="http://observer.com/2017/07/useless-ethereum-token/"><em>Observer. “Cryptocurrency Has Its Potato Salad Moment With the Useless Ethereum Token”</em></a><em>)</em></p><p>And you know what? The market capitalization of UET is still $45 000. It boasts the proud 942nd place on the cryptocurrency market <em>(Source: </em><a href="https://coinmarketcap.com/currencies/useless-ethereum-token/"><em>CoinMarketCap. Useless Ethereum Token</em></a><em>)</em>.</p><h3>How to Protect Investors</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NZ4buJgtaCgx5aKNn4BDfA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/uJhgEXPqSPk?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Rick Tap</a> on <a href="https://unsplash.com/?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>To protect quality investors, fundraising platform Headstart said that in December it will hold its ICO for the so-called Mother of All Tokens <em>(Source: </em><a href="http://www.digitaljournal.com/business/interview-ico-headstart-the-fundraising-platform-for-icos/article/509244"><em>Digital Journey. “ICO HeadStart, the fundraising platform for ICOs” </em></a><em>)</em>. It wants to choose the most credible ICO and recommend them to investor.</p><p>Some people think that only sophisticated investors with net assets above $1 million should be allowed to invest in ICO. Wow! The UET creator should be proud: they have just been compared to respectable hedge funds!</p><p>Surely, there should be some way to protect investors’ money. It may be some sort of insurance that will help to keep at least some money intact for a period of time. Why not to make ICO financing gradually? For example, 30 percent is invested in ICO, another 30 percent — a year later on condition that the startup demonstrates promising results and the rest — two years later (or after the startup earns its first profit)?</p><p>If not, then what?</p><p>Well, maybe, something different. About 40 years ago the futures and options market was in its childhood and resembled the current ICO market very much. It was volatile and risky. And its first regulator was itself. It was self-regulated. Among those who developed the first requirements for the futures and options market was Patrick Arbor. Later he became CBOT chairman and established the National Futures Association <em>(Source: </em><a href="https://www.cnbc.com/2015/02/06/its-hard-to-mourn-the-loss-of-open-outcry-trading-commentary.html"><em>CNBC. “It’s hard to mourn the loss of open-outcry trading”</em></a><em>)</em>.</p><p>Arbor is old and very rich now. Recently he divorced and to avoid a big divorce payout fled the US and moved his assets.</p><p>My bet is that sooner or later the ICO market will be properly regulated as well. And the person who creates such regulation will make a fortune.</p><p><em>Mikael Lazarev,<br>CEO of Tokenstarter<br></em><a href="/service/mailto: mikael.lazarev@tokenstarter.io"><em>mikael.lazarev@tokenstarter.io</em></a><em><br></em><a href="https://tokenstarter.io/"><em>tokenstarter.io</em></a><em><br></em><a href="http://t.me/tokenstarter"><em>t.me/tokenstarter</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e04148fa9544" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>