Quantstamp: Value in Decentralized Smart Contract Security

Source: www.quantstamp.com

** Disclaimer: this article is not investment advice and I am not a financial adviser or professional. This article is meant for informational purposes only; always perform your own due diligence on projects before forming your opinion. This is not a guarantee Quantstamp will be successful; 90% of startups fail. I am currently a holder of QSP tokens.**

When selecting interesting blockchain/crypto projects to follow, I always follow my mantra “Focus on projects that bring value to society”. Simple enough, right? Judging by the amount of effort many investors have spent trying to quantify this, clearly it is a very difficult statement to evaluate. It is a vague sentence, and can be interpreted many ways. What is value and how can we measure it? This could be an article in and of itself, but I like to simply define a value adding product or project as something that solves a problem for society.

In my inaugural medium post I want to discuss one of my favorite projects, Quantstamp. I have been an active community member and token holder since shortly after their ICO, so therefore a lot of this post will simply be compiled information from their whitepaper, website, blogposts, and AMA’s along with my analysis and opinion. I will try to keep this article as non-technical as possible, but it does assume you have at least a little background knowledge of the blockchain space.

Why Quantstamp? Compared to some of my other favorites, Quantstamp isn’t discussed much in the community and when it is, there are a lot of questions and FUD. In this post I will discuss: a brief history of relevant events, problems with smart contracts, proposed solutions from Quantstamp, the value model of the QSP token, Quantstamp’s business strategy, and finally criticism the team has received. The purpose of this article is to give an overview of Quantstamp and demonstrate why I think it is a sleeping giant in a space where security is more essential than ever.

A Brief History

One of the first major smart contract hacks occurred in 2016; the infamous “DAO Hack”. There are a lot of great articles describing this hack, (see here for an example), so I won’t go into detail here. This was the event that would motivate Quantstamp co-founders Richard Ma and Steven Stewart to begin creating multiple decentralized protocols to help secure smart contracts on a blockchain. Richard himself lost money in the hack, making it a very personal sore spot in his crypto experience. Presenting at Hong Kong Blockchain week in March 2019, Richard Ma reported that there was an estimated $334 million dollars worth of smart contract hacks to that date.

Since the DAO hack, the event has constantly been used as an argument against the usefulness of smart contracts; from bitcoin “maximalists” to blockchain skeptics. But no system is completely secure and flawless; not smart contracts, centralized applications, bitcoin, or the most robust cryptography. We just make trade-offs by altering different parameters while hopefully decreasing the magnitude of these trade-offs as technology evolves. It then stands to reason that we should capable of increasing the security of smart contracts while working to minimize the impact to decentralization. Enter Quantstamp.

The Problems

  1. Centralizing security
“Current efforts to validate smart contracts are inadequate. Engaging security consulting companies require human experts to audit smart contracts. This process is expensive and error-prone. Also, relying on a single company requires trusting that no bad actors exist in the company. A distributed system relying on consensus among many different actors is far more secure. — Quantstamp Whitepaper

If you are at all familiar with the public blockchain space, you should be aware that sacrificing decentralization for a different property, such as scaling, is almost always the trade-off we don’t want to make. Decentralization was the main property that enabled Bitcoin to become so special. When a smart contract is audited by just a couple of companies, non-techinical users (and technical users without time thoroughly vet a contract), have to put trust in those companies that the contract is safe.

I don’t believe there is a high probability the auditing companies that we have around today are malicious. But that doesn’t mean that there couldn’t be a small flaw one day that a manual auditor leaves out of a report and takes advantage of. Decentralization is a property we need to keep in as many aspects of blockchain and smart contracts as possible; remember it is their unique value proposition. What we need is some type of decentralized auditing solution to supplement the centralized manual audits. Something that an average Joe can quickly look up and say “This contract was audited by 82 nodes and none of them reported any problems”.

2. Too many contracts, too few auditors

Security audit processes that rely on human experts cannot keep up with the exploding growth rate of smart contract adoption. Between June 2017 and October 2017, the number of smart contracts grew from 500K to 2M . Within a year, we expect there to be 10M smart contracts. This will create an exponential increase in the demand for auditing. There aren’t enough security experts in the world to audit all smart contracts today, and this shortage will be even more acute in the future. — Quantstamp Whitepaper

