2017 has been the year during which Initial Coin Offerings (the process of crowdfunding via crypto-currencies) have skyrocketed.
In this presentation, I attempt to demystify what an ICO is, why there are an interesting use cases of the Blockchain technology, from an economic and technical perspective.
After a bit of theory, I take a deep dive into the various technical building blocks involved, first with a quick overview of the development environment (Truffle, OpenZeppelin, Parity), then going through the process of creating a simple token sale, with an ERC20 utility token and accompanying smart contracts and tests.
Be prepared to enter a brave new world ... where 'learn something new everyday' takes on its full meaning.
2. MISSION-CRITICAL APPS, BOTS & SMART CONTRACTS
DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
We build end-to-end digital solutions
to boost your business’ operations.
Steve Degosserie, CEO mi8 SPRL
▸ 18 years in Software industry
(McKinsey Solutions, Zetes, Fluxys)
▸ MSc in Digital Currency &
Blockchain technology,
University of Nicosia (Cyprus)
▸ Currently working on a token sale
for the Stampify project
Clients we serve
3. The world has a fundamental problem with corporate governance
Almost everywhere in the world, the fundamental principles of corporate
governance — the way business organizations are created, run and liquidated —
are a remainder of a pre-technology era, deeply misaligned with today’s world.
4. INTRODUCING STAMPIFY
Stampify paves the way to the business of tomorrow, by providing
entrepreneurs, startups and companies with new-generation corporate
governance tools. Stampify's mission is to build a frictionless business
world where connected organisations work together with transparency,
flexibility and trust. To do that, Stampify takes the most out of advanced
technology, including distributed ledgers.
6. DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
AGENDA
▸ Bitcoin, mother of Blockchains
▸ Ethereum & Smart Contracts
▸ Decentralised Apps : towards Web 3.0
▸ Crypto-economics & Mechanism Design
▸ Cryptocurrencies, Utility Tokens & the ERC20 standard
▸ ICOs : the Good, the Bad and the Ugly
▸ Token dev toolbelt : Truffle, OpenZeppelin & Parity
▸ Let’s mint together : DEVDAY token
7. BITCOIN, MOTHER OF BLOCKCHAINS
Bitcoin is a private, decentralized,
digital cryptocurrency
▸ Private: not issued by a sovereignty
▸ Decentralized: no issuing party;
units are issued algorithmically
▸ Digital: Fully electronic; with no
underlying peg to assets
▸ Cryptocurrency: Anti-
counterfeiting though
cryptography
DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
8. BITCOIN, MOTHER OF BLOCKCHAINS
DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
▸ October 2008: Satoshi Nakamoto’s
Bitcoin design paper
▸ January 2009: Genesis block;
Bitcoin becomes operational
▸ October 2009: $1 = 1,300 BTC
▸ February 2011: $1 = 1 BTC
▸ April 2013: 1 BTC = $100
▸ December 2013: 1 BTC = $1000
▸ October 2017: 1 BTC = ~$6000
▸ November 2017 : 1 BTC = ~$10000
9. WHAT IS A “BLOCKCHAIN” ?
DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
Under the hood of Bitcoin, is the
Blockchain, or Distributed Ledger
Technology (DLT)
“An incorruptible digital ledger of
economic transactions that can be
programmed to record not just
financial transactions but virtually
everything of value.”
Source: CapGemini, Blockchain: Opportunities and Challenges across Multiple Industries [https://www.capgemini.com/resources/blockchain-opportunities-and-challenges-across-multiple-industries/]
10. DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
WHAT IS A “BLOCKCHAIN” ?
blockchain technology
A look at
The blockchain is a decentralized ledger of all transactions across a peer-to-peer network. Using this
technology, participants can confirm transactions without the need for a central certifying authority.
Potential applications include fund transfers, settling trades, voting, and many other uses.
Someone requests
a transaction.
The transaction
is complete.
A verified transaction
can involve
cryptocurrency,
contracts, records,
or other information.
The new block is then added to the
existing blockchain, in a way that is
permanent and unalterable.
The requested
transaction is
broadcast to a P2P
network consisting
of computers,
known as nodes.
What is it?
How it works:
Increased Complex
The network of nodes
validates the transaction
and the user's status
using known algorithms.
Validation
Once verified, the
transaction is
combined with
other transactions
to create a new
block of data for
the ledger.
Source: PwC, Making sense of Bitcoin, Cryptocurrency, and Blockchain [https://www.pwc.com/us/en/financial-services/fintech/bitcoin-blockchain-cryptocurrency.html]
11. DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
ETHEREUM & SMART CONTRACTS
Ethereum is a decentralized applications platform whereas
Bitcoin is (mostly) a decentralized payment system.
▸ Bitcoin: BiTCoin cryptocurrency, store of value,
deflationary, simple scripting language , small / slow
blocks, PoW consensus, conservative evolution.
▸ Ethereum: ETHer in-app currency, eternal inflation, EVM
runtime environment, Turing-complete programming
language, dynamic block sizes, PoW but upcoming PoS
consensus, substantial innovations in the pipeline.
12. ETHEREUM & SMART CONTRACTS
DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
Source: Diagram by codebrahma.com
“A Smart Contract is the automated
execution of an agreement.” (code)
Smart Contracts are tiny pieces of
software code that execute
autonomously on the Blockchain.
Contracts are made between humans.
Smart Contracts are running
agreements between
humans, apps & devices.
13. DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
DECENTRALISED APPS : TOWARDS WEB 3.0
▸ Web 1.0 : Static pages, client-server, e-commerce
▸ Web 2.0 : Social web, clouds (third-party servers)
▸ Web 3.0 : Peer-to-peer web, serverless, “Post-Snowden”
Ethereum’s protocols for Web 3.0: ETH + BZZ + SHH + P2P
‣ ETH : blockchain activities (tx, blocks, code)
‣ BZZ (Swarm) : decentralized (incentivized) storage
‣ SHH (Whisper) : inter-node secure & private messaging
‣ P2P : networking layer interconnecting nodes
14. DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
CRYPTO-ECONOMICS & MECHANISM DESIGN
Game theory is the study of how and why people make
decisions. Or more specifically, the study of mathematical
models of conflict and cooperation (= games) between
intelligent rational decision-makers.
It has a wide array of applications in economics, politics,
political science and sociology, as well as logic, computer
science and biology.
Importance of game theory in economics: 11 “game-
theorists” have now won the Economics Nobel Prize.
Source: Cryptoeconomics In Context - https://hackernoon.com/cryptoeconomics-in-context-6435ad6839be; Vitalik Buterin, The Cryptoeconomics Way - https://www.youtube.com/watch?v=lYGOMGqz9zE
15. DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
CRYPTO-ECONOMICS & MECHANISM DESIGN
Mechanism Design is also known as reverse game theory.
It’s a field in economics and game theory that takes an
engineering approach to designing economic mechanisms
or incentives, toward desired objectives, in strategic
settings, where players act rationally.
The game designer:
‣ chooses the game structure rather than inheriting one
‣ is interested in the game's outcome
Source: Cryptoeconomics In Context - https://hackernoon.com/cryptoeconomics-in-context-6435ad6839be; Vitalik Buterin, The Cryptoeconomics Way - https://www.youtube.com/watch?v=lYGOMGqz9zE
16. DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
CRYPTO-ECONOMICS & MECHANISM DESIGN
What makes Bitcoin (and other blockchains) special is not a
specific technology, it’s the concept of Cryptoeconomics,
that is, using Cryptography AND Economic Incentives to
achieve information security goals.
▸ Cryptography can prove properties about messages that
happened in the past
▸ Economic incentives defined inside a system can
encourage desired properties to hold into the future.
Source: Cryptoeconomics In Context - https://hackernoon.com/cryptoeconomics-in-context-6435ad6839be; Vitalik Buterin, The Cryptoeconomics Way - https://www.youtube.com/watch?v=lYGOMGqz9zE
17. DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
CRYPTO-ECONOMICS & MECHANISM DESIGN
When building a system, using Cryptography and Mechanism
Design, a Blockchain Developer must carefully:
‣ Apply crypto wherever needed to ensure the basic building
blocks of the system will be trustworthy (digital signatures), and
tamper-resistant (hashes, encryption).
‣ Decide what are the desired properties of the system (=
outcomes) that will hold true in the future
‣ Design the right economic incentives / disincentives so that the
desired properties will effectively hold true well into the future.
Source: Cryptoeconomics In Context - https://hackernoon.com/cryptoeconomics-in-context-6435ad6839be; Vitalik Buterin, The Cryptoeconomics Way - https://www.youtube.com/watch?v=lYGOMGqz9zE
18. USE ECONOMIC INCENTIVES TO REWARD
PARTICIPANTS WHO FURTHER THE SYSTEM’S
OBJECTIVES, AND PENALIZE THOSE WHO
HARM IT.
V. Buterin, Ethereum co-founder
DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
19. DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
CRYPTO-ECONOMICS & MECHANISM DESIGN
So, whether building a Blockchain platform, or an app on top of
an existing Blockchain, it is important to carefully design the
economic incentives for the various actors of the system:
‣ Miners
‣ Resource Providers (compute / storage / etc)
‣ Investors
‣ Community (developers)
‣ End-users (or the service / product)
Source: Cryptoeconomics In Context - https://hackernoon.com/cryptoeconomics-in-context-6435ad6839be; Vitalik Buterin, The Cryptoeconomics Way - https://www.youtube.com/watch?v=lYGOMGqz9zE
20. DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
ICOS : THE GOOD, THE BAD AND THE UGLY
What’s an Initial Coin Offering (ICO) ?
‣ Process of openly raising funds (crowdfunding sale),
typically via cryptocurrencies, by issuing a Utility Token at a
certain price, with the promise to investors that raised
funds will be used for developing a product or service,
whose business model, and related business / technology
information, is described within a document shared
publicly (= whitepaper).
‣ It’s like an IPO, but with Digital Coins …
21. DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
ICOS : THE GOOD
▸ Simpler & faster way of raising money (compared to tradition
Initial Public Offerings process, w/ heavy due diligence process,
costly third parties involved, or Venture Capitalist rounds)
▸ Global scale -> “The world is a village”
▸ Fully transparent: whitepaper, team composition, code for
contracts of Token & Sale are usually published in advance
▸ Purely algorithmic, relatively simple to setup (in days / weeks max)
▸ Gnosis: $12M in 10 min; Brave $35M in 30 sec; Filecoin $200M in
60 min (totally $257M)
22. DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
ICOS : THE BAD
▸ Risky capital with no guarantee of ROI
▸ Future Promise: investor must assess business model potential, team
experience & ability to deliver, technology readiness, market size
▸ So many ICOs: “good” projects have trouble getting exposure
▸ Few regulations, or vary from country to country, ranging from permissive, to
gray-zone, to entirely forbidden / banned
▸ Token sometimes assimilated to securities, assets —> Taxes, VAT
▸ Complex whitelisting procedures required: KYC=Know Your Customer,
AML=Anti-Money Laundering, CTF=Counter Terrorist Financing,
PEP=Politically Exposed Persons
23. DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
ICOS : THE UGLY
▸ Still complex from a technical perspective for a non tech-savvy person (actually,
even for tech person !)
▸ Loss of millions of USD due to security vulnerabilities in Smart Contracts: tricky
aspects of the Solidity language, insecure third-party libraries / contracts, hacks
▸ Any tricks to get exposure in medias / social networks is used
▸ Very lucrative : social network influencers monetizing access to their
followers
▸ 1 tweet or post can be worth several Bitcoins !
▸ Nothing really prevents the team behind the project to disappear with the
funds raised …
24. ICO : GET RICH OR DIE TRYIN'
50 Cent (~= 0.00005 BTC = 5000 Satoshi)
DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
25. DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
CRYPTOCURRENCIES, UTILITY TOKENS & THE ERC20 STANDARD
▸ Cryptocurrency: digital currencies minted (or mined)
using encryption protocols that securely regulate unit
production and monitor exchanges/transfer of funds.
▸ Utility Token: Utility tokens (or user tokens / app coins),
represent future access to a company’s product or service.
If not designed as investments and properly structured,
they are exempt from federal laws governing securities.
▸ /! Carefully design your token so it’s not considered as a
tokenized security, subject to SEC regulations (Howey Test)
26. DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
TOKEN DEV TOOLBELT : TRUFFLE
The “Ethereum Swiss Army Knife”
▸ Built-in Smart Contract compilation, linking, deployment and binary
management
▸ Automated Contract testing for rapid development
▸ Scriptable deployment & migrations framework
▸ Network management for deploying to both public & private networks
▸ GitHub: https://github.com/trufflesuite/truffle
▸ NPM: truffle
27. Demo: bootstrap a Truffle project
We’ll start from the metacoin box
‣ npm -g install truffle
‣ truffle unbox metacoin
‣ truffle compile
DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
TOKEN DEV TOOLBELT : TRUFFLE
28. DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
TOKEN DEV TOOLBELT : TRUFFLE
buildcontracts: compilation artifacts
contracts: Solidity contracts
migrations: Deployment scripts
test: Tests written in JS/ or Solidity
truffle.js: Truffle’s config file
29. truffle test
‣ compiles contracts
‣ deploys to built-in
TestRPC
‣ executes tests in an
isolated manner
DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
TOKEN DEV TOOLBELT : TRUFFLE
30. truffle develop : integrated dev console
DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
TOKEN DEV TOOLBELT : TRUFFLE
32. Interact with your deployed contract …
DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
TOKEN DEV TOOLBELT : TRUFFLE
33. DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
TOKEN DEV TOOLBELT : OPENZEPPELIN
Open Framework of reusable and secure smart contracts.
▸ Focused on security, modular approach, open source.
▸ Reduce the risk of vulnerabilities in your applications by
using standard, tested & community-reviewed code.
▸ GitHub: https://github.com/OpenZeppelin/zeppelin-
solidity
▸ NPM: zeppelin-solidity
34. DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
TOKEN DEV TOOLBELT : OPENZEPPELIN
Demo: create a simple ERC20 token
‣ Create new smart contract that inherits from BasicToken
‣ Define name, symbol, decimals & initial supply
‣ Write more advanced tests
‣ Deploy token using Truffle deploy
‣ Interact with token using Truffle develop
36. Test suite
DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
TOKEN DEV TOOLBELT : OPENZEPPELIN
37. DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
TOKEN DEV TOOLBELT : PARITY
Full-node client by Parity Technologies
▸ Fast & secure, cross-platform, reliable
▸ Written in Rust programming language
▸ Built-in web-based Wallet & Dapp environment
▸ Register & interact with your smart contracts
▸ Can also be used for private or consortium deployments
(PoA consensus)
38. DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
TOKEN DEV TOOLBELT : PARITY
Demo: deploy simple ERC20 token to Parity node
‣ Deploy token using Truffle deploy
‣ Interact with token using with Parity web UI
39. DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
LET’S MINT TOGETHER : DEVDAY TOKEN
Designing a real-world ERC20 token & crowdsale involves
making a lot of business & technical design decisions:
‣ Token: total supply, symbol, decimals but also, issuance
model, burning or not, retained qty for founders / business
ops, vesting schemes, pegging to fiat currency, dual tokens
‣ Crowdsale: start / end time, sale periods, goal, cap,
emergency stop, allow refund if goal not reached,
gamification (bug bounties, deals), fiat / crypto supported
for payments, …
40. DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
LET’S MINT TOGETHER : DEVDAY TOKEN
Open Zeppelin contains base contracts for tokens:
▸ StandardToken: full-featured ERC20-compliant token
▸ MintableToken: token can be minted (e.g. when purchased)
▸ BurnableToken: burn function (decrease total supply)
▸ PausableToken: pause token transfers (e.g. during sale)
▸ TokenTimelock: lock tokens during a period of time
(vesting)
41. DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
LET’S MINT TOGETHER : DEVDAY TOKEN
Open Zeppelin contains base contracts for crowdsales:
▸ Crowdsale: fixed-duration & rate, wallet for raised Ether
▸ CappedCrowdsale: max amount of tokens for sale (cap),
sale can end prematurely if cap is reached before end time
▸ RefundableCrowdsale: minmim amount of tokens to be
sold (goal), investors are refunded if goal not reached
▸ FinalizableCrowdsale: custom finalization logic at the end
of the sale (e.g. burn unsold tokens, mint a reserve qty, etc)
42. DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
LET’S MINT TOGETHER : DEVDAY TOKEN
Demo: create a DevDayToken contract
‣ Tokens should be ‘minted’ when an investor buys tokens
‣ name: DevDay Token
‣ symbol: DEVDAY
‣ decimals: 18 (same as ETH)
‣ initial supply: 0 (token minted when purchased)
43. DEVDAY17 - TECHNICAL PERSPECTIVES OF AN ICO
LET’S MINT TOGETHER : DEVDAY TOKEN
Demo: create a DevDay Token sale contract
‣ Creates and owns Token contract
‣ Cap: 10 ETH, Rate: 500