<?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 klevoya on Medium]]></title>
        <description><![CDATA[Stories by klevoya on Medium]]></description>
        <link>https://medium.com/@klevoya?source=rss-48f74a3e7d71------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*s2E6iyIjKCiNf_WN_SgHgQ.png</url>
            <title>Stories by klevoya on Medium</title>
            <link>https://medium.com/@klevoya?source=rss-48f74a3e7d71------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 12:14:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@klevoya/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[Finding Missing Auth bugs in EOSIO Smart Contracts]]></title>
            <link>https://medium.com/coinmonks/finding-missing-auth-bugs-in-eosio-smart-contracts-242400e10cdc?source=rss-48f74a3e7d71------2</link>
            <guid isPermaLink="false">https://medium.com/p/242400e10cdc</guid>
            <category><![CDATA[static-code-analysis]]></category>
            <category><![CDATA[eosio]]></category>
            <category><![CDATA[eos]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <dc:creator><![CDATA[klevoya]]></dc:creator>
            <pubDate>Mon, 08 Mar 2021 18:31:37 GMT</pubDate>
            <atom:updated>2021-03-25T05:31:24.618Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nG0HqhICo9OXaBwM.png" /></figure><p>This is a series of blog posts in which I’ll cover some common EOSIO smart contract vulnerabilities and then explain how we can use our EOSIO vulnerability scanner, <a href="https://klevoya.com/inspect/">Inspect</a>, to perform static analysis to uncover these vulnerabilities.</p><p>This week, I look at Missing Authorisations.</p><h3>The vulnerability</h3><p>In EOSIO, a developer can use two functions to control authorisation of smart contract actions by checking whether the declared authorisation of the action equals the account that should be able to run the action. These are:</p><ul><li>require_auth(account [, permission])</li><li>has_auth(account)</li></ul><p>Due to missing authorisation controls, a vulnerable smart contract grants authorisation to untrusted accounts such as malicious parties, to:</p><ul><li>access/modify privileged smart contract resources e.g. smart contract tables,</li><li>Call functions of other contracts on behalf of the vulnerable contract, or</li><li>Perform mission-critical contract actions e.g. token withdrawals.</li></ul><p>Let’s look at an example of where a smart contract is setup such that it is paying for EOSIO RAM (which is what EOSIO calls the on chain database) storage costs, in such a scenario every write to the database should be checked to ensure that the entity calling the action that contains the database write has the proper authorisation to do so. Otherwise incorrect data may be written, or a RAM filling attack (see severity below) may occur.</p><p>In the action code below, despite there being a require_auth() call prior to the emplace call (which writes data to the _users table), the user is not the RAM payer, allowing any user to write to the database using the contract account’s own RAM making the contract vulnerable to a RAM filling attack.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9a6bc7fc711ae1faf99e31038384fab6/href">https://medium.com/media/9a6bc7fc711ae1faf99e31038384fab6/href</a></iframe><p>Modifying the action so that the user pays for RAM, makes the action immune to a RAM filling attack (as the user is no longer using the contract’s resources for RAM):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ba4b9bb898f17cb36183f2b5d594f3b0/href">https://medium.com/media/ba4b9bb898f17cb36183f2b5d594f3b0/href</a></iframe><h3>Severity</h3><p>The impact of this type of vulnerability is that a hacker could:</p><ul><li>Write/modify/delete any data stored in RAM that is not adequately guarded by an appropriate authorisation check,</li><li>Call functionality that should ostensibly be reserved only for the smart contract’s administrators/privileged users,</li><li>In EOSIO RAM is not free so a hacker can fill up a smart contract’s RAM with spurious data and exhaust the dAPP’s resources leading to a denial of service for legitimate users.</li></ul><h3>Finding the vulnerability with Inspect</h3><p>Inspect employs a technique called Static analysis. Static analysis is performed by reasoning about a computer program’s source-code, or some intermediate representation, without actually executing it.</p><p>With Inspect we perform static analysis on the WASM binary code, this is decompiled and then lifted into a proprietary intermediate representation (IR). Inspect then takes the IR, represents it in a database which we can mine for patterns of known vulnerabilities.</p><p>Running Inspect on a smart contract containing the above smart contract actions gives the following result:</p><pre>Auth Violation: ✘ Action: emplaceself1 Insn: ($fel) = db_store_i64($feb, $fec, $fef, $feh, $fej, $fek)</pre><p>The first action is correctly flagged as violating the Authorisation check. As Inspect operates on the WASM byte code, it reports the violation occurring at the EOSIO intrinsic, db_store_i64(), that corresponds to the emplace() call.</p><p>The second action is not reported as it is safe.</p><p>In a real analysis scenario, the next step would be to correlate this result with the source code and confirm that this is truly a vulnerability.</p><p>What else? What vulnerabilities would you like me to cover next?</p><p><em>Originally published at </em><a href="https://klevoya.com/blog/finding-missing-auth-bugs-in-eosio-smart-contracts/"><em>https://klevoya.com</em></a><em> on March 8, 2021.</em></p><blockquote>Join Coinmonks <a href="https://t.me/joinchat/EPmjKpNYwRMsBI4p">Telegram group</a> and learn about crypto trading and investing</blockquote><h4>Also, Read</h4><ul><li><a href="https://blog.coincodecap.com/margin-trading">What is Margin Trading</a></li><li>The Best <a href="https://medium.com/coinmonks/crypto-trading-bot-c2ffce8acb2a">Crypto Trading Bot</a> | <a href="https://blog.coincodecap.com/grid-trading">Grid Trading</a></li><li><a href="https://medium.com/coinmonks/3commas-review-an-excellent-crypto-trading-bot-2020-1313a58bec92">3Commas Review</a> | <a href="https://medium.com/coinmonks/pionex-review-exchange-with-crypto-trading-bot-1e459d0191ea">Pionex Review</a> | <a href="https://medium.com/coinmonks/coinrule-review-2021-a-beginner-friendly-crypto-trading-bot-daf0504848ba">Coinrule review</a></li><li><a href="https://medium.com/coinmonks/aax-exchange-review-2021-67c5ea09330c">AAX Exchange Review</a> | <a href="https://medium.com/coinmonks/deribit-review-options-fees-apis-and-testnet-2ca16c4bbdb2">Deribit Review</a> |<a href="https://medium.com/coinmonks/ftx-crypto-exchange-review-53664ac1198f">FTX Exchange Review</a></li><li><a href="https://medium.com/coinmonks/ngrave-zero-review-c465cf8307fc">NGRAVE ZERO review</a> | <a href="https://medium.com/coinmonks/phemex-review-4cfba0b49e28">Phemex Review</a> | <a href="https://medium.com/coinmonks/primexbt-review-88e0815be858">PrimeXBT Review</a></li><li><a href="https://medium.com/coinmonks/bybit-exchange-review-dbd570019b71">Bybit Exchange Review</a> | <a href="https://medium.com/coinmonks/bityard-review-7d104239be35">Bityard Review</a> | <a href="https://blog.coincodecap.com/coinspot-review">CoinSpot Review</a></li><li><a href="https://medium.com/coinmonks/3commas-vs-pionex-vs-cryptohopper-best-crypto-bot-6a98d2baa203">3Commas vs Cryptohopper</a> | <a href="https://medium.com/coinmonks/earn-crypto-interest-b10b810fdda3">Earn crypto interest</a></li><li>The Best Bitcoin <a href="https://medium.com/coinmonks/the-best-cryptocurrency-hardware-wallets-of-2020-e28b1c124069?source=friends_link&amp;sk=324dd9ff8556ab578d71e7ad7658ad7c">Hardware wallet</a> | <a href="https://medium.com/coinmonks/bitbox02-review-your-swiss-bitcoin-hardware-wallet-c36c88fff29">BitBox02 Review</a></li><li><a href="https://medium.com/coinmonks/ledger-vs-ngrave-zero-7e40f0c1d694">Ledger vs Ngrave</a> | <a href="https://medium.com/coinmonks/ledger-nano-s-vs-x-battery-hardware-price-storage-59a6663fe3b0">Ledger nano s vs x</a></li><li><a href="https://medium.com/coinmonks/top-10-crypto-copy-trading-platforms-for-beginners-d0c37c7d698c">Crypto Copy Trading Platforms</a></li><li><a href="https://medium.com/coinmonks/coinloan-review-18128b9badc4">CoinLoan Review</a> | <a href="https://medium.com/coinmonks/youhodler-4-easy-ways-to-make-money-98969b9689f2">YouHodler Review</a> | <a href="https://medium.com/coinmonks/blockfi-review-53096053c097">BlockFi Review</a></li><li>The Best <a href="https://medium.com/coinmonks/best-crypto-tax-tool-for-my-money-72d4b430816b">Crypto Tax Software</a> | <a href="https://medium.com/coinmonks/cointracking-review-a-reliable-cryptocurrency-tax-software-5114e3eb5737">CoinTracking Review</a></li><li>Best <a href="https://medium.com/coinmonks/top-5-crypto-lending-platforms-in-2020-that-you-need-to-know-a1b675cec3fa">Crypto Lending Platforms</a> | <a href="https://medium.com/coinmonks/leveraged-token-3f5257808b22">Leveraged Token</a></li><li><a href="https://medium.com/coinmonks/blockfi-vs-celsius-vs-hodlnaut-8a1cc8c26630">BlockFi vs Celsius</a> | <a href="https://medium.com/coinmonks/hodlnaut-review-best-way-to-hodl-is-to-earn-interest-on-your-bitcoin-6658a8c19edf">Hodlnaut Review</a></li><li><a href="https://medium.com/coinmonks/bitsgap-review-a-crypto-trading-bot-that-makes-easy-money-a5d88a336df2">Bitsgap review</a> | <a href="https://medium.com/coinmonks/quadency-review-a-crypto-trading-automation-platform-3068eaa374e1">Quadency Review</a> | <a href="https://medium.com/coinmonks/bitbns-review-38256a07e161">Bitbns Review</a></li><li><a href="https://medium.com/coinmonks/ellipal-titan-review-85e9071dd029">Ellipal Titan Review</a> | <a href="https://medium.com/coinmonks/secux-stone-hardware-wallet-review-15-discount-coupon-2020-7577032faa6e">SecuX Stone Review</a></li><li><a href="https://medium.com/coinmonks/localbitcoins-review-6cc001c6ed56">LocalBitcoins Review</a> | <a href="https://blog.coincodecap.com/cryptocurrency-savings-accounts">Cryptocurrency Savings Accounts</a></li><li>Best <a href="https://bitquery.io/blog/best-blockchain-analysis-tools-and-software">Blockchain Analysis</a> Tools | <a href="https://medium.com/coinmonks/earn-bitcoin-6e8bd3c592d9">Earn Bitcoin</a></li><li><a href="https://medium.com/coinmonks/crypto-arbitrage-guide-how-to-make-money-as-a-beginner-62bfe5c868f6">Crypto arbitrage</a> Guide | <a href="https://medium.com/coinmonks/how-to-short-bitcoin-568a2d0b4ae5">How to Short Bitcoin</a></li><li>Best <a href="https://medium.com/coinmonks/what-are-the-best-charting-platforms-for-cryptocurrency-trading-85aade584d80">Crypto Charting Tool</a> | <a href="https://medium.com/coinmonks/crypto-exchange-dd2f9d6f3769">Best Crypto Exchange</a></li><li><a href="https://medium.com/coinmonks/buy-bitcoin-in-india-feb50ddfef94">How to buy Bitcoin in India?</a> | <a href="https://medium.com/coinmonks/wazirx-review-5c811b074f5b">WazirX Review</a></li><li><a href="https://medium.com/coinmonks/bitcoin-exchange-in-india-7f1fe79715c9">Bitcoin exchange in India</a> | <a href="https://medium.com/coinmonks/bitcoin-savings-account-e65b13f92451">Bitcoin Savings Account</a></li><li><a href="https://medium.com/coinmonks/coindcx-review-8444db3621a2">CoinDCX Review</a> | <a href="https://blog.coincodecap.com/crypto-margin-trading-exchanges">Crypto Margin Trading Exchanges</a></li></ul><blockquote><a href="https://medium.com/coinmonks/newsletters/coinmonks">Get Best Software Deals Directly In Your Inbox</a></blockquote><figure><a href="https://medium.com/coinmonks/newsletters/coinmonks"><img alt="" src="https://cdn-images-1.medium.com/max/584/1*BoDnKUyK8p4hitHAJZ5Pdw.png" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=242400e10cdc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/finding-missing-auth-bugs-in-eosio-smart-contracts-242400e10cdc">Finding Missing Auth bugs in EOSIO Smart Contracts</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[Klevoya brings the power of automated vulnerability analysis to EOSIO smart contracts]]></title>
            <link>https://klevoya.medium.com/klevoya-brings-the-power-of-automated-vulnerability-analysis-to-eosio-smart-contracts-41061b724a88?source=rss-48f74a3e7d71------2</link>
            <guid isPermaLink="false">https://medium.com/p/41061b724a88</guid>
            <category><![CDATA[eos]]></category>
            <category><![CDATA[eosio]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <dc:creator><![CDATA[klevoya]]></dc:creator>
            <pubDate>Thu, 25 Feb 2021 18:27:46 GMT</pubDate>
            <atom:updated>2021-03-24T17:30:19.320Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*byqqfYUvTmJpLyIn.png" /></figure><p>The growth of blockchain applications has resulted in increasing amounts of value being controlled by smart contracts. Making smart contracts very lucrative targets for bad actors looking to exploit any vulnerabilities for quick profit. A successful smart contract exploit can have a disastrous effect on the value of the application’s token.</p><p>To help developers catch smart contract bugs early in the development cycle, we are pleased to announce the open availability of Inspect, our automated smart contract analysis tool. Inspect performs static analysis of EOSIO WASM bytecode, mining the smart contract binaries for security bugs and flagging them to the developer before they find their way into production.</p><p>If you’re in charge of securing your blockchain applications security then you’ll want to take a look at:</p><ul><li>The Inspect <a href="https://docs.klevoya.com/inspect/about/getting-started">Getting started document</a> with examples of usage</li><li>The open-source <a href="https://github.com/klevoya/eosio-wcr-registry">database of common EOSIO vulnerabilities</a>, many of which Inspect automatically identifies</li></ul><p>Sign up for Inspect <a href="https://klevoya.com/inspect/">here</a>.</p><p>For further details and questions about Inspect then <a href="https://t.me/klevoya">join the discussion</a>.</p><p><em>Originally published at </em><a href="https://klevoya.com/blog/inspect-smart-contract-automated-analysis/"><em>https://klevoya.com</em></a><em> on February 25, 2021.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41061b724a88" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing faster Hydra test execution and support for LiquidApps vRAM]]></title>
            <link>https://klevoya.medium.com/announcing-faster-hydra-test-execution-and-support-for-liquidapps-vram-144d697ad566?source=rss-48f74a3e7d71------2</link>
            <guid isPermaLink="false">https://medium.com/p/144d697ad566</guid>
            <category><![CDATA[liquidapps]]></category>
            <category><![CDATA[eosio-tools]]></category>
            <category><![CDATA[eosio]]></category>
            <dc:creator><![CDATA[klevoya]]></dc:creator>
            <pubDate>Wed, 24 Feb 2021 16:36:37 GMT</pubDate>
            <atom:updated>2021-03-24T17:23:45.853Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*j3siGgEo4Sx9gKM9.png" /></figure><p>At Klevoya we already provide a free version of our Hydra EOSIO smart contract test environment. Hydra allows you to quickly run unit tests, without requiring a local development node and easily integrate your tests within a CI/CD environment. Developers using Hydra have seen a significant improvement in the time they need to develop their smart contract test suites.</p><h3>Speed improvement</h3><p>But what if your current Hydra test suite takes too long to execute?</p><p>To solve that we now offer a premium service; Hydra Advanced which (depending on your location) can give you a 3–5x speed-up in the time to execute your tests.</p><p>You can sign-up for Hydra Advanced <a href="https://klevoya.com/hydra/">here</a>.</p><h3>vRAM support</h3><p><a href="https://liquidapps.io/vRam">vRAM by LiquidApps</a> is an alternative memory solution for EOSIO developers building blockchain dApps that is RAM-compatible, decentralized, and enables storing &amp; retrieving of potentially unlimited amounts of data affordably and efficiently.</p><p>Developing and testing of vRAM enabled smart contracts is not easy as it requires setting up and running a local DSP node which is even more complicated than running a regular EOSIO node.</p><p>Today we are pleased to announce that Hydra supports vRAM, all through the same easy interface that developers are used to.</p><p>To see how you can integrate vRAM into your smart contract tests check out <a href="https://docs.klevoya.com/hydra/liquidapps/vram">these examples</a> in the Hydra documentation.</p><p>For further details and support with these features then <a href="https://t.me/klevoya">join the discussion</a>.</p><p><em>Originally published at </em><a href="https://klevoya.com/blog/announcing-hydra-support-for-liquidapps-vram/"><em>https://klevoya.com</em></a><em> on February 24, 2021.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=144d697ad566" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[11 things to do before deploying smart contracts]]></title>
            <link>https://klevoya.medium.com/11-things-to-do-before-deploying-smart-contracts-888f6e2c3d9d?source=rss-48f74a3e7d71------2</link>
            <guid isPermaLink="false">https://medium.com/p/888f6e2c3d9d</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[eosio]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[eos]]></category>
            <dc:creator><![CDATA[klevoya]]></dc:creator>
            <pubDate>Mon, 27 Jul 2020 15:53:13 GMT</pubDate>
            <atom:updated>2020-08-17T09:25:35.141Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/940/0*nUb5If8m4rF7dOq5.png" /></figure><p>You’ve just finished the development of your smart contract and you’re ready to release it for the whole world to use. But before you do, take a step back and make sure you have all the bases covered. Deploying your contract to production is a big step with (literally) a lot at stake and can be a scary and daunting task. Especially in the blockchain world, where one regularly reads about smart contract hacks involving millions of stolen funds.</p><p>That’s why we’ve put together a checklist on things you should do before releasing your smart-contracts.</p><h3>1) Follow coding best practices</h3><p>Make sure that your contract follows coding best practices. This usually leads to cleaner code which in return leads makes spotting bugs easier.</p><h3>2) Compile production build</h3><p>If your contract has certain code paths that are only used for testing make sure they are removed or turned off by defining C++ (for EOSIO) macros for production builds.</p><h3>3) Implement a safety switch</h3><p>You never know if and when something will go wrong with your contract. Therefore (depending on your project) it may make sense to add a pause button that will stop all your other actions from executing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*Z_YBamm80XBgLsH5.png" /></figure><h3>4) Thoroughly unit-test your contract</h3><p>Code rarely works perfectly the first time. The best way to catch bugs early is by writing unit tests while developing your smart contract. For EOSIO smart contracts our tool <a href="https://klevoya.com/hydra">Hydra </a>can help you with this.</p><h3>5) Beta-test on a testnet</h3><p>Before deploying your smart contracts to production on a main-net, roll them out to beta testers on a test-net. You’ll get valuable feedback that isolated unit tests cannot provide.</p><h3>6) Run automated vulnerability scanners</h3><p><a href="https://klevoya.com/blog/check-smart-contract-for-bugs/">Running automated vulnerability scanners</a> on your smart contract code doesn’t require much effort and results in a fast security check that can detect common vulnerabilities.</p><h3>7) Code audit</h3><p>If you are building a decentralized finance application or any other application that manages a lot of user funds, receiving a security audit by a team of professional security auditors is highly recommended.</p><h3>8) Check account permissions and secure private keys</h3><p>EOSIO account permissions can be complex. Double-check that your desired permission structure is set up on all the accounts and that you used fresh private keys.</p><h3>9) Sufficient resources?</h3><p>Make sure your smart contract accounts have enough CPU/RAM available. Consider borrowing resources from EOS Rex or automated resource management like <a href="https://twitter.com/ChintaiEOS">@ChintaiEOS</a> ARM.</p><h3>10) Keep track of smart contract versions</h3><p>When working on a new feature or maintaining the contract, its very important to know the exact code that is currently deployed. So tag the contract version in git.</p><h3>11) Be careful when you deploy</h3><p>It’s advisable to deploy early in your workday so that there’s enough time to test your system on production and fix potential problems that might occur.</p><h3>Final thoughts</h3><p>Pushing the button to deploy your smart contracts to production doesn’t have to be a scary task as long as you are sensible and follow pre-deployment best practices.</p><p>For a more in-depth look into the pre-deployment best practices <a href="https://klevoya.ck.page/11-things-before-deploying-smartcontracts">download the PDF version here</a>.</p><p><em>Originally published at </em><a href="https://klevoya.com/blog/11-things-you-should-do-before-publicly-deploying-your-smart-contract/"><em>https://klevoya.com</em></a><em> on July 27, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=888f6e2c3d9d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Which EOSIO test environment? Hydra or nodeos+cleos?]]></title>
            <link>https://klevoya.medium.com/which-eosio-test-environment-hydra-or-nodeos-cleos-93d7376cd5bb?source=rss-48f74a3e7d71------2</link>
            <guid isPermaLink="false">https://medium.com/p/93d7376cd5bb</guid>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[eosio]]></category>
            <category><![CDATA[jest]]></category>
            <category><![CDATA[eos]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[klevoya]]></dc:creator>
            <pubDate>Thu, 02 Jul 2020 12:38:00 GMT</pubDate>
            <atom:updated>2020-07-06T14:45:54.893Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cB9Ft4P9qWlW7A31.png" /></figure><p>You’ve sat down at your terminal, opened up a terminal and are ready to start debugging your new smart contract.</p><p>You type in nodeos, hit Enter and then see those cryptic words every EOSIO smart contract developer who has ever played around regularly with nodeos dreads:</p><blockquote><em>nodeos replay required</em></blockquote><p>Or, my personal favourite:</p><blockquote><em>nodeos database dirty flag set</em></blockquote><p>What in the….? You think. Why is the database dirty?</p><p>You start Googling and going through EOSIO Dev Telegram posts for a solution, all the while wondering how it suddenly became your job to be a part-time BP!</p><p>You figure out how to clean your dirty database, which will probably require you to completely wipe your local test net and reinitialise the state of your smart contract and all your local system contracts. And eventually you get your tests running.</p><p>Until it happens again.</p><p><em>“This is backwards,” a little voice whispers inside of you. “There’s got to be a better way.”</em></p><p>And the truth is, yes you can write a bunch of shell scripts that will setup your test environment and have it working just the way you like it. While this is very flexible and allows quick prototyping, it takes some effort to create the scripts in the first place. It’s like re-inventing the wheel and missing out on all of the advances in automated testing frameworks that run a suite of tests every time you make a code change.</p><h3>What’s important in a test environment?</h3><p>To get the most out of automated testing, it’s important that a testing framework supports the developer in 2 ways:</p><h4>Simplicity</h4><p>The testing framework should make it simple to write and run tests.<br>Specifically when testing EOSIO smart contracts, a testing framework should eliminate a lot of the tedious and repetitive tasks encountered when testing:</p><ol><li>Having to set up and maintain an EOSIO network</li><li>Preparing the blockchain for the tests: Creating test accounts, managing private keys, setting up account permissions, setting the smart contract code, and bringing the blockchain into a testing state, e.g., by creating and issuing tokens</li><li>Sending transactions and observing the outcome by checking contract tables or action traces</li></ol><h4>Repeatability / Determinism</h4><p>The point of having automated tests is that they can be run anytime on code changes, for example, on the CI server whenever a team member commits new code to GitHub to ensure a change did not negatively affect existing features (regression testing). The tests need to be easily repeatable for every developer and run in the same blockchain environment every time. This usually means running the tests on a local or private EOSIO network that is fully controlled.</p><p>Public testnets can be problematic because the environment constantly changes and cannot be reset. One is at the mercy of the chain’s RAM/CPU/NET restrictions, token faucets, and might encounter unstable BPs experimenting with non-standard settings. Private testnets mean having to maintain and debug your nodeos installation and running on high-end machines.</p><h3>Testing without nodeos</h3><p>It is possible to run tests without directly connecting to an existing nodeos node. There are several test frameworks that do this by either running a stripped down nodeos version or not requiring running a node at all.</p><p>This removed overhead makes them great for writing unit tests and allows for more flexibility as they are not restricted by the node behaviour. On the other hand, one cannot use them for deploying and running tests on a real EOSIO network.</p><h4>Hydra</h4><p>Hydra is one such testing framework that allows you to quickly get started writing unit tests.</p><p>Tests are written in JavaScript or TypeScript and allows you to use familiar JavaScript testing frameworks like Jest and Mocha. In addition, it comes with some convenience features like bootstrapping test files, loading initial table contract data from JSON files, or being able to change the block time.</p><p>The reason it can do all this is that it runs on a customized EOSIO version (run by the Klevoya team) specifically designed for unit testing. Hydra therefore does not require any additional local setup at all, albeit it does need an internet connection.</p><p>This allows tests written in Hydra to be easily integrated into CI systems and the developer workflow. Along with its simple API and good documentation it’s a great choice to test EOSIO smart contracts.</p><h3>Check out Hydra</h3><p>We hope this helps you see that there is an alternative to debugging those cryptic nodeos errors. Check out <a href="https://klevoya.com/hydra/">Hydra</a> and see how easy it is to get testing!</p><p>For more details on how Hydra compares to nodeos+cleos, EOS Native Tester, EOSIO Unit Tests &amp; Boost, or other EOSIO test frameworks, then download our <a href="https://klevoya.ck.page/which-eosio-test-environment/">EOSIO test framework comparison guide</a>.</p><p><em>Originally published at </em><a href="https://klevoya.com/blog/hydra-vs-nodeos-cleos/"><em>https://klevoya.com</em></a><em> on July 2, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=93d7376cd5bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Klevoya receives EOS.VC grant for EOSIO cyber-security solution]]></title>
            <link>https://klevoya.medium.com/klevoya-receives-eos-vc-grant-for-eosio-cyber-security-solution-c2bf80381459?source=rss-48f74a3e7d71------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2bf80381459</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[eosio]]></category>
            <dc:creator><![CDATA[klevoya]]></dc:creator>
            <pubDate>Thu, 28 May 2020 17:00:00 GMT</pubDate>
            <atom:updated>2020-05-29T10:56:36.569Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NI2hkyirJleOI7mi.jpg" /></figure><p>EOSIO software developer Block.one announced today that it has <a href="https://eos.io/news/blockone-announces-eos-vc-grants-recipients/">awarded Klevoya with a $50k grant</a> to further develop it’s smart contract verification system and foster the adoption of blockchain technology.</p><p>“At Klevoya we know that building quality dApps is complicated. So we made it our mission to help EOSIO dApp developers ship bug free, secure code. With the support from the EOS.VC grants program, we will increase the number of vulnerabilities that our <a href="https://klevoya.com/inspect">Inspect smart contract analysis tool</a> can detect,” said Moti Tabulo, Founder of Klevoya. “Developers who are using Inspect and <a href="https://klevoya.com/hydra/">Hydra, our smart contract execution environment</a>, have found that checking for bugs in their smart contracts is not the painful experience it used to be,” he added.</p><p><em>Originally published at </em><a href="https://klevoya.com/blog/klevoya-receives-grant-from-eos-vc/"><em>https://klevoya.com</em></a><em> on May 28, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2bf80381459" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hello Hydra: the EOSIO test environment that just works]]></title>
            <link>https://klevoya.medium.com/hello-hydra-the-eosio-test-environment-that-just-works-f2f48db74761?source=rss-48f74a3e7d71------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2f48db74761</guid>
            <category><![CDATA[eosio]]></category>
            <category><![CDATA[eosio-tools]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[testing-tools]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[klevoya]]></dc:creator>
            <pubDate>Fri, 10 Apr 2020 00:20:00 GMT</pubDate>
            <atom:updated>2020-04-10T16:22:35.585Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="A highway at night with lights showing cars moving quickly. Hydra test environment" src="https://cdn-images-1.medium.com/max/1024/0*y9n5dmKlRgN0x-ui.png" /></figure><p>At Klevoya our goal is to help EOSIO developers ship bug free, secure software. When we started talking to potential users, a common theme we heard was that developers spent too much time on verifying their smart contracts. This led us to explore an idea — what if testing just worked? What if instead of fiddling around with nodeos installs, running your own blockchain and multiple test scripts with cleos commands you could just open your IDE and start running tests. What if developers who want to test their smart contracts didn’t have to also work as block producer administrators. What if developers could just write and run their test cases without setting up a blockchain on every computer they wanted to work on. What if test teams could easily integrate tests into a CI environment. What if test teams could rapidly spin up many hundreds of test variants.</p><p>Existing test environments solve some of these problems by wrapping your local EOSIO node’s chain_api in some easier to use format. However you are still restricted to all the limitations and disadvantages of running a local blockchain; making sure it is installed locally, correctly set up, and running whenever you run your tests.</p><h3>Introducing Hydra</h3><p>Today, we’re changing this. Hydra is a simple and fast EOSIO smart contract test and execution environment that allows you quickly create and execute test cases without needing to maintain and run a local blockchain. The approach we have taken with Hydra is fundamentally different: Whilst it has similar APIs to existing testing tools, it eliminates all of the drawbacks of running a local blockchain by running a modified EOSIO node on our back-end which is specifically designed for testing. Hydra also comes with many convenience features (e.g. CLI to bootstrap tests and loading of smart contract tables from JSON files) that allow you to very easily write tests for your smart contracts.</p><h3>How to get Hydra</h3><p>You can get started using Hydra <a href="https://docs.klevoya.com/hydra/about/getting-started/">here</a>. Try it, we think you’ll like it.</p><p><em>Originally published at </em><a href="https://klevoya.com/blog/hello-hydra/"><em>https://klevoya.com</em></a><em> on April 10, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2f48db74761" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[So you want to check your smart contract for security bugs?]]></title>
            <link>https://medium.com/coinmonks/so-you-want-to-check-your-smart-contract-for-security-bugs-ded0e8696846?source=rss-48f74a3e7d71------2</link>
            <guid isPermaLink="false">https://medium.com/p/ded0e8696846</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[eosio]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[klevoya]]></dc:creator>
            <pubDate>Wed, 21 Aug 2019 16:06:39 GMT</pubDate>
            <atom:updated>2020-08-26T12:09:52.386Z</atom:updated>
            <content:encoded><![CDATA[<h3>So you want to check your ETH and EOSIO smart contracts for bugs?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VCRKDwzYEYZJmJiu.jpg" /><figcaption>Hackers are out to exploit vulnerabilities in your smart contracts.</figcaption></figure><p>Smart contracts are programs that, once deployed, execute autonomously on blockchains. Depending on the blockchain being used (and the method of smart contract deployment), these smart contracts can be to a smaller or larger extent immutable. Immutable in the sense that once deployed they may not be modifiable by their creator.</p><p>If you’ve ever developed a significant piece of software then you know that deploying SW that is right the first time is extremely difficult as the SW you develop may contain a variety of bugs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/0*0cus5LXh2WLUemAz.png" /></figure><ul><li>Logical errors</li><li>Business errors</li><li>Security vulnerabilities</li></ul><p>While logical and business errors can be mitigated to some extent, security vulnerabilities in blockchain smart contracts can be much harder to recover from. Smart contracts often control crypto tokens that are pseudonymous and easily transferrable into liquid cash. This makes smart contracts very lucrative targets for bad actors looking to exploit any errors for quick profit at relatively lower risk of detection. In fact this is so common that the blockchain space is rife with incidents of bad actors exploiting smart contracts for <a href="https://www.technologyreview.com/s/612974/once-hailed-as-unhackable-blockchains-are-now-getting-hacked/">real world gain</a>.</p><h3>Avoidance is better than cure</h3><p>To avoid these exploits software developers are adapting techniques from off-chain development ranging from:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/0*UzpdrIUCQdVV9YwT.png" /></figure><ul><li>Following smart contract development best practices</li><li>Auditing their contracts via a thorough review of the code</li><li>Subjecting their deployed contracts to white hat hackers</li></ul><p>In this piece we concentrate on the <em>second of these</em>; auditing your smart contracts to discover vulnerabilities before deployment. Auditing can take two forms. Firstly, what many in the space are familiar with is a manual review of the business and programming logic of your smart contract by a team of experts who are well versed in the state of the art of security vulnerabilities. These experts pore over the design and source code of your smart contracts with the aim of identifying any exploits. Depending on the size and scope of your smart contract this process may take anything from a week to a couple of months and cost anywhere from $50k to $500k. Smart contract auditing is a very specialised skill and so it is unlikely that many of the nascent projects in the space will have such an expert internally. They will typically rely on commissioning an external organisation to conduct their audits.</p><p>Even if the organisation commissioning the external security audit is well-funded, multiple iterations through such an audit are likely to be time and cost prohibitive. Organisations therefore leave such audits as the last step before deploying their smart contract to their blockchain of choice. In this world of agile development, this feels rather like going back to the old days of waterfall development. In short, manual security audits are simply not scalable.</p><p>A second approach which is now beginning to gain traction is the use of smart contract analysis tools that perform an automated review of the smart contract to identify vulnerabilities. Whilst the results from automated analysis may not catch the full breadth of issues exposed by a properly in-depth manual security audit, automated analysis does have the benefit that it is relatively lower cost and more convenient to execute than a manual audit. This allows automated analysis to be used within the development cycle to catch potential issues prior to the code being submitted for a final manual security audit. Automated analysis also enables developers to leverage the efforts of a handful of expert smart contract security researchers making automated analysis a much more scalable approach.</p><h3>Automated smart contract vulnerability analysis methods</h3><p>Automated vulnerability analysis of software programs is a well researched area with a rich pedigree in the off-chain world of web, desktop and enterprise software. In designing an automated analysis approach, there are two main areas where trade-offs need to be made:</p><ul><li>Reproducibility: what steps need to be taken to exactly trigger a vulnerability define whether or not a vulnerability is reproducible. Some analysis approaches may not capture information on how to trigger a vulnerability and so any vulnerabilities identified may need to be manually verified.</li><li>Semantic insight: Insight into how and why a program, or parts of it, behaves.</li></ul><p>Typically automated analyses cannot optimise for both reproducibility and semantic insight. High reproducibility typically means low coverage as to make results reproducible an analysis needs to be able to understand how to reach the code under analysis; removing this requirement means that an analysis can achieve much higher code coverage. However the lack of reproducibility results in a high false positive rate (i.e. a false alarm for a vulnerability that does not actually exist). A high semantic understanding on the other hand may necessitate processing and storing of a large amount of data. Attempting an analysis that achieves both full semantic insight and identifies reproducible vulnerabilities may not be entirely different from executing the smart contract through all of its possible input permutations which is typically unscalable for a smart contract of sufficient complexity.</p><p>Automated vulnerability analysis can be divided into two types:</p><ul><li>Static vulnerability analysis: identifies defects <em>before</em> you run a smart contract</li><li>Dynamic vulnerability analysis: identifies vulnerabilities <em>after</em> you run a smart contract</li></ul><h4>Static vulnerability analysis</h4><p>Static vulnerability analysis on a smart contract is performed by reasoning about the code without actually executing it. Normally the analysis is done on some representation of the smart contract’s source code, either the source code itself or some intermediate form that is above the object code. Occasionally static analysis can also be done on the object code.</p><p>Advantages of Static Analysis?</p><ul><li>It can achieve very good coverage of the smart contract under analysis and can often cover every possible execution path</li><li>It can be easier to trace the vulnerability back to the exact location in the code</li></ul><p>Static vulnerability analysis does have some drawbacks:</p><ul><li>Results are not reproducible: information on how to trigger the vulnerabilities identified is typically not captured and so the vulnerabilities may need to be verified to avoid false positives.</li><li>Lack semantic insight: They operate on simpler data domains and may have reduced insight into why a part of the smart contract has a vulnerability or what parts of the input cause misbehaviour</li></ul><h4>Dynamic vulnerability analysis</h4><p>Dynamic vulnerability analysis is performed by executing the smart contract on a real or virtual processor and subjecting it to test inputs to verify its behaviour under a variety of conditions. Unit testing a smart contract to find errors is one of the most common method of dynamic analysis.</p><p>Automated dynamic analysis techniques are split into two main categories: concrete and symbolic execution.</p><ul><li>Concrete execution involves running the smart contract as normal against carefully crafted test cases provided by the user. A common dynamic concrete execution technique is fuzzing, where malformed input is provided to a smart contract in an attempt to discover a vulnerability.</li><li>Symbolic execution executes the smart contract in an emulated environment using symbolic variables and tracking the state of the smart contract throughout program execution. At each conditional branch the analyser follows every path and saves the path condition. The analyser can then use the accumulated path conditions to reason on how to exactly trigger an identified vulnerability.</li></ul><p>What are the advantages of Dynamic analysis and how does it fare against static analysis?</p><ul><li>Vulnerabilities identified are highly reproducible as you have the inputs or path conditions required to trigger the vulnerability</li><li>It allows for analysis of smart contracts in which you do not have access to the actual code.</li></ul><p>Drawbacks of Dynamic analysis.</p><ul><li>Fuzzers typically require carefully crafted test cases to avoid identifying only shallow vulnerabilities.</li><li>Similar to static analysis, fuzzers have limited semantic insight into what parts of the input caused a vulnerability to be tirggered. This makes it more difficult to trace a vulnerability back to the exact location in the code. Symbolic execution on the other hand offers high semantic insight.</li><li>With symbolic execution the number of condition paths causes an exponential increase in the possible paths to be explored limiting the complexity of smart contracts that can be analysed.</li></ul><p>As can be seen from above, both static and dynamic analysis techniques have different advantages and disadvantages. One technique cannot be said to be definitively better than the other. To take advantage of their different attributes we see some of the leading suppliers of smart contract analysis tools use both types of analyses in their offerings.</p><h3>Top Vulnerability Analysis Tools for the Ethereum and EOS blockchains</h3><p>Now that we have a fundamental understanding of the different smart contract vulnerability analysis methods, what tools are available to check your Ethereum and EOS smart contracts for bugs?</p><h4><a href="https://mythx.io/">MythX</a></h4><p>MythX is a SaaS platform that combines static, fuzzing and dynamic symbolic analysis of Ethereum smart contracts. It is developed by a Consensys spoke.</p><p>Offers an API that tools (such as IDEs, web interfaces etc) can use to enable security scanning in their application.</p><p>Pricing from 199 DAI per user. <a href="https://mythx.io/plans">https://mythx.io/plans</a></p><h4><a href="https://github.com/ConsenSys/mythril">Mythril</a></h4><p>Developed by some of the team that were behind MythX. Utilises dynamic symbolic execution.</p><p>Open source and free to use.</p><h4><a href="https://securify.chainsecurity.com/">Securify</a></h4><p>Online and open-source security scanner for Ethereum smart contracts that performs static analysis.</p><p>Online version is free to use, but requires signing over rights to submitted source code.</p><h4><a href="https://github.com/trailofbits/manticore">Manticore</a></h4><p>Open source dynamic symbolic execution analysis tool. Can analyse Ethereum smart contracts and Linux ELF binaries.</p><p>Appears to be actively maintained with multiple contributions to its Github repository over the last 3 months.</p><h4><a href="https://tool.smartdec.net/">Smartcheck</a></h4><p>Online and open source static analysis tool that translates Ethereum Solidity code into an XML based representation on which it checks against security patterns.</p><p>Its Github repository does not show much sign of recent activity.</p><h4><a href="https://github.com/quoscient/octopus">Octopus</a></h4><p>Octopus supports basic analysis of smart contracts allowing contract disassembly, control flow analysis and conversion byte code into an Intermediate Representation.</p><p>Although it is one of the few tools we found that supports both Ethereum’s EVM and EOS’ WASM byte code formats, it currently cannot run a vulnerability analysis. That is planned in the future through dynamic symbolic execution.</p><p>Its Github repository does not show much sign of recent activity.</p><h3>Conclusion</h3><p>Automated vulnerability analysis is a burgeoning field that will help secure smart contracts.</p><p>There are a variety of tools available, but these primarily target the Ethereum ecosystem. We found only one tool that has minimal support for EOS.</p><p>Do you know of any tools that we should include in the list? Do you think automated analysis can be a substitute for manual review? Let us know what you think in the comments.</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><figure><a href="https://coincodecap.com/"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_s6JsD3P0hVj32E7t9EtGg.jpeg" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ded0e8696846" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/so-you-want-to-check-your-smart-contract-for-security-bugs-ded0e8696846">So you want to check your smart contract for security bugs?</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[Overview of the EOSIO WebAssembly Virtual Machine]]></title>
            <link>https://medium.com/coinmonks/overview-of-the-eosio-webassembly-virtual-machine-e6de2158b511?source=rss-48f74a3e7d71------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6de2158b511</guid>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[virtual-machine]]></category>
            <category><![CDATA[eosio]]></category>
            <category><![CDATA[webassembly]]></category>
            <dc:creator><![CDATA[klevoya]]></dc:creator>
            <pubDate>Thu, 21 Mar 2019 14:32:12 GMT</pubDate>
            <atom:updated>2020-08-26T14:00:48.234Z</atom:updated>
            <content:encoded><![CDATA[<p>EOSIO programs are typically written in C++ and then compiled into a smart contract for execution on an EOSIO blockchain.</p><p>But did you know that C++ is not the only programming language that EOSIO programs can be written in? Some projects are working on Python and even Solidity based programs. These are all compiled down into platform independent code that can be run on the EOSIO WASM Virtual Machine (WAVM).</p><p>So the WAVM does not need to know anything at all about the high level programming language (C++, Python, Solidity etc). All it knows how to do is to execute its own binary instruction set called WebAssembly.</p><h3>What is WebAssembly</h3><p>The <a href="https://webassembly.github.io/spec/core/intro/introduction.html">project to develop</a> a new portable, size efficient binary format for the web was driven by the major browser vendors (Mozilla, Google, Apple and Microsoft). Apart from portability, WebAssembly’s other design goals were for it to be:</p><ul><li>Fast: Able to execute at near native speed</li><li><a href="https://webassembly.org/docs/security/">Safe</a>: code executes in a sandboxed environment and eliminating dangerous features</li><li><a href="https://webassembly.org/docs/portability/">Hardware independent</a>: Implementable by web browsers and other completely different execution environments such as datacenters, IoT devices, mobile/desktops etc</li><li>Not break the web (allow calls/bindings to JavaScript)</li><li>A human-editable text format that is convertible to/from the binary format</li></ul><p>These goals, as well as the large browser ecosystem working to continuously improve it, make WASM a great choice for smart contract execution platforms. Apart from EOSIO, WASM is also planned to be used by Ethereum.</p><h3>The EOSIO WAVM</h3><p>EOSIO’s WASM Virtual Machine (WAVM) is based on <a href="https://github.com/AndrewScheidecker/WAVM">Andrew Scheidecker’s standalone WAVM</a>.</p><h4>Stack Machine</h4><p>The WAVM is a stack machine with two main components:</p><ol><li>a last-in, first-out stack is used to hold temporary values. Most of the WAVM instructions therefore assume that operands will be taken from the stack and results placed back on the stack.</li><li>A program counter that controls the execution of the program and is modified explicitly by control instructions and implicitly advanced when non-control instructions execute.</li></ol><p>This is in contrast to most modern computers that implement a register machine where temporary values are held in a set of registers.Advantages of using a stack machine over a register machine are that stack machines allow for:</p><ul><li>Compact object code: as instructions deal with values from the stack and do not need to select which registers to use</li><li>Simple compilers: as no register management is needed making code generation fairly trivial</li><li>Simple interpreters: particularly for Virtual Machines interpreters for stack machines are simpler as the logic for handling memory accesses is just in one place</li><li>Easier control flow: control flow is expressed as structured constructs like blocks, if and loops that have clear labels at their beginning and end. Implementing control flow like this makes it very easy to compile and manipulate WASM and verify the correctness of control flow in a WASM program.</li></ul><h3>A simple execution example</h3><p>We can now go review a simple example to illustrate the whole flow from source code to WASM to execution of that code in the WAVM.As prerequisites we assume that you have:</p><ul><li>Installed the <a href="https://github.com/EOSIO/eosio.cdt">EOSIO Contract Development Toolkit</a> (CDT)</li><li>Have access to the Web Assembly Binary Toolkit (WABT pronounced wabbit). You can do this by running the eosio-wasm2wast/eosio-wast2wasm binaries that come with CDT. Alternatively you can also download and build the generic WABT version from <a href="https://github.com/WebAssembly/wabt">https://github.com/WebAssembly/wabt</a>. (A cursory examination seems to indicate that this versions are compatible if you disable “Generate Names” and “Fold Expressions”)</li></ul><h4>Compiling Hello</h4><p>For this example we’ll be compiling the basic Hello World program:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eac1b52ac1ae130a2fc8aa5a73d5a343/href">https://medium.com/media/eac1b52ac1ae130a2fc8aa5a73d5a343/href</a></iframe><p>Running the eosio C++ compiler eosio-cpp:</p><pre>eosio-cpp -o hello.wasm hello.cpp</pre><p>This takes the C++ source file and converts it into an intermediate representation (IR) using a compiler tool chain called LLVM. LLVM performs some optimisations and then a back-end converts from the LLVM IR into WASM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nNWw_vIHenBLdmea.png" /></figure><p>We get a WASM file, hello.wasm which is in binary. To make it readable we need to convert it into a WASM text format as follows:</p><pre>eosio-wasm2wast hello.wasm -o hello.wast</pre><p>This WAST file is typically huge (approximately 900 lines) so we will only concentrate on the first 50 or so lines here to illustrate some important concepts.</p><h3>WASM sections</h3><p>The WebAssembly module is composed of several sections. Some sections are required in all WASM modules and some are optional (you may see the optional modules appearing at the end of the WAST file).</p><p><strong>Required:</strong></p><ol><li>Type. Contains the function signatures for functions defined in this module and any imported functions.</li><li>Function. Gives an index to each function defined in this module.</li><li>Code. The actual function bodies for each function in this module.</li></ol><p><strong>Optional:</strong></p><ol><li>Export. Makes functions, memories, tables, and globals available to other WebAssembly modules and JavaScript. This allows separately-compiled modules to be dynamically linked together. This is WebAssembly’s version of a .dll.</li><li>Import. Specifies functions, memories, tables, and globals to import from other WebAssembly modules or JavaScript.</li><li>Start. A function that will automatically run when the WebAssembly module is loaded (basically like a main function).</li><li>Global. Declares global variables for the module.</li><li>Memory. Defines the memory this module will use.</li><li>Table. Makes it possible to map to values outside of the WebAssembly module, such as JavaScript objects. This is especially useful for allowing indirect function calls.</li><li>Data. Initializes imported or local memory.</li><li>Element. Initializes an imported or local table.</li></ol><h3>Section examples</h3><p>For our Hello.wast file the section part looks like so:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bf1765fb0ed8fbb55745b32be0e0cc8a/href">https://medium.com/media/bf1765fb0ed8fbb55745b32be0e0cc8a/href</a></iframe><p>Here we see that there are 10 function signatures and indices for the functions in this WASM file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jhlHVsSSf7MdlLCY.png" /></figure><p>These signatures are similar to function prototypes and define the expected inputs and outputs for each type of function.</p><p>There are also some imported functions such as</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/86b99413263cfd5903f20896fe044f17/href">https://medium.com/media/86b99413263cfd5903f20896fe044f17/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mFEQJkJ5Zp6FL9Tk.png" /></figure><p>We can also see our print statement being initialised in memory:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c9d91afa55b1404df0108a04c3aef84f/href">https://medium.com/media/c9d91afa55b1404df0108a04c3aef84f/href</a></iframe><p>The beginning of the code section contains the actual function bodies for each function in this module. Looking back at the function definitions we see that there is one function exported which has an index of function 11:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4d084391429a8410fa395ff9022ee156/href">https://medium.com/media/4d084391429a8410fa395ff9022ee156/href</a></iframe><p>This is the apply function that is called when an action is issued to this smart contract:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cfbaf558c719b16c19ccfbaf8b8a65d3/href">https://medium.com/media/cfbaf558c719b16c19ccfbaf8b8a65d3/href</a></iframe><h3>Deploy your smart contract!</h3><p>The last thing to do after compiling your smart contract is to send it to the blockchain by issuing a set code transaction using the cleos command line tool.</p><pre>cleos set contract hello $YOURDIRECTORY/hello -p hello@active</pre><p>When the block producer (BP) node receives the set code action it proceeds to create an instance of the smart contract WebAssembly module in the EOSIO blockchain’s RAM. Instantiating the WebAssembly module is what makes it functional and the BP node does so by resolving memory references, linking external C++ functions and giving access to the exported functions like the apply() function.</p><p>Once the BP node completes this step the smart contract WebAssembly module will be on the chain’s RAM and any BP node can then access actions intended for the smart contract.</p><h3>Trigger an action!</h3><p>Now that the smart contract is on chain, you can trigger it by sending an action to the smart contract using cleos:</p><pre>cleos push action hello hi &#39;[&quot;bob&quot;]&#39; -p bob@active</pre><p>The message will be sent to the BP node which will load the smart contract WebAssembly instance and call the apply() function.</p><p>If you are curious, here’s how the WebAssembly virtual machine would execute the first few instructions in the function:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ddfca2ee8c4659d2ddbd6b91e0f06191/href">https://medium.com/media/ddfca2ee8c4659d2ddbd6b91e0f06191/href</a></iframe><ul><li>get_global 0: gets the value of the global variable at index 0 and pushes it onto the stack</li><li>i32.const 16: Pushes the constant value sixteen onto the stack</li><li>i32.sub: remember we said WebAssembly was a stack machine earlier? With a stack machine all values an operand needs are pushed onto the stack before the operation is performed. The sub instruction knows that it needs two operands and will simply take the last two values from the top of the stack and return the result to the top of the stack. This means that instructions can be short (one byte for sub) as the instructions don’t need to specify source or destination addresses which makes for more compact WASM files.</li></ul><p>Finally after the whole WebAssembly module has been executed, you should then see the smart contract reply:</p><blockquote><em>Hello, bob</em></blockquote><h3>Closing thoughts</h3><p>WebAssembly allows smart contract developers to write EOSIO applications in C++ (and in future other languages such as Solidity and Python) and ensures that the resulting code can run efficiently across different BP nodes.</p><p>It is perfectly possible for a smart contract developer to deply a distributed application (dApp) without knowledge of WebAssembly or how the WAVM works. However understanding how it works may help you to tackle difficult problems from time to time and deal better with security vulnerabilities in your smart contract.</p><p><em>Originally published at </em><a href="https://klevoya.com/overview-of-the-eosio-webassembly-virtual-machine/"><em>klevoya.com</em></a><em> on March 21, 2019.</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=e6de2158b511" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/overview-of-the-eosio-webassembly-virtual-machine-e6de2158b511">Overview of the EOSIO WebAssembly Virtual Machine</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[How to hire top smart contract developers for your blockchain project]]></title>
            <link>https://klevoya.medium.com/how-to-hire-top-smart-contract-developers-for-your-blockchain-project-52fb7a9b02ca?source=rss-48f74a3e7d71------2</link>
            <guid isPermaLink="false">https://medium.com/p/52fb7a9b02ca</guid>
            <category><![CDATA[eosio]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <dc:creator><![CDATA[klevoya]]></dc:creator>
            <pubDate>Tue, 29 Jan 2019 17:00:56 GMT</pubDate>
            <atom:updated>2019-02-19T20:44:02.761Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/900/0*uKN6YcsBa1JJyoqB.png" /><figcaption>Don’t skimp on your programmers!</figcaption></figure><p>Joel Spolsky <a href="https://www.joelonsoftware.com/2005/07/25/hitting-the-high-notes/">wrote that line</a> more than a decade ago and it still rings true now.</p><p>To succeed with your blockchain project through the current crypto winter you are going to have to excel at finding the mythical 10x developers. You’ll have to out-recruit those well funded projects that used the last crypto boom to amass a warchest of funds.</p><p>Here are 4 ways that will help you rise above the rest — to recruit the best smart contract developers for your crypto startup.</p><h3>#1 Start with the why</h3><p>In his TED talk <a href="https://www.ted.com/talks/simon_sinek_how_great_leaders_inspire_action?language=en">Simon Sinek</a> explains how leaders inspire action by focusing on why.</p><p>As a founder your job is to figure out why your company is differentiated and what is your Unique Recruitment Proposition.</p><p>This is not the same as your product’s Unique Value Proposition — although that can be one of your recruitment propositions. In addition to you product, your recruitment propositions could be things like the impact employees can have in the role, your culture, work environment etc. Beware of using salary on its own as a differentiator. There will always be someone who can pay better than you can!</p><h3>#2 Treat your recruitment process like a product</h3><p>You <a href="/service/lhttp://theleanstartup.com/">iterate your product development</a>. Apply that same mindset for your recruitment process.</p><p><a href="https://firstround.com/review/turbocharge-your-recruiting-machine-heres-how/">Measure your recruitment funnel</a> and seek feedback from candidates about what does or doesn’t work throughout your funnel.</p><p>Use that feedback to learn and continually improve your recruitment process.</p><h3>#3 Look critically at how you source candidates</h3><p>The best candidates are probably not actively looking for new roles. Those 10x engineers might be on the lookout for something new, but they are not out there scouring job boards. So how do you make sure that your role has the most chance of being seen? Consider looking in the following places.</p><h4>Open source code</h4><p>Review open source projects on places like Github in fields related to yours. Note down the contributors who consistently put out well thought out changes, tools etc.</p><h4>Chat channels</h4><p>Every smart contract platform worth its salt has a developer chat channel on Telegram, Discord or Slack. Find out where your developer community hangs out and see who is posting and answering questions frequently. The way someone replies to posts can give you great insight into their thought process, problem solving and writing skills. Just be careful to ensure your posts meet the discussion’s guidelines.</p><ul><li>Some of the people on the channels will be employed directly by the platform and possibly out of your league. However good developers know other good developers and so if you approach them in the right way they may be able to refer you to someone who is open for recruitment.</li><li>There will often be developers who spend considerable amounts of time answering others questions for the love of the project. These are good candidates who may be open to a direct approach.</li></ul><h4>Hackathons</h4><p>Many smart contract platforms arrange hackathons to build out their base of developers (e.g. <a href="https://eoshackathon.io/">EOSIO</a>, <a href="https://www.hedera18.com/hackathon">Hedera</a>, <a href="https://klevoya.com/hire-smart-contract-developers/%5Bhttps://tronaccelerator.io/">Tron</a>). These hackathons attract a wide range of people who are united about their passion about learning about the smart contract platform. Both attendees and mentors can be a good source of potential candidates.</p><h4>Crypto events/meetups</h4><p>Many founders I see speaking at blockchain meetups focus their presentations as investor pitches missing out on another key audience that will be attending; potential recruits. If you can, contact the organiser beforehand to get an understanding of the audience demographic. If the crowd is more developer friendly then your standard VC pitch deck won’t do. Focus your presentation more on your uniquness as a company whilst mixing in what interesting problems you’re resolving.</p><h4>Other chains</h4><p>Enough of the crypto tribalism! Yes an Ethereum solidity developer may not be familiar with C++ and how smart contracts are deployed on EOSIO. But any decent developer should be able to learn a new programming language and smart contract architecture; having programmed any smart contract platform gives them a leg up.</p><h4>EOSIO</h4><p>I come from the EOSIO space, and the following are good places to put the above into practice:</p><ul><li>Telegram groups: <a href="https://t.me/eos_jobs">https://t.me/eos_jobs</a>, <a href="https://t.me/eos_opportunities">https://t.me/eos_opportunities</a>, <a href="https://t.me/joinchat/Esi1OkPktgcFeJ3Lmlcrqg">https://t.me/joinchat/Esi1OkPktgcFeJ3Lmlcrqg</a> (developer chat)</li><li>Reddit: <a href="https://www.reddit.com/r/eosdev">https://www.reddit.com/r/eosdev</a></li></ul><h3>#4 Have your interview process mirror the work they will do</h3><p>I’m not a fan of online coding interview style tests. At most use those for an initial screen, but I find they give a weak signal about a candidate’s capabilities. Similarly questions about algorithms perhaps only help if you are recruiting someone to spend time doing that.</p><p>I have found great effectiveness in having your interviewees complete a piece of work that approximates the work they will be doing with you. Think out of the box. It could be anything from a design guide, debugging a piece of SW or even developing a simple smart contract on a test net. There is a small upfront investment in getting these kinds of tests set up. But once you do, then you are able to quickly filter out for people who get things done.</p><h3>How about you?</h3><p>What’s your favourite way to recruit smart contract developers for your blockchain project? Let me know in the comments.</p><p><em>Originally published at </em><a href="https://klevoya.com/hire-smart-contract-developers/"><em>klevoya.com</em></a><em> on January 29, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52fb7a9b02ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>