Richard Ma has estimated that there are already around 12 million smart contracts in the world. This a fraction of the contracts that will exist if blockchain ever achieves mainstream adoption. Remember, all this growth has occurred and a “killer app” has yet to be created on a public blockchain. Most of the world’s biggest companies are not deploying anything to public mainnets and the blockchain is currently only used by niche users. Imagine if blockchain seriously gets adopted by the public and mainstream applications begin switching to existing as a decentralized smart contract (a decentralized application or “dapp”). Each smart contract would need some form of security verification to increase trust in them, and there’s no way humans can possibly keep up with this many applications via manual audits.

3. How do we guarantee contracts stay safe after deployment?

One significant design constraints of smart contracts on public blockchains is their immutable nature; once a smart contract is deployed to a blockchain, it’s there to stay and can’t be changed (barring functions in the code that allow certain parameters to change). This can pose security risks if the virtual machine on a blockchain is upgraded.

As an example, imagine a set of smart contracts that is audited by 30 different organizations before it is deployed. Perhaps the company/people who created the contracts release all the audits to the public so they can check themselves that the contracts are secure. On top of this, imagine both the auditing company and the smart contract creators have a great reputation and are trusted. The contract is then deployed to the Ethereum mainnet and is working great for everyone. Suddenly an update occurs to the EVM in the next hardfork. How do we assure everyone that the contract is still secure, and will work as intended? Blockchain’s will continue forking frequently as progress in the space continues at a breakneck pace, so this problem must be addressed.

The Protocols

Quantstamp has a multi-protocol approach to tackling the above problems. To repeat, there is not a way to ever 100% guarantee security in anything, but we can get darn close and strive to minimize the sacrifice to decentralization in the process. So without further ado, the Quantstamp protocols.

  1. Decentralized Automated Security Audit Protocol (Security Scanner)

Currently several different code scanners exist that can help smart contract developers make sure their contracts are secure, including Mythril Classic, Oyenete, Securify, Manticore, and more. For a more comprehensive review of analyzers, check out the following list from Consensys:

https://consensys.github.io/smart-contract-best-practices/security_tools/

However, these analyzers are cumbersome for developers to utilize and make it very difficult for non-technical users to check the security of smart contracts themselves. This is where the Quantstamp decentralized automated auditing protocol comes in.

The more decentralized auditing protocol will allow users to simply submit code, or a contract’s address, pay in QSP tokens (with price set by the audit nodes), and have a scan done by as many audit nodes as desired. The results of this scan can then be stored within the blockchain as bytecode for anyone to confirm, or kept private to the team. The key here is that the audit is completed in a decentralized manner, and the code can be submitted by anyone (given the code is open sourced to the public). The team is also working extensively on making the UI/UX intuitive and easy for anyone to use and interpret; the importance of this cannot be understated.

Early snapshot of the Quantstamp auditing protocol. Source: https://medium.com/quantstamp/quantstamp-community-update-february-28-2019-f88e95dfb566

I think an important result of this is that any regular user can use this protocol to easily check if a smart contract is secure as an initial check. As an example, Bob isn’t a super technical programmer, and is using a dapp for the first time. Maybe the dapp is from someone who set up a simple shop on the Ethereum blockchain, and the code is open sourced. Bob can then obtain that code, or submit its contract address, to see if the scan results in a lot of red flags. If so, it would be better to wait until the issues are addressed. If there aren’t a lot of red flags, Bob feels a little safer and has completed just one part of the whole due diligence process to make sure the contract is safe.

This protocol has been on Ethereum’s testnet since March of 2018 and been live on the Ethereum mainnet since August of 2018. Currently the team has announced that the protocol makes use of Mythril Classic, Oyente, and Securify analyzers as the “engines” of the automated audit, with room for plenty more to be added.

2. Security Assurance Protocol

**Update 04/16/2019: The team has released a short guide on the assurance protocol you may find useful. You can find it here.**

This protocol is the most interesting to me personally and it seems to have captured the interest of others versed in the space as well. The first time the team really discussed the protocol in detail can be found in this video.

