<?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[Cryptonics - Medium]]></title>
        <description><![CDATA[Blockchain Technology Insights - Medium]]></description>
        <link>https://medium.com/cryptronics?source=rss----d46375cdc050---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Cryptonics - Medium</title>
            <link>https://medium.com/cryptronics?source=rss----d46375cdc050---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 18:00:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/cryptronics" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[What Recent Supply Chain Attacks On IOTA and Monero Can Teach Us About Blockchain Security]]></title>
            <link>https://medium.com/cryptronics/what-recent-supply-chain-attacks-on-iota-and-monero-can-teach-us-about-blockchain-security-36f63876b539?source=rss----d46375cdc050---4</link>
            <guid isPermaLink="false">https://medium.com/p/36f63876b539</guid>
            <category><![CDATA[fintech]]></category>
            <category><![CDATA[iota]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[monero]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Stefan Beyer]]></dc:creator>
            <pubDate>Tue, 24 Mar 2020 16:45:17 GMT</pubDate>
            <atom:updated>2020-03-24T16:45:17.424Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jOuj43py3HiOeIPnbuzcSw.jpeg" /></figure><h3>A False Sense of Security</h3><p>Blockchains are protected by complex mathematical protocols and by decentralization. <a href="https://en.wikipedia.org/wiki/Cryptographic_primitive">Cryptographic primitives</a>, such as digital signatures and hashing, are used to verify transaction authenticity and the integrity of the data stored on the blockchain. It is only through these primitives that the concept of digital ownership can be secured. Decentralization makes it incredibly hard for an attacker to gain sufficient control over a blockchain to alter transaction history or apply censorship.</p><p>This means that blockchains are quite secure at the protocol level. Although there are confirmed incidents of protocol-level breaches, such as <a href="https://cointelegraph.com/news/ethereum-classic-51-attack-the-reality-of-proof-of-work">51% attacks</a>, these are relatively rare and confined to smaller blockchains. Nevertheless, digital assets represented on blockchains are stolen on an alarmingly regular basis, even from large established networks.</p><p>In a <a href="https://www.linkedin.com/pulse/5-most-common-smart-contract-vulnerabilities-stefan-beyer/">recent article</a>, we already identified smart contracts as a significant risk vector. In this article, we look at two recent high profile attacks, in order to highlight hidden dangers in the security of support systems that allow attackers to sidestep the sophisticated cryptographic defense mechanisms blockchain protocols provide. This type of attack is typically called a <a href="https://en.wikipedia.org/wiki/Supply_chain_attack">supply chain attack</a>, as it focuses on less secure parts of a project’s supply chain.</p><h3>Case Study 1: The 2019 Monero Attack</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/0*ynuPrO8G8rF83MOw" /></figure><p>In November 2019 an embarrassing incident compromised the funds of users of the <a href="https://www.getmonero.org/">Monero</a> blockchain. Monero prides itself on its sophisticated cryptographic signature protocol, which provides a degree of privacy through the use of <a href="https://en.wikipedia.org/wiki/Ring_signature">ring signatures</a>. However, it did not take any mathematical wizardry for the attackers to breach complex cryptography to break the system and steal users’ funds.</p><p>In fact, the incident exploited a very traditional aspect of cybersecurity, namely website security. The attackers simply broke into Monero’s website and managed to replace the official Monero wallet download with a compromised version. New users, and users wishing to upgrade their wallet, from then on unknowingly installed the compromised version, instead of the official version. This version simply sent the seeds of newly created wallets to the attackers’ servers, allowing the attackers to gain access to all private keys belonging to the created wallets.</p><p>Fortunately, the attack was discovered very quickly by a tech-savvy user who noticed that the hash value of the download did not match the one published on <a href="https://github.com/monero-project/monero">GitHub</a>. These hash values identify a file’s content precisely. Even a minor change in the file results in a completely different hash value, allowing any manipulation to be detectable. Of course, most end-users do never check hash values of downloads, and it was an extremely lucky turn of events that the incident was discovered quickly by an advanced user. While an unspecified amount of money was lost, the impact of the attack was relatively minor.</p><p>The case does highlight, however, that traditional cybersecurity of off-chain components related to a project is as important as protocol security. In fact, traditional off-chain vulnerabilities are probably an even bigger risk vector than on-chain vulnerabilities, due to the number of aspects involved and the existing know-how of bad actors.</p><h3>Case Study 2: The 2020 IOTA Security Breach</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Mzks_aFBWVcTMpKK" /></figure><p>More recently, an even more serious supply chain attack affected the<a href="https://www.iota.org/"> IOTA distributed ledger</a>. IOTA, which uses a <a href="https://en.wikipedia.org/wiki/Directed_acyclic_graph">directed acyclical graph</a> instead of a traditional blockchain data-structure, prides itself on its innovative cryptographic protocols, which are designed to be <a href="https://en.wikipedia.org/wiki/Post-quantum_cryptography">quantum-resistant</a>.</p><p>However, as in the Monero incident, attackers managed to place malicious code in an official wallet application, in order to steal users’ private keys. The code introduced via a third-party dependency gave the attackers full access to all newly installed or updated <a href="https://trinity.iota.org/">Trinity wallets</a> during a 2.5 week period.</p><p>The attack seemed to have been carefully planned and professionally executed. The wallet software included an externally developed module allowing users to directly purchase IOTA. This dependency was included in the Trinity codebase via the <a href="https://en.wikipedia.org/wiki/Content_delivery_network">content delivery network (CDN)</a> used by the provider. However, the attackers managed to substitute the module with a compromised version by intercepting and redirecting CDN API calls. This led to IOTA compromising their own built and distributing it through official channels.</p><p>In their <a href="https://blog.iota.org/trinity-attack-incident-part-1-summary-and-next-steps-8c7ccc4d81e8">postmortem analysis</a>, the IOTA team claims to have been aware of the inherent danger of CDN-delivered dependencies. However, planned changes to the distribution method had not been implemented for some reason.</p><p>Apart from the monetary impact of the attack, the incident let to the IOTA network being halted for almost an entire month, producing an additional denial of service effect and highlighting the fact that IOTA is still a centralized network that can be halted at will by the <a href="https://www.iota.org/the-foundation/the-iota-foundation">IOTA foundation</a>.</p><h3>What End-users Can Do</h3><p>Supply chain attacks put end-users in a difficult situation since the above incidents show that even the official sources may unknowingly distribute malicious software. There is only so much an end-users can do to protect themselves, including the following:</p><ul><li><strong>Verify downloads: </strong>Downloaded files should be checked for integrity. Any downloads should be checked for their correct hash values. This, obviously, depends on the provider facilitating the correct hash values in a secure format, preferably in a signed file. The recent <a href="https://web.getmonero.org/resources/user-guides/verification-windows-beginner.html">Monero guidelines</a> are a good example of how this can be implemented. Unfortunately, this process is cumbersome and not particularly friendly for users without knowledge of hash values and cryptographic signatures.</li><li><strong>Check audit reports: </strong>One measure users can take is to only trust projects with a transparent full-stack audit report, that does not only evaluate protocol-level security but also look at all off-chain components and internal security policies.</li><li><strong>Use a hardware wallet:</strong> Finally, a hardware wallet is highly recommended for any critical keys that secure important funds. These devices usually require some physical user interactions for users to confirm transactions and are generally more secure than any downloadable wallet software.</li></ul><h3>What Projects Must Do</h3><p>Blockchain projects, wallet providers, and critical software providers in general, however, can do much more to prevent supply chain attacks (and other attacks), including the following measures:</p><ul><li><strong>Have security policies that cover the whole supply chain: </strong>Any serious company should have a security policy. Such a policy should cover technical aspects, such as key management, but also logistical aspects, for instance, who can approve certain suppliers and under which circumstances. Importantly, this policy should cover the whole supply chain and take into account how dependencies are included and how providers are chosen.</li><li><strong>Audit the full stack, including all off-chain components: </strong>External security audits for smart contracts and protocol code are now fairly standard. However, companies should consider performing full-stack audits, that cover everything that might have an impact on critical code or serve critical code. For example, it is generally a good idea to get an external security assessment of the project’s website and infrastructure setup.</li><li><strong>Vet dependencies: </strong>Dependencies, in particular, code dependencies in the form of libraries, are unavoidable in modern multi-layered software stacks. However, providers of such dependencies should be vetted carefully, not only for the quality of the software provided but also for the provider’s security policies and distribution procedures.</li><li><strong>Have contingency plans: </strong>Even if all best practices are applied, sometimes things just go wrong and efforts have to change from defense to mitigation and recovery. Plans should be in place for how an organization reacts in case of a security incident. This not only helps to reduce the impact of an attack but also to restore users’ confidence. It is not an acceptable contingency plan for a serious blockchain platform to halt all transactions for almost an entire month, as happened in the recent IOTA incident.</li></ul><h3>Concluding Remarks</h3><p>The two recent examples discussed above show that significant damage can be done to blockchain projects through attacks to parts of the system deemed non-critical. Digital assets are not always stolen at the smart contract or protocol level. Traditional cybersecurity of off-chain components and the whole supply chain is equally important. Projects must include these parts into their security policy and include them in external audit processes.</p><p><strong>For inquiries on our smart contract and full-stack audits, please contact us at </strong><a href="https://cryptonics.consulting/contact/"><strong>Cryptonics</strong></a><strong>.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36f63876b539" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cryptronics/what-recent-supply-chain-attacks-on-iota-and-monero-can-teach-us-about-blockchain-security-36f63876b539">What Recent Supply Chain Attacks On IOTA and Monero Can Teach Us About Blockchain Security</a> was originally published in <a href="https://medium.com/cryptronics">Cryptonics</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[pTokens Bitcoin Bridge Security Audit Result]]></title>
            <link>https://medium.com/cryptronics/ptokens-bitcoin-bridge-security-audit-result-b6414b9b7fe?source=rss----d46375cdc050---4</link>
            <guid isPermaLink="false">https://medium.com/p/b6414b9b7fe</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[fintech]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Stefan Beyer]]></dc:creator>
            <pubDate>Fri, 06 Mar 2020 16:37:53 GMT</pubDate>
            <atom:updated>2020-03-06T16:37:53.421Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3ppjTpxfJHfCfg-F" /></figure><p>We are pleased to announce that <a href="https://cryptonics.consulting/">Cryptonics </a>has finished an extensive security audit of the <a href="https://ptokens.io/">pTokens Bitcoin to Ethereum bridge</a>.</p><p>pTokens is a cross-blockchain solution developed by <a href="https://provable.xyz/">Provable Things</a>, formerly know as Oraclize. The system allows assets from different blockchains to be moved to <a href="https://ethereum.org/">Ethereum</a>, in order to make them available to Decentralized Finance (DeFi) applications. This is achieved by locking up assets on the original chain and minting the equivalent amount of representative pTokens on Ethereum. Assets can be moved back by burning tokens on Etherum and freeing up the equivalent assets on the original chain.</p><p><a href="https://cryptonics.consulting/">Cryptonics </a>has been engaged by <a href="https://provable.xyz/">Provable Things</a> to audit the codebase of the initial Bitcoin to Ethereum implementation prior to its mainnet release. The interactive audit process has gone through various rounds and we are pleased to publish the <a href="https://cryptonics.consulting/wp-content/uploads/2020/03/20200302_Audit_Report_pToken-2.pdf">final audit result</a>.</p><h3>Codebase Audited</h3><p>The pToken Bitcoin to Ethereum bridge is a two-way bridge designed to run in a trusted execution environment, such as <a href="https://software.intel.com/en-us/sgx">Intel’s Secure Software Guard Extensions</a>. It consists of a secure enclave containing Bitcoin and Ethereum light clients, transaction relayers, smart contracts to be deployed on Ethereum, and a series of tools and APIs. In its first release, the bridge is implemented as a single trusted relayer node. However, a decentralized implementation is in development for future release.</p><p>The audited code includes the following modules:</p><ul><li><strong>pbtc-enclave: </strong>Enclave containing a Bitcoin light-client (implemented in <strong>Rust</strong>). This component has been re-factored into `core´ and `app´.</li><li><strong>pbtc-btc-syncer: </strong>BTC syncing tool, designed to keep up a feed of BTC block submissions to the enclave (implemented in <strong>JavaScript</strong>).</li><li><strong>pbtc-eth-syncer: </strong>ETH syncing tool, designed to keep up a feed of ETH blocks to the enclave (implemented in <strong>JavaScript</strong>).</li><li><strong>pbtc-eth-and-btc-block-getter: </strong>ETH &amp; BTC latest-block getter. It gets the latest block from the ETH &amp; BTC chains, formats them correctly to be accepted by the pBTC enclave, and finally saves them out to the paths supplied by the user (implemented in <strong>JavaScript</strong>).</li><li><strong>Pbtc-db-repl: </strong>Tool for managing the external database instance for the pBTC token (implemented in <strong>JavaScript</strong>).</li><li><strong>pbtc-deposit-address-generator:</strong> Generates p2sh BTC addresses derived from an ETH address hashed together with a nonce (implemented in <strong>Rust</strong>).</li><li><strong>pbtc-enclave-api: </strong>An API made for the BTC enclave in Node using an express server<strong> </strong>(implemented in <strong>JavaScript</strong>)<strong>.</strong></li><li><strong>pbtc-tx-broadcaster:</strong> pBTC Token transaction broadcasting tool (implemented in <strong>JavaScript</strong>).</li><li><strong>pbtc-eth-smart-contract: </strong>pBTC ERC-777 token smart contract (implemented in <strong>Solidity</strong>).</li></ul><h3>Audit Procedure and Result</h3><p>The audit has been performed in several rounds by a team of auditors specializing in blockchain security and extensive experience in the programming languages employed. The Cryptonics audit procedure follows a strict methodology adapted to programming language specifics, which involves a series of steps, ranging from automated code scanning and manual line by line code reviews to high-level architecture and design reviews.</p><p>The audit team was in constant contact with the development team and issues encountered were discussed and any fixes supplied were re-audited. The <a href="https://cryptonics.consulting/wp-content/uploads/2020/03/20200302_Audit_Report_pToken-2.pdf">final audit report</a> contains a full history of issues discussed and fixed.</p><p><strong>We have found the submitted code base of very good quality with excellent documentation. Test coverage is also very complete. Several issues were detected and we have found the team very receptive to suggestions for improvements. All issues encountered have been addressed by either fixing or mitigating them. In the case of some minor comments, the issues have been acknowledged as deliberate choices.</strong></p><p><strong>The final audit report can be downloaded from the </strong><a href="https://cryptonics.consulting/wp-content/uploads/2020/03/20200302_Audit_Report_pToken-2.pdf"><strong>Cryptionics Website</strong></a><strong> and </strong><a href="https://github.com/cryptonicsconsulting/audits/blob/master/pToken/20200302_Audit_Report_pToken.pdf"><strong>GitHub</strong></a><strong>.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b6414b9b7fe" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cryptronics/ptokens-bitcoin-bridge-security-audit-result-b6414b9b7fe">pTokens Bitcoin Bridge Security Audit Result</a> was originally published in <a href="https://medium.com/cryptronics">Cryptonics</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The 5 Most Common Smart Contract Vulnerabilities]]></title>
            <link>https://medium.com/cryptronics/the-5-most-common-smart-contract-vulnerabilities-738de4fae3ba?source=rss----d46375cdc050---4</link>
            <guid isPermaLink="false">https://medium.com/p/738de4fae3ba</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[fintech]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Stefan Beyer]]></dc:creator>
            <pubDate>Tue, 03 Mar 2020 16:31:05 GMT</pubDate>
            <atom:updated>2020-03-04T07:51:13.482Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yl-Gvk_3aNzyCOSL-D6fig.jpeg" /></figure><p>Smart contracts are hard to get right. Their three main properties, the ability to hold value, transparency, and immutability, are essential for them to work. However, these properties also turn smart contracts into a security risk and a high-interest target for cybercriminals. Even without deliberate attacks, there are plenty of examples of funds getting stuck and companies losing money due to smart contract bugs and vulnerabilities.</p><p>Over the last two years, we have audited the smart contracts of more than 40 projects here at <a href="https://cryptonics.consulting/">Cryptonics</a>. The contracts audited include different types of asset tokenization, insurance policies, decentralized finance platforms, investment funds, and even computer games. We have observed certain trends in the types of vulnerabilities that we usually encounter, and some issues seem more common than others. In this article, we will describe the five most common issues we detect in our daily auditing activities.</p><h3>1. Integer Arithmetic Errors</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*0Sz8EI-U0-CEzEptudIDlQ.jpeg" /></figure><p>A very common occurrence is getting integer arithmetic wrong. Smart contracts generally express numbers as integers due to the lack of floating-point support. Quite common in financial software anyway, using integers to represent value requires stepping down to small units, in order to allow for sufficient precision. The simple example is expressing values in cents rather than dollars, as it would be impossible to represent $0.5 otherwise. In fact, smart contracts usually step down much further with 18 decimal places being supported by many tokens.</p><p>One issue developers are quite aware of nowadays is the fact that integers may overflow. Like mileage counters in cars, integers expressed in computers have a maximum value and once that value is reached they simply turn back to the beginning and start at the minimum value. Similarly, subtracting 4 from 3 in an unsigned integer will cause an underflow, resulting in a very large number. Developers are generally aware of this potential vulnerability and protect against it by using a safe math library, such as <a href="https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol">Open Zeppelin’s excellent implementation</a>.</p><p>However, what many developers seem to fail to appreciate, is that integer arithmetic can generally lead to a lack of precision when done wrongly. In particular, the order of operations is important. A classic case is calculating percentages. For example, in order to calculate 25 percent, we typically divide by 100 and multiply by 25. Let’s say we wish to calculate 25 percent of 80 using only integers. Expressing this as 80 / 100 * 25 will result in 0, because of rounding errors. The simple mistake here is to perform the division before the multiplication.</p><p>The above is, of course, a very simple example, but we do come across integer arithmetic bugs with alarming frequency.</p><h3>2. Block Gas Limit Vulnerabilities</h3><p>The block gas limit is Ethereum’s way of ensuring blocks don’t grow too large. It simply means that blocks are limited in the amount of gas the transactions contained in them can consume. Put simply, if a transaction consumes too much gas it will never fit in a block and, therefore, will never be executed.</p><p>This can lead to a vulnerability that we come across quite frequently: If data is stored in variable-sized arrays and then accessed via loops over these arrays, the transaction may simply run out of gas and be reverted. This happens when the number of elements in the array grows large, so usually in production, rather than in testing. The fact that test data is often smaller makes this issue so dangerous since contracts with this issue usually pass unit tests and seem to work well with a small number of users. However, they fail just when a project gains momentum and the amount of data increases. It is not uncommon to end up with unretrievable funds if the loops are used to push out payments.</p><h3>3. Missing Parameter or Precondition Checks</h3><p>One of the simplest programming mistakes that we encounter is either not validating the arguments of a function or forgetting essential checks for an operation to be valid. Often, this includes address parameters not being checked for the zero address or, for example, not verifying that a user has sufficient token balance to execute a certain operation. Another good example is access control, where only a certain type of user should be authorized to call a function but this check is never performed.</p><p>These errors are usually the result of a sloppy design process. It is a good idea to have a written specification of all functions, stating the parameters, pre-conditions, and operations to be performed. Sticking to best practice design patterns, such as <a href="https://fravoll.github.io/solidity-patterns/checks_effects_interactions.html">Checks Effects Interactions</a>, can also help to prevent this type of vulnerability.</p><h3>4. Frontrunning</h3><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*qSGhOvaL6gGR7GNt" /></figure><p>Potential frontrunning is probably the hardest issue to prevent on our list of common vulnerabilities. Frontrunnuing can be defined as overtaking an unconfirmed transaction. This is a result of the blockchain’s transparency property. All unconfirmed transactions are visible in the mempool before they are included in a block by a miner. Interested parties can simply monitor transactions for their content and overtake them by paying higher transaction fees. This can be automated easily and has become quite common in decentralized finance applications.</p><p>It is not easy to protect against frontrunning, and the issues we detect often require some significant refactoring or redesign, in order to be fixed.</p><h3>5. Simple Logic Bugs</h3><p>Some of the above issues are more specific to smart contracts, others are common to all types of programming. However, by far the most common type of issue we detect consists of simple mistakes in the logic of the smart contract. These errors may the result of a simple typo, a misunderstanding of the specification, or a larger programming mistake. They tend to have severy implications on the security and functionality of the smart contract.</p><p>What they all have in common though, is the fact that they can only be detected if the auditor understands the code base completely and has an insight into the project’s intended functionality and the contract’s specification. It is these types of issues that are the reason smart contract audits take time, are not cheap, and require highly experienced auditors.</p><h3>Concluding Remarks</h3><p>Things have changed over the last couple of years in smart contract programming. Countless high profile cases resulting in lost money have made projects aware of the need to take security seriously. We do find that developers are more aware of common vulnerabilities and frequently employ tools, such as static code analysis and symbolic execution to automatically scan their code.</p><p>However, we have never performed an audit that has not resulted in at least one minor issue in the first round and plenty of really experienced developers have presented us with critical vulnerabilities in their code. The nature of the common issues is such that a full manual smart code audit is essential and this should be performed by an independent team with fresh eyes.</p><p><strong>For inquiries on our smart contract and full-stack audits, please contact us at </strong><a href="https://cryptonics.consulting/contact/"><strong>Cryptonics</strong></a><strong>.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=738de4fae3ba" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cryptronics/the-5-most-common-smart-contract-vulnerabilities-738de4fae3ba">The 5 Most Common Smart Contract Vulnerabilities</a> was originally published in <a href="https://medium.com/cryptronics">Cryptonics</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Signature Replay Vulnerabilities in Smart Contracts]]></title>
            <link>https://medium.com/cryptronics/signature-replay-vulnerabilities-in-smart-contracts-3b6f7596df57?source=rss----d46375cdc050---4</link>
            <guid isPermaLink="false">https://medium.com/p/3b6f7596df57</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[audit]]></category>
            <dc:creator><![CDATA[Stefan Beyer]]></dc:creator>
            <pubDate>Mon, 15 Apr 2019 06:40:30 GMT</pubDate>
            <atom:updated>2019-04-15T11:14:42.406Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lp0JmIUJPqoy4yO1OBs8qw.jpeg" /></figure><p>Cryptographic signatures are a fundamental building block of blockchains. Transactions are signed with the private keys corresponding allowing the transaction senders to be linked to their account. Without this feature, the Blockchain’s bookkeeping would simply not work.</p><p>Digital signatures are also often verified directly in smart contracts deployed on Ethereum, in order to allow one or more verifiers to authorize actions by submitting signatures created off-chain (or even signatures generated by another smart contract). This is commonly used in multi-signature vaults or voting contracts, in order to submit various signatures together or delegate authorization.</p><p>A common vulnerability in such implementations is the potential for signature replay attacks. Here at <a href="https://cryptonics.consulting/">Cryptonics</a>, we recently came across an interesting instance of this problem in a smart contract audit for a high-profile project. In this article, we will use this example to illustrate how things can go wrong with signature verifications in smart contracts.</p><p>Vulnerabilities related to signature verifications are usually caused by misunderstanding the underlying cryptographic principles and the purpose of signatures. So before getting into details of this particular vulnerability, let’s have a quick look at how cryptographic signatures work.</p><h3>Cryptographic Signatures</h3><p>Most cryptographic signature schemes rely on public and private key pairs. Data can be signed with a private key and this signature can be verified with the corresponding public key. As the naming suggests, a user’s public key is publicly distributed, whereas the private key must be kept secret.</p><p>Cryptographically signing data enables two important properties:</p><ul><li>The data signer can be identified. This is achieved by the ability to recover the signer’s public key.</li><li>Data integrity can be verified, meaning the signature can be used to prove that the data has not been modified since signing.</li></ul><p>While these are very powerful properties, it is important to note that cryptographically signing data does not provide any additional insurances on its own. The signature does not guarantee a message’s uniqueness, nor does it mean that the sender of the message is the signer of the message. Of course, cryptographic signatures can be used to establish these facts, but the necessary checks still have to be performed by the application. Let’s investigate this fact in the case of Ethereum smart contracts.</p><h3>Signature Verification in Ethereum</h3><p><a href="https://www.ethereum.org/">Ethereum</a>, like <a href="https://bitcoin.org/en/">Bitcoin</a>, uses the <a href="https://en.wikipedia.org/wiki/Elliptic-curve_cryptography">Elliptic Curve Digital Signature Algorithm (ECDSA</a>), together with the <a href="https://en.bitcoin.it/wiki/Secp256k1">secp256k1</a> curve. Smart contracts have access to the built-in ECDSA signature verification algorithm through the system method ecrecover. The following example illustrates the use of this function:</p><pre>address signer = ecrecover(msgHash, v, r, s);</pre><p>The method takes the signature values v, r and s and the <a href="https://en.wikipedia.org/wiki/SHA-3">keccak256</a> hash of the signed data as arguments. It validates the integrity of the data, meaning that the signature corresponds to the hash of the data and recovers the signer’s address (Ethereum addresses are derived from public keys).</p><p>Any additional checks on whether this signer address corresponds to the expected address, or whether the signed message is unique, have to be added by the smart contract programmer. Misunderstanding this behavior of ecrecoverfrequently leads to security vulnerabilities.</p><h3>Signature Replay Vulnerability</h3><h4>Code Example</h4><p>Let’s look at the bug we encountered in the recent audit mentioned above:</p><pre>function unlock(<br>  address _to,<br>  uint256 _amount,<br>  uint8[] _v,<br>  bytes32[] _r,<br>  bytes32[] _s<br>)<br>  external<br>{<br>  require(_v.length &gt;= 5);</pre><pre>  bytes32 hashData = keccak256(_to, _amount);</pre><pre>  for (uint i = 0; i &lt; _v.length; i++) {<br>    address recAddr = ecrecover(hashData, _v[i], _r[i], _s[i]);<br>    require(_isValidator(recAddr));<br>  }</pre><pre>  to.transfer(_amount);<br>}</pre><p>The above code is a simplification of the code we audited. It has been reduced to the bare essentials to make it shorter and easier to understand. However, the actual vulnerability remains untouched.</p><p>The audited contract is part of a cross-blockchain relay bridge that allows moving digital assets from one blockchain to another. Ether is locked in the contract when the equivalent asset is created on the other chain. The unlockfunction releases previously locked Ether to an address at the same time the asset is locked or destroyed in the other chain. To this end, across-chain relayer can submit an array of validator signatures, an amount to be unlocked, and a destination address. The function requires at least five signatures to unlock the amount requested and send it to the recipient. In addition, all signatures submitted need to be valid and come from designated validators. The internal _isValidator function (implementation omitted for brevity) checks whether an address is, in fact, a validator.</p><h4>Attack Scenario</h4><p>The problem with the above code is in the message that is signed by the validators using the ECDSA algorithm. The message only contains the receiver address and the amount to be unlocked. There is nothing in the message that could be used to prevent the same signatures to be used multiple times. Imagine the following scenario:</p><ul><li>Bob has the equivalent of 10 ETH on the connected chain, which he moves back across the bridge onto the Ethereum chain.</li><li>Alice is a relayer that processes this cross-blockchain transaction. She collects the necessary validator signatures, locks the appropriate amount on the linked chain and calls the unlock function causing 10 ETH to be freed from the contract and sent to Bob.</li><li>The transaction containing the arrays of signature values is publicly readable on the blockchain.</li><li>Bob can now copy the signature arrays and submit an identical unlockcall himself. This unlocking operation will succeed again, causing another 10 ETH to be sent to Bob.</li><li>Bob can repeat this process until the contract has been drained.</li></ul><h4>Mitigation</h4><p>The above scenario is called a signature replay attack. It is possible because there is no way of checking the uniqueness of this particular signed message or whether the signed message has been used before.</p><p>A simple way to avoid this type of attack is to include a sequential message number or <strong>nonce </strong>in the signed data. The fixed version of the above code would be as follows:</p><pre>public uint256 nonce;</pre><pre>function unlock(<br>  address _to,<br>  uint256 _amount, <br>  uint256 _nonce,<br>  uint8[] _v,<br>  bytes32[] _r,<br>  bytes32[] _s<br>)<br>  external<br>{<br>  require(_v.length &gt;= 5);<br>  require(_nonce == nonce++);</pre><pre>  bytes32 hashData = keccak256(_to, _amount, _nonce);</pre><pre>  for (uint i = 0; i &lt; _v.length; i++) {<br>    address recAddr = ecrecover(hashData, _v[i], _r[i], _s[i]);<br>    require(_isValidator(recAddr));<br>  }</pre><pre>  to.transfer(_amount);<br>}</pre><p>This code now requires a sequence number for each successful unlock call. This unique number is included in the signed message, making the signatures required for each successful call unique. This means that a previously observed message is of no use to an attacker, as replaying it would fail.</p><h3>Signature Best Practice</h3><p>The above example is just one example, in which non-unique signatures can be replayed. In most scenarios, it is important to make sure signatures are uniquely matched to each call, in order to prevent replay attacks. This is also the reason Ethereum transactions themselves include a nonce (just like in our solution above).</p><p>However, the code is not yet perfect. It does not follow the recommended best practice for signature verification. The reason for this is that it does not check for <strong>malleable signatures</strong>. s values that are part of accepted signatures should be checked to be in lower ranges. The recommended procedure for using the ecrecoverfunction can found in <a href="https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/cryptography/ECDSA.sol">Open Zeppelin’s excellent ECDSA library.</a> In fact, building on community audited code, such as <a href="https://openzeppelin.org/">Open Zeppelin</a>, is always a good idea.</p><p><strong>Are you building a blockchain-based application? </strong><a href="https://cryptonics.consulting/home/contact"><strong>Contact us</strong></a><strong>, if you wish to speak about security or any other blockchain related topic.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b6f7596df57" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cryptronics/signature-replay-vulnerabilities-in-smart-contracts-3b6f7596df57">Signature Replay Vulnerabilities in Smart Contracts</a> was originally published in <a href="https://medium.com/cryptronics">Cryptonics</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Proof-of-Work is not a Consensus Protocol: Understanding the Basics of Blockchain Consensus]]></title>
            <link>https://medium.com/cryptronics/proof-of-work-is-not-a-consensus-protocol-understanding-the-basics-of-blockchain-consensus-30aac7e845c8?source=rss----d46375cdc050---4</link>
            <guid isPermaLink="false">https://medium.com/p/30aac7e845c8</guid>
            <category><![CDATA[consensus]]></category>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[proof-of-work]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Stefan Beyer]]></dc:creator>
            <pubDate>Mon, 01 Apr 2019 11:12:14 GMT</pubDate>
            <atom:updated>2019-04-05T06:31:43.678Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vkC0OxeUqdmAuzViAnBqHg.jpeg" /></figure><p>Blockchain and distributed computing are complex technologies consisting of a number of layers. Few people understand the underlying cryptography and distributed algorithms in details. And, to be honest, that’s fine. The nature of specialization means that different experts concentrate on different layers and the end-results should fit together nicely through agreed interfaces.</p><p>However, when it comes to consensus protocols, there are a number of half-truth and myth that need to be addressed. Understanding consensus is a pre-requisite for choosing the right blockchain platform and configuration for an application. Making the wrong choice can lead to inefficient and insecure setups.</p><p>Here are a number of incorrect statements about blockchain consensus that are repeated frequently:</p><ul><li>“Proof-of-Work is a consensus protocol.”</li><li>“Blockchain consensus is secure as long no-one can control more than 50 % of the network.”</li><li>“Blockchain consensus is inefficient and energy-consuming.”</li><li>“Bitcoin was first in solving consensus in byzantine environments.”</li></ul><p>So, let’s have a closer look at consensus and clear up some misunderstandings.</p><h3>The Two Steps of Blockchain Consensus</h3><p>Consensus protocols solve a classic problem in Computer Science: How can a number of equal participants agree on a global view of events? In blockchain terms, this means, agreeing on a specific order in which transactions are processed. The goal of blockchain consensus is to maintain the exact same copy of the history on all nodes.</p><p>In a centralized system, solving this issue is easy: a central coordinator can simply impose the transaction order. In a distributed system this is not possible, and a more complex mechanism is required.</p><p>The process for adding to the ledger in Blockchains consist of appending a new block to the distributed data structure. This involves two main steps, each with their own choice of algorithms: <strong>selection of the block proposer </strong>and <strong>consensus on the inclusion of the proposed block</strong>. The former involves deciding which node gets to generate the next block, the latter focuses on whether or not a new block is accepted into the blockchain data structure. Both steps are equally important and entirely different.</p><h3>Block Proposer Selection Algorithms</h3><p>The easiest way to choose the next block producer would simply be taking turns or choosing the next block producer randomly. In fact, taking turns is a very good choice in situations with a fixed number of authorized participants. This is usually the case of permissioned consortium blockchain used in enterprise setups.</p><p>However, such a scheme does not work in public blockchains, in which anyone can participate freely, such as <a href="https://bitcoin.org/">Bitcoin</a> or the public <a href="https://www.ethereum.org/">Ethereum</a> network. Just like in a lottery, participants could just improve their chances significantly by obtaining a large number of tickets. If tickets were free or very cheap this could lead to the system being gamed. Such a scenario is known as a <strong>Sybil attack</strong>. Therefore a mechanism is required to attach an economic difficulty to the act of obtaining a ticket.</p><p><a href="https://en.wikipedia.org/wiki/Proof-of-work_system"><strong>Proof-of-Work (PoW)</strong></a><strong> </strong>is such a mechanism. So-called “mining” attaches a cost to participating in the block producer selection algorithm. It is okay for participants to obtain a lot of tickets, but they have to pay for improving their chances with computing power. Therefore, <strong>PoW is not a consensus algorithm at all, it is merely a Sybil-resistant tool for selecting the next block producer</strong>. This is important to understand, as PoW can be combined with a number of consensus algorithms. In fact, as we will find out in the next section, Bitcoin’s consensus algorithm is extremely simple and provides very weak guarantees.</p><p><a href="https://en.wikipedia.org/wiki/Proof-of-stake"><strong>Proof-of-stake (PoS)</strong></a> is a similar tool for selecting the next block producer. In this case, computing power is simply eliminated and economic wealth is taken to weight the lottery probabilities, based on the observation that computing power relies on economic power. The obvious advantage is the reduction in energy consumption that is associated with PoW.</p><h3>Consensus Algorithms</h3><p>The actual consensus algorithm in a blockchain system is executed after a block has been proposed by the chosen block producer. Participants have to reach an agreement on whether to include a block or not. Bitcoin and similar blockchains, including Ethereum, don’t really execute any particular algorithm to reach such an agreement. Instead, they choose a hands-off approach which simply allows temporary disagreements and establish a rule that the strongest chain wins, meaning the chain supported by the majority of the network’s computing power. Temporary forks are accepted and are indeed quite common. This form of consensus is sometimes termed <a href="https://blockonomi.com/nakamoto-consensus/">Nakamoto consensus</a> and has far-reaching consequences on the guarantees that can be provided by the network, as we will see in the next section.</p><p>Even before the invention of Bitcoin and blockchain systems, researchers in distributed systems had developed a number of consensus protocols that work quite differently. <a href="http://pmg.csail.mit.edu/papers/osdi99.pdf">BFT consensus protocols</a> execute a number of communication rounds between the participants of the network to vote on the inclusion of a block and reach a firm agreement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VsCSmV88qUefiNmEoHXPlQ.png" /><figcaption>BFT Consensus Voting Rounds — image source: <a href="https://github.com/pheymann/scala.bft">Paul Heymann</a></figcaption></figure><p>It has been mathematically proven that this type of protocol can keep operating correctly as long as less than one-third of the participants act maliciously. The disadvantage of BFT consensus is that it scales badly, due to the communication overhead involved. For this reason, this type of protocol is mainly used in situations where the number of validators is limited and known in advance, such as in consortium blockchains or <a href="https://wiki.parity.io/Proof-of-Authority-Chains">Proof-of-Authority</a> chains (chains with a small number of authorized block producers).</p><p>Blockchain implementations of BFT consensus protocols include <a href="https://github.com/ethereum/EIPs/issues/650">Istanbul BFT</a> and <a href="https://www.tendermint.com/">Tendermint</a>. In fact, the recent popularity of BFT consensus adapted to blockchain systems has led to renewed research interest in this classic field. Examples include the recent work on <a href="http://www.sikoba.com/docs/SKOR_AK_One_Step_Consensus.pdf">BFT consensus optimization by Sikoba Research</a>.</p><h3>Finality</h3><p>The difference between Nakamoto consensus and BFT consensus affects finality. Finality relates to the guarantees that can be given on a block, and in consequence, the transactions within a block, being indefinitely included in the chain. Essentially, strong finality means the block will not be rejected in the future, resulting in the transactions being undone.</p><p>Nakamoto consensus only provides probabilistic finality. This means that the probability of a block being final increases with every additional block added to the chain but never reaches theoretical certainty. In Bitcoin, for example, we are generally advised to wait for 6 additional blocks for a transaction included in a block to be considered confirmed. This means that on average, <strong>a Bitcoin transaction is considered safe after approximately one hour, due to practicality-based heuristics, rather than strong protocol guarantees.</strong></p><p>In contrast, BFT consensus protocols with voting rounds provide strong guarantees. Once a block has been voted to be included by a two-thirds majority, transactions can be considered safe. This means that blockchains using such a protocol can be much more agile and can provide transaction finality in a very short timeframe. However, as mentioned above, BFT consensus is only practically achievable with a relatively small number of validators (think hundreds, rather than thousands).</p><p>Finality also becomes important in blockchain interoperability and sharding solutions. The former focuses on interactions between different blockchains, the latter refers to splitting a blockchain up into smaller chunks for scalability reasons. In either case, communication has to happen across different chains. It would be very inconvenient for a transaction to be undone on one chain after it has already been transferred to other chains. A partial fix for this problem can be found in so-called finality gadgets, which layer a stronger finality layer on top of weaker consensus protocols. <a href="https://arxiv.org/abs/1710.09437">Casper FFG</a> and <a href="https://medium.com/polkadot-network/grandpa-block-finality-in-polkadot-an-introduction-part-1-d08a24a021b5">GRANDPA</a> are examples of such finality gadgets.</p><h3>Delegated Proof-of-Stake</h3><p>A very interesting and also often misunderstood compromise solution to blockchain consensus is <a href="https://bitshares.org/technology/delegated-proof-of-stake-consensus/">Delegated Proof-of-Stake (dPoS)</a>. The dPoS approach uses a staking token as a voting mechanism to elect a reduced and fixed number of validators that execute a consensus protocol.</p><p>The implications of this are that block producer selection between the delegates can be simplified (at the expense of having to deal with delegate voting) and that the smaller set of validators can execute a very efficient consensus protocol. This means that <strong>dPoS can be used to combine the advantages of public blockchains and BFT consensus</strong>, bringing almost instant finality to open networks, in which all participants can participate to some degree.</p><p>Security in dPoS blockchain is the subject of ongoing research and is very closely linked to governance. Essentially, the challenge is to ensure that the voting of delegates is fair and mechanisms to prevent cartel formations are in place. It is important to note that <strong>dPoS should be seen as a configurable trade-off between decentralization and performance</strong>. On the extreme end of the spectrum, <a href="https://eos.io/">EOS</a> reduces the number of validators to just 21 nodes to provide a very fast platform. Other systems, such as the recently launched <a href="https://cosmos.network/">Cosmos hub</a>, place a lot of emphasis on security and try to achieve true decentralization.</p><p>Of course, cartel formation and centralization are real risks with dPoS. On the other hand, can PoW dominated by a handful of mining pools (located in places where electricity is cheap) be considered decentralized?</p><h3>Conclusion</h3><p>Consensus is not as straightforward as it appears. As with anything in Computer Science, trade-offs have to be made and there is no one ideal solution. While it is impossible for everyone to understand all the technical nuances of different consensus protocols, it is important to understand the basics of consensus before choosing a blockchain platform for a given application. This is particularly important in the face of the amount of misinformation and myths that have been published regarding the subject.</p><p><strong>Are you building a blockchain-based application? </strong><a href="https://cryptonics.consulting/home/contact"><strong>Contact us</strong></a><strong>, if you wish to speak about security or any other blockchain related topic.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=30aac7e845c8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cryptronics/proof-of-work-is-not-a-consensus-protocol-understanding-the-basics-of-blockchain-consensus-30aac7e845c8">Proof-of-Work is not a Consensus Protocol: Understanding the Basics of Blockchain Consensus</a> was originally published in <a href="https://medium.com/cryptronics">Cryptonics</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Smart Contract Audits — The 12 Steps to Blockchain Security]]></title>
            <link>https://medium.com/cryptronics/smart-contract-audits-the-12-steps-to-blockchain-security-82543dc383cc?source=rss----d46375cdc050---4</link>
            <guid isPermaLink="false">https://medium.com/p/82543dc383cc</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[smart-contract-auditing]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <dc:creator><![CDATA[Stefan Beyer]]></dc:creator>
            <pubDate>Mon, 04 Feb 2019 10:03:40 GMT</pubDate>
            <atom:updated>2019-02-04T10:03:39.923Z</atom:updated>
            <content:encoded><![CDATA[<h3>Smart Contract Audits — The 12 Steps to Blockchain Security</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6COowzYc12f0YEwDbK2Z1Q.jpeg" /></figure><p>At <a href="https://cryptonics.consulting/">Cryptonics</a>, we have audited the smart contracts of <strong>22 blockchain projects during the last 12 months</strong>. These projects included both fungible and non-fungible tokens, complex exchange protocols, prediction markets, staking systems, and smart contract-based video-games.</p><p>In the audited contracts, we discovered a total of <strong>13 critical</strong>, <strong>16 major</strong>, and <strong>36 minor issues</strong>. But what do these numbers demonstrate? As much as we would like to boast, these statistics do not just highlight our auditing capabilities (we like to think they do, of course). They mainly illustrate that writing secure smart contracts is very difficult. They also show that getting an independent audit is a must for any serious blockchain-based project.</p><p>In this article, we will explain our auditing process and methodology, clear up some myths about smart contract audits, and also highlight the need to look at security beyond smart contracts.</p><h3>The Auditing Process</h3><p>Many projects that come to us expect an audit to consist in a simple code review by an experienced smart contract developer. However, while knowing how to develop good contracts is an important skill for any auditor, the auditing process involves a strict methodology and a well-defined process far beyond simply reviewing the code. Let’s break our process down into individual steps:</p><h4>1. Source Code Lock-down</h4><p>Smart contracts to be audited may be delivered to us in a number of ways: a <a href="https://truffleframework.com/">Truffle</a> project in a compressed archive, a link to a source code repository, or even contracts with verified source code already deployed on a test network.</p><p>The very first step we do is ensuring the integrity of the audited files can be confirmed after the audit. This means we require a way of a fingerprinting the exact source code version in our audit report. In the case of source code repositories, this is easy and simply involves taking note of the commit number. In other cases, we compute the SHA-256 hash of every file submitted to the audit.</p><p>This step is important because projects do not just use audits to verify security, they also use them to demonstrate their users that the code behaves as advertised and documented.</p><h4>2. Project Familiarization Phase</h4><p>Before we get into detail of the code, we familiarize ourselves with the purpose of the smart contract architecture. To this end, we ask projects to provide all the documentation they have available. At this stage, we may also have a discussion with the development team, in order for them to explain their design and architecture.</p><h4>3. Preliminary Code Review</h4><p>Now it’s time to delve into the code. In this important step, our auditors read through the source code, try to understand the main design decision, look at the libraries used and verify the test coverage.</p><p>At this stage, we usually already get a feel for the general quality of the design.</p><h4>4. Static Code Analysis</h4><p>We use a number of tools to automatically scan the contracts for certain types of vulnerabilities. Usually, projects use these types of tools themselves during development, but sometimes the automated analysis comes back with some useful finds. Of course, static code analysis has its limitations and false positives are common, which is why we analyze in detail any issue highlighted by the tools.</p><h4>5. Code Quality Analysis</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_pbJmikI7UP_mXtHMstdNw.jpeg" /></figure><p>Next, the quality of the coding is assessed. This analysis verifies that common best security practices for smart contract programming have been followed, as well as more general software engineering guidelines, such as commenting, variable naming, code structure and layout, function visibility and avoidance of replicated code.</p><h4>6. Known Vulnerability Analysis</h4><p>This phase is what most people would associate with a smart contract audit. A line by line code analysis is performed against a checklist of known vulnerabilities, including:</p><ul><li>Reentrancy</li><li>Variable Shadowing</li><li>Storage Pointer Exploits</li><li>Over- and Underflows</li><li>Potential Denial of Service Attacks</li><li>Block Gas Limit Issues</li><li>Timestamp Dependencies</li><li>Insecure Random Number Generation</li><li>Incorrect Cryptographic Signature Validation</li><li>Transaction Ordering Assumptions</li></ul><p>Any issues found will be labeled <strong>critical</strong>, <strong>major </strong>and <strong>minor</strong>, according to severity.</p><h4>7. Functionality Analysis</h4><p>Many smart contract vulnerabilities can be found in simple programming errors that affect the functionality of the contract. We, therefore, carry out another line by line code analysis to verify the correct behavior of the code.</p><p>Often, this step involves verifying the math of the smart contracts. Common errors include rounding impression due to integer arithmetic, or errors in formulas. Another likely cause for errors is access and permission management.</p><h4>8. Live Testing</h4><p>The previous two steps often leave unanswered questions in terms of exploitability or correct functioning in edge cases. Depending on the complexity of the issues, we may decide to deploy the contracts on a local test network and run our own test. This may involve developing actual exploits that show how the contract can be attacked.</p><h4>9. Gas Usage</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xvg3NaaAFhvbROqqSQu6ug.jpeg" /></figure><p>After the security and functionality of the smart contracts have been confirmed, we look at their efficiency. Gas usage is analyzed, first through an automated gas estimation, and then through another line by line manual code analysis.</p><h4>10. First Round Audit Report</h4><p>With all the audit steps completed, a report is written and delivered to the client. The report includes all issues identified and a list of additional recommendations. An example report can be found <a href="https://cryptronics.io/wp-content/uploads/2018/06/20180601_Audit_Report_CryptoFights.pdf">here</a>.</p><h4>11. Review of Round One Fixes</h4><p>It is rare to have an audit in which we find no issues whatsoever. For this reason, our audit process involves at least two rounds. Clients are given the chance to fix the issues identified in the first round and can submit a new version of the code. Usually, the fixing process involves several rounds of direct communication between the auditor and the client. Each fix is reviewed again to ensure it does resolve the issue and does not introduce any additional issues or unwanted side effects.</p><h4>12. Final Audit Report</h4><p>Once all fixes have been submitted and reviewed, we update the audit report and produce a final version, which clearly identifies the issues found, the fixes applied and the final verdict.</p><h3>A Comprehensive Process</h3><p>As can be seen from the above process, the auditing process follows a strict methodology. For this reason, smart contract audits take time and require resources. They should not be solicited as an afterthought, a few days before the launch date of a project.</p><p>For those clients, wishing to deal with security right from the beginning, <a href="https://cryptonics.consulting/">Cryptonics</a> also offers consulting services throughout the development process. We can guide projects through smart contract development and be involved as security advisors all the way from design through development, testing, and deployment.</p><h3>Security Beyond Smart Contracts</h3><p>Decentralized applications and blockchain infrastructures involve many additional layers beyond smart contracts. At the lowest level blockchain nodes have to be configured and deployed. Keys have to be generated, stored and managed. API’s are used to interact with the smart contracts, and web or mobile interfaces are access points for end-users.</p><p>While it has become custom to get at least some form of external review for smart contracts, these additional layers are mostly ignored. <a href="https://cryptonics.consulting/">Cryptonics</a> looks back on 15 years of cybersecurity experience in its parent company, <a href="https://s2grupo.es/">S2 Grupo</a>, and provides compressive full-stack auditing services for decentralized applications. This may include code reviews, black box testing, and white box testing.</p><p>In 2018, <strong>1.7 billion USD were lost to digital asset theft</strong> in the blockchain industry, according to reports. As far as we know, none of these incidents were due to the breaking of the underlying cryptography, but mainly due to smart contracts vulnerabilities, application bugs, misconfigurations, and poor security policy. Most could probably have been avoided by applying best practice guidelines for cybersecurity and getting a qualified security audit.</p><p><strong>Are you building a blockchain-based application? </strong><a href="https://cryptonics.consulting/home/contact"><strong>Contact us</strong></a><strong> to speak about security or any other blockchain related topic.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=82543dc383cc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cryptronics/smart-contract-audits-the-12-steps-to-blockchain-security-82543dc383cc">Smart Contract Audits — The 12 Steps to Blockchain Security</a> was originally published in <a href="https://medium.com/cryptronics">Cryptonics</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Blockchain Interoperability — Moving Assets Across Chains]]></title>
            <link>https://medium.com/cryptronics/blockchain-interoperability-moving-assets-across-chains-e5203357d949?source=rss----d46375cdc050---4</link>
            <guid isPermaLink="false">https://medium.com/p/e5203357d949</guid>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[interoperability]]></category>
            <category><![CDATA[distributed-ledgers]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Stefan Beyer]]></dc:creator>
            <pubDate>Mon, 05 Nov 2018 18:22:47 GMT</pubDate>
            <atom:updated>2018-11-05T18:34:59.086Z</atom:updated>
            <content:encoded><![CDATA[<h3>Blockchain Interoperability — Moving Assets Across Chains</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4SSlGbmE6JVl2qKckwnA7Q.jpeg" /></figure><p>Since <a href="https://bitcoin.org/bitcoin.pdf">Bitcoin</a> emerged as the world’s first peer-to-peer currency, it has become common practice to represent assets on blockchains. Assets may be protocol-level cryptocurrencies, such as Bitcoin and Ether or they may be implemented in smart contracts, in the form of fungible or non-fungible tokens. In any case, there is now a very large eco-system of decentralized assets, represented on a number of different blockchains. Making these blockchains work with each other in a way that allows trading or moving assets between different chains is a challenge, mainly because blockchains are designed to be self-contained ecosystems. Breaching the boundaries this ecosystem introduces risks related to trust and security. Therefore, any blockchain interoperability solution has to be designed carefully.</p><p>When dealing with assets on different blockchains, there are two main interoperability scenarios: trading an asset on one chain for another asset on another chain or representing an asset on several chains and moving instances from one chain to another. These two cases are different in nature and need to be implemented differently. Let’s look at the easier case of trading one asset for another first, before discussing strategies for moving assets across chains.</p><h3>Trading Assets on Separate Chains</h3><h4>Atomic Swaps</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*VD6WmTr0rkq__a_SRiMF4A.png" /><figcaption>Atomic swaps</figcaption></figure><p>Let’s assume Bob wants to make a trade with Alice, buying 10 Ether with 1 Bitcoin. Of course, this is currently a bad deal for Bob, but let’s forget about exchanges rates for a moment and use these numbers for simplicity. Bob and Alice could use a trusted third party to do this trade, for example a centralized cryptocurrency exchange. However, in the true spirit of decentralization, Bob and Alice do not wish to use a middleman and prefer to rely on the built-in trust of the two blockchain protocols involved.</p><p>The desired property of the asset swap is atomicity. This means that either both transfer operations happen, or none at all. One of the parties receiving the asset without also transferring the counter value is not an option. The resulting operation is, therefore, called an <strong><em>atomic swap</em></strong><em>.</em></p><h4>Hash-locks</h4><p>There is a simple strategy that Bob and Alice can use to perform their atomic swap without trusting each other and without relying on a trusted third party. They can use hash-locks on both chains to perform the two transfer operations atomically.</p><p>This works as follows: Alice sends Bob 10 Ether through a smart contract. However, the contract is locked with a secret that needs to compute to a hash visible in the contract. Note, that hash functions are one-way functions, so the transaction can only be unlocked by providing the secret only known to Alice at this stage.</p><p>Bob now uses the same hash as a lock on a Bitcoin transaction to Alice. He does not know the secret yet, but he knows its hash value. Once Alice sees that Bob has locked the correct amount of Bitcoin with the same hash, she can unlock the Bitcoin transaction by supplying the original secret that computes to the required hash. By doing though, she not only releases the funds but at the same time publishes the secret on the blockchain. Bob, who has now learned the secret, uses it to unlock the Ethereum transaction directed to him.</p><h4>Timeouts</h4><p>But what would happen if Alice never unlocked the Bitcoin transaction? Well, both transactions would remain stuck forever. Therefore, atomic swaps require a timeout. If the transaction is not completed by providing a secret within a time <strong><em>t</em></strong>, the funds should be refunded.</p><p>In our case, Alice creates the first transaction and creates the secret. Consider the case of the timeouts of both transactions being of equal duration. If Alice waited until just before the timeout, she could cheat Bob by not giving him enough time to unlock the funds destined to him. They would just be refunded to Alice. Therefore, the transaction from Bob to Alice should have a shorter timeout, typically<strong> <em>t/2</em></strong>. This ensures that both parties have the same amount of time to unlock their funds.</p><h4>Protocol Support</h4><p>Atomic swaps are possible between blockchains that provide the necessary primitives for timeouts and hash-locks. This includes most chains that provide some simple form of smart contracts. Bitcoin’s scripting language is sufficient for this. The instruction set does not have to be Turing complete.</p><p>Of course, Bob and Alice, as normal users, should not have to know how to set up an atomic swap manually. Protocols, such as <a href="https://interledger.org/">Interledger</a> make implementing atomic swaps easy and allow building systems that facilitate payments across different ledgers.</p><p>One problem with atomic swaps is that they are slow, in particular on blockchains with probabilistic finality. Platforms, such as Bitcoin and Ethereum, may occasionally fork, due to blocks being produced simultaneously. This means that transactions may be undone. The probability of this occurring decreases with every block added to the chain. For this reason, Bitcoin transactions are generally considered confirmed after six subsequent block generations. Therefore, atomic swap implementations need to allow for this and not release assets too early.</p><h3>Portable Assets</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*tGOHNKozpp_hGBqbCb359A.png" /><figcaption>Moving an asset across chains</figcaption></figure><h4>One-way and Two-way Pegs</h4><p>The second use case for blockchain interoperability is moving an asset from one chain to another. The asset may exist on both chains, with the total amount in existence being the constant sum on each chain. This may be useful in a number of scenarios, for example moving a token used in a permissioned blockchain on to a public chain for trading on an exchange, or interfacing two consortium networks with a common asset representation.</p><p>In order to implement such a scheme, the asset representation on one chain needs to be pegged to the representation on the other chain. If <em>n</em> tokens are moved from one chain to another, the balance on the source chain must decrease by <em>n</em> tokens and the balance on the destination chain must increase by n tokens simultaneously. The total number of tokens on both chains must remain constant. This is usually achieved by burning or immobilizing tokens on the source chain and minting or unlocking tokens on the destination chain. If the solution only allows moving assets in one direction, such a peg is called a <strong><em>one-way peg</em></strong>. In the case of an asset being moveable in either direction, the beg is called a <strong><em>two-way peg</em></strong>.</p><h4>Custodian Bridges</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*mANjQgx8NTB4j8VvnmR93Q.png" /><figcaption>Custodian Bridges</figcaption></figure><p>Moving tokens from one chain to another introduces a trust issue. This trust issue is quite different from the trust issue resolved by atomic swaps. Trading two different assets on different chains simultaneously requires two individuals to find a way to trust that their two transactions are executed atomically. However, in the case of portable assets the whole network needs to be able to trust a single account to increase its balance on one chain by the same amount as it decreases it on the other chain.</p><p>This required trust can be provided by custodians. Custodians are trusted intermediaries that are in charge of locking assets (or burning them) on the source chain and unlocking (or minting) them on the destination chain. Usually, a custodian bridge consists of accounts on each chain, possibly a smart contract. Assets are immobilized on one chain by locking them into the custodian account and simultaneously unlocked by the custodian account on the other chain. For this to work, the total supply of a token essentially exists twice, once on each chain. On each chain, the custodian account immobilizes exactly the same amount as the number of tokens in circulation on the other chain.</p><h4>Single Custodians versus Multi-signature Federations</h4><p>Single custodian accounts require a centralized trusted third party to act as a notary. This may be acceptable in some circumstances, for example, in the case of two consortium chains interfacing through a regulator. However, in general, trusted third parties are contrary to the blockchain principles of decentralization and trustless operations.</p><p>Therefore, a common solution is to turn the custodian account into a <strong><em>multi-signature account</em></strong> and to use several notaries. A majority of notaries must agree to lock or unlock funds. Choosing these notaries wisely is very important. We will discuss further on this article how some blockchain frameworks designed for interoperability deal with this issue.</p><h3>Relay Solutions</h3><p>Relays are systems implemented on one blockchain that allow events and state on another blockchain to be read and validated. They tend to make use of <a href="https://en.wikipedia.org/wiki/Merkle_tree">Merkle trees</a> and <a href="https://medium.com/crypto-0-nite/merkle-proofs-explained-6dd429623dc5">Merkle proofs</a> or similar cryptographic concepts. Transactions can be cryptographically referenced using such as data-structure. Any changes are detectable by executing cryptographic proofs. Transactions that are relayed can be cryptographically verified.</p><p>Relays can be used to connect sidechains to existing blockchains. <a href="https://plasma.io/">Plasma</a> is a solution for implementing sidechains connected to the Ethereum network.</p><h3>Interoperable Blockchain Frameworks</h3><h4>Multi-chain Solutions</h4><p>Some more recent blockchains are designed as frameworks to build networks of blockchains. <a href="https://polkadot.network/">Polkadot</a>, <a href="https://cosmos.network/">Cosmos</a> and <a href="http://thorchain.org/">THORchain</a> are emerging multi-chain architectures, designed for interoperability. These three platforms can be used to implement networks of blockchains. This is made possible by incorporating relay technology and multi-signature custodian bridges into the protocol architecture.</p><p>The three platforms can be used to build asset exchange networks and decentralized exchanges with various degrees of specialization. However, whilst Cosmos and Polkadot are more general purpose, THORChain is optimized for cross-chain asset trading and decentralized exchanges.</p><p>This specialization is not just evident in the efficient multi-chain architecture but also by the fact that <a href="https://medium.com/thorchain/thorchains-liquidity-breakthrough-85a0fdbcd396">Continuous Liquidity Pools</a> are built into the protocol as a means of providing liquidity.</p><h4>Chain Relays</h4><p>Polkadot, Cosmos and THORChain rely on a root chain that acts as a gateway for a number of parallel chains to communicate. This approach is very similar to side-chain relays but built into the protocol.</p><p>Essentially, the root chain stores Merkle roots of transactions that occur on individual chains. It also provides an incentive layer for validators and acts as a way of verifying cross chain transactions.</p><p>This allows compatible chains to directly connect to other compatible chains at the protocol level and form a network of blockchains. These native chains may be very different in nature, but all provide block finality to ensure cross-chain transactions are fast and secure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*p97kELoT9w6Vk1iD6_EccA.png" /><figcaption>Individual chains communicate through a root chain.</figcaption></figure><h4>Connecting External Chains</h4><p>In order to connect to existing blockchains, all three platforms use special native chains that mimic the external legacy chains. Multi-signature custodian bridges are used to move assets from a legacy chain to its native equivalent and vice versa.</p><p>Cosmos employs the whole validator set as signatories on multi-signature accounts on external blockchains with which the platform interfaces.</p><p>The <a href="https://github.com/thorchain/Resources/blob/master/Whitepapers/Bifrost-Protocol/whitepaper-en.md">Bifröst</a> interoperability protocol, designed for THORChain, proposes the creation of bridges with a configurable number of notaries, chosen from the set of validators. The chosen validators are randomly replaced at certain intervals. The signature threshold required for releasing assets is also configurable, with the protocol supporting <strong><em>m of n</em></strong>, <strong><em>n-1</em></strong> <strong><em>of n</em></strong> and <strong><em>n of n </em></strong>multi-signature schemes. Notary nodes must also relay transactions and report the block height correctly (within a certain threshold), or they are penalized by the staking protocol.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*kT4DzvOqk2UPE7NoJYLTHQ.png" /><figcaption>THORChain multi-signature custodian bridge. Validators subsets act as notaries and are randomly swapped out.</figcaption></figure><p>As in the case of atomic swaps, bridges from multi-chain frameworks to external chains have to deal with the fact that some blockchains do not provide true block finality but rely on a probabilistic model. Bridges must act as finality adapters in this case, usually by choosing a reasonable number of added block confirmations as a threshold for pseudo-finality.</p><p>Multi-chain solutions also require governance procedures to manage the process of deciding when and how to create interoperability chains to external chains.</p><h3>Final Thoughts</h3><p>As we have seen, blockchain interoperability involves various trade-offs between security, consistency, and performance. It is unlikely that one approach can cover all use cases. For instance, enterprise architectures interfacing permissioned consortium chains will have other requirements than decentralized exchange solutions for public networks.</p><p>Blockchain architects must, therefore, be aware of a number of techniques. Frameworks and libraries providing the building blocks for blockchain interoperability are beginning to emerge to facilitate such solutions.</p><p><strong>At </strong><a href="https://cryptronics.io/"><strong>Cryptronics</strong></a><strong>, we specialize in designing reliable and secure blockchain architectures. If you have a blockchain solution and wish to verify security, or require custom design and development for a decentralized application, feel free to </strong><a href="https://cryptronics.io/home/contact"><strong>contact us</strong></a><strong>.</strong></p><p><em>Disclosure: The author of this article is involved with the </em><a href="https://thorchain.org/"><em>THORChain</em></a><em> project.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e5203357d949" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cryptronics/blockchain-interoperability-moving-assets-across-chains-e5203357d949">Blockchain Interoperability — Moving Assets Across Chains</a> was originally published in <a href="https://medium.com/cryptronics">Cryptonics</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Smart Contract Security Audits — An Experience Report]]></title>
            <link>https://medium.com/cryptronics/smart-contract-security-audits-an-experience-report-e3e56a0cc04c?source=rss----d46375cdc050---4</link>
            <guid isPermaLink="false">https://medium.com/p/e3e56a0cc04c</guid>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[audit]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Stefan Beyer]]></dc:creator>
            <pubDate>Wed, 04 Jul 2018 11:20:16 GMT</pubDate>
            <atom:updated>2018-07-04T11:20:16.347Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wyX-VsShVXNjCXjxK2gjHA.jpeg" /></figure><p>Smart contracts were originally envisaged as legal agreements implemented in computer code for automation purposes. Nick Szabo <a href="http://www.fon.hum.uva.nl/rob/Courses/InformationInSpeech/CDROM/Literature/LOTwinterschool2006/szabo.best.vwh.net/smart.contracts.html">wrote about smart contracts in 1994</a>, but blockchain technology has turned the concept into a reality.</p><p>Smart contracts on the blockchain are both publicly accessible and immutable, meaning that anyone can access them, and they cannot be updated. This produces some interesting security challenges, which we have <a href="https://medium.com/cryptronics/ethereum-smart-contract-security-73b0ede73fa8">discussed previously</a>. Because of this, it has become common practice and, in some cases, mandatory to perform external smart contract security audits.</p><p>At <a href="https://cryptronics.io/">Cryptronics</a>, we have been performing security audits of Ethereum smart contracts for a while now. In this article, we will give an overview of our observations.</p><h3>Most Audits are for ICOs</h3><p>Initial Coin Offerings (ICOs) tend to be called “token sales” now in the belief that this will stop regulators from looking carefully, but the concept remains the same. Businesses are “tokenized”, in order to raise large amounts of funds for a project. Despite scams and negative news, there is no end in sight for the ICO boom. Consequently, most audits we perform are of token and crowd sale contracts, although some more interesting contracts, in particular, those dealing with non-fungible assets, have also made it into our auditing portfolio.</p><p>Our first observation of this space is that all the projects that have engaged our auditing services seem legit projects. We cannot confirm the <a href="https://www.investopedia.com/news/80-icos-are-scams-report/">often quoted statistic</a> that 80 % of ICOs are scams. Maybe this is because scam projects are not worried about audits anyway, by our observation is that the ICOs we have come across in our audits seem serious projects with the full intention of building a company. Most projects actually seem quite interesting, although some leave us to wonder whether the token actually adds any value beyond raising funds.</p><h3>Lack of Experienced Blockchain Engineers</h3><p>Our second observation is that the quality of most smart contracts is shockingly poor. There are exceptions to this and we will name a couple of projects for their exceptional smart contract quality towards the end of this article.</p><p>However, it is amazing how much some projects are willing to spend on marketing and all sorts of advisors, and how little they are prepared to spend on protecting their business from simple programming errors.</p><p>The lack of code quality cannot be explained by the fact that blockchain technology is relatively new. There is a distinct absence of software engineering knowledge that can only be explained by cheap and inexperienced labor. Basic concepts, such as separation of concerns and modularity are often absent. Implementing crowd sale functionality in the actual token contract is surprisingly common.</p><p>Furthermore, many developers seem to be unaware of existing community audited open source code that can be re-used. If you need a standard ERC-20 token you have to look no further than <a href="https://github.com/OpenZeppelin/openzeppelin-solidity">Open Zeppelin’s reference implementation</a>. Even for token sale contracts, you would be hard-pressed to find a model not already covered by one of the many reference implementations. Instead, developers chose to re-invent the wheel with amazing creativity.</p><h3>Due Diligence as an Afterthought</h3><p>One of the things that surprised us most when we started out with smart contract auditing was how late in the process many projects start their due diligence. It is not uncommon to receive urgent requests for audits on a Friday evening because their ICO is about to start the following Monday. We like the occasional night shift as they tend to pay extremely well, but there is a limit to what can be done over a weekend. The auditing process takes time. It is a complex process involving several steps that require high levels of concentration. Usually, there is also a second round, in which issues found in the first round are fixed.</p><p>In most cases, we have taken on time-sensitive audits, the client ended up unhappy when issued where found. One client got really angry with for having to postpone the start of his ICO. We have also had a client ask us to remove issues from the report, as the token was already on exchanges and could not be fixed. We refused, of course, which led to some debate about outstanding payments.</p><h3>Protecting the Company, not the Client</h3><p>Smart contract authors are understandably keen to make sure no-one can misuse their contracts. They are less enthusiastic about the auditor identifying backdoors the contract owner might exploit or inconsistencies with the whitepaper.</p><p>In most cases this is not malicious behavior. It is human nature to believe in one’s own integrity. However, project owners should realize that the whole point of smart contracts is to provide trust for both parties. A solid smart contract that protects both sides and provides transparency will improve a project’s credibility. This should not be underestimated.</p><h3>Positive Exceptions</h3><p>The above may sound very negative, but most projects have managed to improve their process through the auditing procedure and their contract can now be considered secure (or as secure as they can be).</p><p>In addition, several projects have surprised us positively.</p><p>The <a href="https://www.xchng.io/">XCHNG token sale</a> stands out amongst ICOs for exceptionally well written smart contracts employing known good practice guidelines.</p><p><a href="https://cryptofights.io/">CryptoFights</a> is a blockchain-based game that represents game characters and their accessories as digital assets on the blockchain. In addition to not following the ICO model, the smart contracts we have audited were refreshingly original, well organized and secure.</p><p>(<strong>Disclaimer: The author has been previously engaged for technical writing by the CryptoFights team but is not paid for this mention. Nor does the author or Cryptronics hold any CryptoFights shares or tokens</strong>).</p><h3>The Importance of Smart Contract Audits</h3><p>The nature of smart contracts makes due diligence auditing a necessity. The process is neither simple nor fast and projects should allocate both budget and time for external smart contract audits, preferably from more than one independent providers.</p><p><a href="https://cryptronics.io/">Cryptronics</a> is an experienced smart contract audit provider with a well-defined workflow. Feel free to look at an <a href="https://cryptronics.io/wp-content/uploads/2018/06/20180601_Audit_Report_CryptoFights.pdf">example audit report</a> from the above-mentioned CryptoFights and <a href="https://cryptronics.io/home/contact">contact us</a> for information on pricing and process.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e3e56a0cc04c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cryptronics/smart-contract-security-audits-an-experience-report-e3e56a0cc04c">Smart Contract Security Audits — An Experience Report</a> was originally published in <a href="https://medium.com/cryptronics">Cryptonics</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>