This protocol helps assure (surprise) that a contract is safe after it has been deployed to a public blockchain’s mainnet. This is accomplished through security experts staking their QSP on the guarantee that a contract will be secure and behave as expected. If the contract were to not behave as expected (there was a bug or backdoor not previously found), the experts would forfeit their QSP to the contract stakeholders. As long as the contract behaves as expected, in return for monitoring the contract and risking their QSP, the security experts get paid in QSP. You probably noticed this is very similar to traditional insurance.

Assuming the system is comprised of mostly rational actors, an assumption backing almost all crypto-economics, this would lead to the amount of QSP staked changing dynamically as the security of the contract changes. So perhaps after an Ethereum hardfork, the amount of QSP staked on a particular contract has a sudden large drop. This would indicate to the users and creators of the contract that security experts see a flaw in the code caused by the hardfork, and to perhaps remove value from the contact until the flaw is addressed.

This protocol is still in alpha and on testnet and as such there are still many questions to be asked. How are the security experts chosen and rated? How do we determine whether the assured contract is acting as expected? The team is hard at work addressing these issues and has recently completed a closed alpha test of the protocol. In the meantime, this seems like a very promising solution to the problem of post-deployment security on a public blockchain.

3. Bug Bounty Protocol

Last but not least, we have the bug bounty protocol. This protocol has the least information released on it by the team. Perhaps this lack of information is due to the fact that it isn’t first bug bounty protocol on the block(chain). They have stated that it utilizes a token curated registry. We can assume it will work like other bug bounty protocols released except use QSP token for payment and staking. You can see BountyOne as an example. This is yet another great layer that can be used before and after deployment to take advantage of decentralized security.

QSP: Capturing the Value of the Protocols

So how does all of this value that the protocols create get captured by the token? As with almost all good and modern token design, staking and governance. Each protocol requires the users to use QSP as collateral to help assure good behavior. Trying to lie on an audit and not report that bug you found? Hope it was worth some of your own staked money.

Currently the rules of staking are still being worked out by the team. With the rollout of “Mainnet V2” of the auditing protocol, policing nodes are going to be used to punish misbehaving nodes. These policing nodes will most likely be pretty centralized at first and be used to help adjust the rules of staking within the protocol. It is very difficult to set the rules of a staking without first seeing how the economy works. However this is all just conjecture and we will need to wait until the fully decentralized release of the auditing protocol (hopefully in late April or early May of this year) to see the details. One important result of staking, is that the token can be valued using traditional discount cash flow analysis.

Having followed many projects very closely for years now, I have seen a variety of different staking rules being developed depending on the protocol. Let us use the Chainlink protocol, a decentralized oracle solution for the blockchain, as an example. In this protocol it is planned to aggregate all the answers the nodes provide (taking an average for example). Each node’s answer can then be compared to the average and other answers, and if it is more than say 2 standard deviations away from the mean, the node loses some money in their stake. Otherwise, every node gets a reward (this is just one example of a possible punishment in that protocol). Quantstamp may use a similar system where the audit results are compared between nodes and any nodes that deviate from the majority are punished.

Governance is another important aspect of good token design. How can the protocol truly be decentralized if the users of the protocol don’t have some say on the rules of said protocol? Listen to Vitalik Buterin discuss his analysis on the difficulty of implementing good on-chain governance. While this talk is in reference to base layer protocols, you can see it is a VERY difficult problem to tackle. However, I believe decentralized applications could require in protocol governance where the operators can set important parameters of the economy.

For example, the node operators may want to set up a minimum fee charged for an audit or vote on future improvements to the protocol. I have yet to see a protocol utilize truly decentralized governance on their protocol, but do see many projects reaching the point where it is becoming an active topic of work. My expectation is that a lot of research and implementations of protocol governance will start emerging within the next couple of years.

Staking and governance requires a native protocol token. If ETH or DAI were used, the QSP economy would also be tied to their economies. We wouldn’t want the auditing nodes to be affected by inflation of ETH or DAI or any other coin/token. Using stocks as an analogy, you trade dollars for a stock (essentially a centralized token monitored by the SEC). This stock gives you rights to voting on company matters and any excess cash flow the company generates. The stock has a predictable supply separated from the supply of other stocks. We wouldn’t use Tesla stock to claim cash flow or vote in Apple.

Hopefully by the end of this section I have effectively presented why QSP is both necessary and could accrue value to itself naturally via the value the protocols provide to society. All of these value propositions have been around since the whitepaper; clearly showing that the team really thought about having an essential token, not just a money raising device. With all this in mind, the QSP token has the potential to accrue a lot of value from its underlying protocols.

Business Strategy (making connections to help bring volume to the protocols)

The above topics show how the Quantstamp protocols plan to create value and how this value is accrued to the QSP token. This is perhaps the most important aspect of a valuable token, however a protocol is useless without users and operators. Let’s look at how the Quantstamp team has positioned themselves and the protocols to become the de-facto security standards in the blockchain world.

  1. Amazing team

We all know the old adage “Invest in people not products”. While this article isn’t investment advice, the phrase holds an important truth. It takes a qualified team to create something that can truly add value to society. Quantstamp isn’t shy about the caliber of their team, and rightfully so. Their team is filled with security PHD’s (with a huge amount of publications behind them combined) and software engineers/business team with impressive experience in the industry. You can see the team on their website:

2. Manual audits giving insight

Quantstamp has an interesting advantage as a blockchain company that almost no other company has: they manually audit a lot of the blockchain companies in the space. Doing this they can see the biggest and most common security flaws as well as which design patterns are effective and which are not.

They can then use this knowledge to improve their own protocols. Between auditing important infrastructure projects like Omisego’s plasma contracts, to other smart contract protocols such as Chainlink, what other blockchain company has such an extensive overview of the space to base their own protocols off of?

3. Blockchain agnostic

Quantstamp’s current beta-protocol runs on the Ethereum mainnet since it is the most prominent and developed upon smart contract platform to date. Don’t think Ethereum will continue to succeed, or be the only big player in the game? The Quantstamp team has repeatedly stated that they plan on being blockchain agnostic. In May 2018, they formed a strategic alliance with Wanchain. They have performed manual audits for other blockchain’s smart contracts such as Crypto.com, Quarkchain and Disciplina. They are in a good spot to create protocols on a new platform if needed.

4. Investments from big names

Quantstamp is a Y-Combinator started and backed company and have recent investments from big names such as Nomura Holdings Digital Garage, and KSK Angel (famous football/soccer player Keiske Honda’s fund). They graduated from Fujitsu’s accelerator program as well as Plug and Play Japan where they won Plug and Play Startup Award. Most recently the team won first place at the Smart Dubai Blockchain Competition. Clearly big investors around the world see a lot of value in the products Quantstamp is building.

5. Contributions to the greater community

Quantstamp is a member of the Ethereum Community Fund, and are always hosting events at Universities such as Tokyo University, Temple University, KAIST in Korea and UC San-Diego. They have formed the Smart Contracts Security Alliance to bring standards to smart contract security. They are continually participating in Ethereum/Blockchain events; whether it be by auditing BuffiDai for EthDenver, sponsoring Unchained Live in March 2019, or speaking on a panel at Deloitte. Quantstamp is always helping educate and spread the word on the power of blockchain technology.

6. Closely working with government

In a time where the SEC is beginning to strongly come down on ICO’s, the government is a force you certainly don’t want against you. Quantstamp is part of the Chamber of Digital Commerce’s Executive Committee along with companies such as Cisco, Microsoft and MakerDAO. Taken from the Chamber’s website:

Our mission is to promote the acceptance and use of digital assets and blockchain-based technologies. Through education, advocacy and working closely with policymakers, regulatory agencies and industry, our goal is to develop an environment that fosters innovation, jobs and investment.

Their VP of Strategy, Olga V. Mack, has also helped California governor Jerry Brown sign two blockchain bills into law back in September 28th. With all of this, Quantstamp seems to have a great relationship working with the government.

7. Professionalism and avoiding hype

In line with the above point, hyping up a project can be seen as red flag to the SEC, and it makes the project seem scammy. One thing I have loved about Quantstamp is that they have been relatively quiet, focusing on building their product and industry relationships rather than hyping the token. They do not allow token price talk on their slack channel so it is only talk about the protocol or business. They want the protocol to do the talking, a sentiment I respect, and a far cry from some of the other projects that started in 2017.

8. Partnerships, partnerships

The National University of Singapore (NUS), MIT, Ethereum Community Fund and Mythril all listed as research partners on Quantstamp’s website. Members of the smart contract security alliance include: Modular, NUS, NRI Secure, Modular, LayerX, Blockgeeks, and Fujitsu. I won’t include audits as patnerships, but it is probably smart to venture that they have developed healthy working relationships with their customers, because we have only heard good reviews of their audits.

Criticisms

I cannot write a piece on Quantstamp without addressing some of the criticism the team has received, and my thoughts about them. There are three major criticisms I will address.

  1. Accepting payments for manual audits that aren’t QSP

Earlier in this post, I described the value of manual audits. As for accepting payment that isn’t QSP, I believe this was a smart move. The purpose of the token is: to decentralize their protocols via staking, governance, and for use as payment on the protocols. The purpose is not for paying for manual audits or any services not directly related to the protocols. Not every company is going to want to go to an exchange and buy QSP to pay for an audit. So why pass up on a manual audit (a revenue stream for the team, as well as a learning experience for the protocol) just because they are picky on the payment they accept?

2. Proof of Caring was a failure

I can see where the teams heart was with this one, but it did not end up working as intended. The goal was to reward community members who helped develop and market Quantstamp. You could submit ways you promoted QSP to a “proof of caring” portal, where the team would give you proof of caring points. The team would then airdrop some of the tokens they obtained from manual audits to people based on their proof of caring score.

The idea came from the right place: reward early token holders for marketing your product (which typically the community does for free in crypto) and reward them with some form of income from manual audits until the protocols are fully released. The main problem was this was a huge compliance risk; airdrops could be considered a breach of security laws. It also came off as scammy (kind of like a MLM scheme) and created a lot of fake project supporters just trying get airdropped tokens.

They stopped the program after only being out only for short while, explaining their reasoning (compliance), but people still bring it up from time to time. The team admitted it was a mistake, and has since moved on as they should. This really didn’t harm anyone and as such I do not consider it to be a big issue.

3. Oyster Perl Scan (NOT AN AUDIT)

*EDIT: In my original post I stated the web-tool utilized Mythril Classic. This was a mistake; the web-tool utilized Oyente*

In my opinion, this is unjustified FUD and in no way the fault of the team or indicative of future performance of the auditing protocol. Essentially the team behind the Oyster Perl contracts performed a scan of their contract using the now defunct Quantstamp web-tool. All the results from this web-tool used to be available on the Quantstamp website, but were taken down after the web-tool was replaced with the beta protocol on the Ethereum mainnet. The scan came up clean, but a team member had left a back door in the contract which allowed said team member to mint himself tokens and market sell them for profit. I urge you to look up the whole debacle, I have posted one article below, as it is a clear case of why smart contract security needs improvement.

However this was not the fault of the web-tool scanner or the team (since they did not do a full manual audit). The web tool was simply a minimum viable product the team used to demonstrate the basics of what the auditing protocol would be like. It was an easy to use implementation of Oyente and wasn’t designed to find back door issues such as that. You can find information on Oyente here:

These back-doors in smart contracts are something I foresee the assurance protocol helping to prevent rather than the automated auditing protocol since it is a human design vulnerability, rather than a programming/mathematical error such as a stack overflow.

These were the biggest criticisms I've seen against the team/project and my analysis of them. If it appears I’m defending the team too much, it’s because I've really pondered these criticisms; and if I had found them to be a big problem, I would have stopped following the project as heavily. I am always open to and welcome discussions and further criticisms of any project I follow. Critical feedback is healthy.

Conclusion

Security is more important than ever with blockchain; there is currently no fall back if a smart contract fails. This is no promise the team will succeed (remember 90% of startups fail); but with the three value adding protocols, a necessary token to absorb the value of those protocols, a great business plan, and a stellar team leading the development, I feel Quantstamp truly has a solid chance at becoming the gold standard for smart contract security.

Resources

https://quantstamp.com/

https://www.youtube.com/channel/UCXP3YLX4JdI0gGb9UKSunMg

https://medium.com/quantstamp/securing-smart-contracts-on-the-blockchain-a-technical-overview-of-the-quantstamp-betanet-protocol-f13dab2daa51

https://crushcrypto.com/wp-content/uploads/2017/10/QSP-Whitepaper.pdf