Alexander Kurz
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- # https://hackmd.io/s/how-to-create-slide-deck title: Smart Contracts (Slides) # type: slide # does not work as expected slideOptions: theme: white # league #https://revealjs.com/themes/ transition: fade # none/fade/slide/convex/concave/zoom transitionSpeed: slow # default/fast/slow spotlight: enabled: false allottedMinutes: 2 # Minutes alloted for a slide. controls: false --- ## Smart Contracts <br> ###### [Orange County ACM Chapter](https://www.meetup.com/acm-oc/events/287648578/), Sep 21, 2022 <br> ###### Alexander Kurz ###### Chapman University <br> <center><font size="+0">view online at </font></font><font size="+1" color=blue>http://tiny.cc/qibzuz</font></center> <center><font size="+0" color=grey>(layout optimized for Brave browser)</font></center> --- <style type="text/css"> .reveal p { text-align: left; } .reveal ul { display: block; } .reveal ol { display: block; } .reveal { font-size: 36px; } </style> ## Overview <br> ***Why*** are smart contracts interesting? ***How*** to write and use smart contracts? ***What*** is a smart contract? ***Where*** do we go with this technology? Note: My background is in applications of logic and category theory to software engineering. This has some relevance on question 2. But what actually interest me most is question 4. --- ## ***Why*** are Smart Contracts Interesting? --- *New Technologies:* &nbsp;&nbsp;&nbsp;&nbsp; Cryptocurruencies &nbsp;&nbsp;&nbsp;&nbsp; Smart Contracts <br> *Media Attention:* &nbsp;&nbsp;&nbsp;&nbsp; New Applications &nbsp;&nbsp;&nbsp;&nbsp; Scams, Heists, Fraud and Crime &nbsp;&nbsp;&nbsp;&nbsp; SciFi Becoming Real Note: There are many new and exciting technologies that do not get much media attention (precision fermentation, graphene, radiative cooling, ...). But "Crypto" is different and for the remainder of the intro I want to explore a little why. First, of course, the range of potentially disruptive new application. (But other technology has this to.) Second, even if you are in only for entertainment, there are some real gems waiting for you, in particular in the area of true crime. Third, scifi ... (Btw, the attention media pays to "crypto" is only rivalled by AI/machine learning and we can see the similarities. Note that while media always like scare stories, they are interestingly different (AI: Robots taking over, Crypto: True Crime)) --- ### New Technologies <br> Cryptocurrencies: [prehistory](https://www.youtube.com/watch?v=wokvO1ptE1k), [Bitcoin](https://nakamotoinstitute.org), [2011](https://www.gwern.net/Bitcoin-is-Worse-is-Better), [academic](https://dl.acm.org/doi/pdf/10.1145/3132259?download=true), [critical](https://blog.dshr.org/2022/02/ee380-talk.html), [satire](https://vitalik.ca/general/2022/04/01/maximalist.html) ... [Silk Road](http://www.americankingpin.com/) ... <br> Smart contracts: [Szabo](https://firstmonday.org/ojs/index.php/fm/article/view/548/469), [Ethereum](https://ethereum.org/en/whitepaper/), [Ethereum Virtual Machine (EVM)](https://github.com/ethereum/yellowpaper) ... [law as code](https://lessig.org/product/code/) ... Note: the history of bitcoin is more interesting than the history of ethereum but the technology of smart contracts is more interesting than the technology of cryptocurrencies ... but Lessig's book is a very interesting history of the early internet as well as of the interplay between law and code --- #### Media Attention <br> I link below examples from the media. How to separate the hype from the serious? We can come back to this after the *How* and the *What*. --- #### New Applications <br> [Distributed Autonomous Organisations (DAOs)](https://www.forbes.com/sites/laurashin/2022/02/22/exclusive-austrian-programmer-and-ex-crypto-ceo-likely-stole-11-billion-of-ether/?sh=4983aca7f589) ... [NFTs](https://www.youtube.com/watch?v=YQ_xWvX1n9g) ... [Metaverse](https://www.nytimes.com/2021/07/10/style/metaverse-virtual-worlds.html) ... [Facebook is Meta](https://www.nytimes.com/2021/10/29/technology/meta-facebook-zuckerberg.html) ... [Computer Games](https://medium.com/@jradoff) ... [Web3](https://www.nytimes.com/2021/12/05/business/dealbook/what-is-web3.html) ... [Fintech](https://www.nytimes.com/2022/01/20/nyregion/eric-adams-bitcoin-cryptocurrency.html) ... [DeFi](https://www.coinbase.com/learn/crypto-basics/what-is-defi) ... [Transparent Supply Chains](https://www.forbes.com/sites/leannekemp/2022/02/27/how-smart-contracts-trigger-swift-action-to-take-russian-goods-off-the-market/) ... <br> --- #### Scams, Heists, Fraud and Crime [Beanstalk cryptocurrency robbed after hacker votes to send themself $182 million](https://www.theverge.com/2022/4/18/23030754/beanstalk-cryptocurrency-hack-182-million-dao-voting), 2022. Exploiting flashloans. [Poly Network Hack Analysis](https://mudit.blog/poly-network-largest-crypto-hack/), 2021. Exploiting bridges. [Escaping the Dark Forest](https://samczsun.com/escaping-the-dark-forest/) ... [Ethereum is a Dark Forest](https://www.paradigm.xyz/2020/08/ethereum-is-a-dark-forest), 2020. Can involuntary transactions be rescued? More at the [Molly White List](https://web3isgoinggreat.com/?theme=hack) <br> [Sex, Drugs, and Bitcoin: How Much Illegal Activity is Financed through Cryptocurrencies?](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3102645) "around $76 billion of illegal activity per year involves bitcoin (46% of bitcoin transactions)" --- #### SciFi Becoming Real <br> <font color=grey> I planned this slide, but then realized that I know too little about the history of either crypto or scifi. There is an interesting story hidden. A starting point would be the [mailing list of the Cypherpunk movement](https://mailing-list-archive.cryptoanarchy.wiki/) of the 90s (which named itself with reference to cyberpunk scifi). </font> Note: Similary to Ai, crypto and scifi share a history. But even more than with AI, one gets a sense that scifi was a driving force. We all remember the optimism generated by the early internet in the 1990s (free and open knowledge, democratization of society, etc). --- ## ***How*** to write and use smart contracts? --- Example: Players guess a number and bet. Winner gets all. <br> ```solidity contract PayAndGuess { address payable[] public betters; //list of players mapping(address => uint) public bets; //bet of player mapping(address => uint) public guesses; //guess of player function bet(uint guess) public payable { betters.push(payable(msg.sender)); //add new player bets[msg.sender] = msg.value; //record their bet guesses[msg.sender] = guess; //record their guess } function disburse() public { address payable winner; uint winAmount; ... //calculate winner winner.transfer(winAmount); //pay winner } } ``` <br> [The full contract on Etherscan](https://ropsten.etherscan.io/address/0xd0a09debec0ff0a0d259402a819c48a7e8d19acc#code) (credit: Christopher Chang). --- **Example Scenario:** Crowdfunding Software Development <br> Developers set rules of funding scheme in a smart contract. If enough funds come in, project starts. Pays a salary to the developers. Funders get to vote on rising salaries or ending the project. <br> Source: [vbuterin - Explanation of DAICOs](https://ethresear.ch/t/explanation-of-daicos/465) --- ## ***What*** is a smart contract? --- A smart contract is ... &nbsp;&nbsp;&nbsp;&nbsp; a program on a "distributed computer" such as the EVM ... &nbsp;&nbsp;&nbsp;&nbsp; "running on" distributed consensus. <br> What is distributed consensus? --- #### Distributed Consensus <br> Remark on Terminology: &nbsp;&nbsp;&nbsp;&nbsp; distributed vs decentralized (?) &nbsp;&nbsp;&nbsp;&nbsp; fail-stop vs Byzantine fault tolerance Note: terminology varies, examples: distributed includes client server decentralized restricts to P2P sometimes: decentralized = fully distributed --- #### Distributed Consensus (cont'd) <br> I will explain proof-of-work-consensus with the help of the following picture: ![](https://hackmd.io/_uploads/HJHzXGuZj.png) (image credit [Satoshi Nakamoto Institute](https://nakamotoinstitute.org)) --- ## ***Where*** to go? --- What can be decentralized? *Example:* social media. What service do centralized platforms perform? Are decentralized social media more democratic? <br> [Mastodon](https://en.wikipedia.org/wiki/Mastodon_(software)) [[1]](https://www.youtube.com/watch?v=IPSbNdBmWKE&t=1s) [[2]](https://www.youtube.com/watch?v=yZoASOyfvGQ), [Center for Humane Technology](https://www.humanetech.com/technologists), [Buterin on Decentralization](https://www.google.com/search?q=https%3A%2F%2Fvitalik.ca%2F+%22decentralization%22), ... --- Reliable and maintainable smart contracts? Smart contracts and democracy? How to account for renegotiation of contracts? Robustness? Bankruptcy? Governance? <br> [Metagov](https://metagov.org/), [Bell on Digital Autonomous Authoritarians](https://www.elgaronline.com/view/edcoll/9781839100789/9781839100789.00011.xml), [Buterin on Governance](https://www.google.com/search?q=https%3A%2F%2Fvitalik.ca%2F+%22governance%22), ... --- Is P2P software inherently open source? How to finance and maintain open source software? How to finance public goods? <br> [Tabarrok](https://mason.gmu.edu/~atabarro/PrivateProvision.pdf) [[1]](https://foresight.org/summary/dominant-assurance-contracts-alex-tabarrok-george-mason-university/) [[2]](https://programtheblockchain.com/posts/2018/05/01/writing-a-dominant-assurance-contract/), [Buterin on Public Goods](https://www.google.com/search?q=https%3A%2F%2Fvitalik.ca%2F+%22public+goods%22&) --- How to make off-chain events available on-chain? How to build and quantify reputation and trust? Principles of distributed organizations? Which laws should govern the web3? Cryptocurrencies and money laundering? Anonymity and data privacy vs openness and trust? Smart contracts and constraints vs incentives? --- ## References --- #### Smart Contracts <br> [Search the book](https://www.google.com/search?q=site%3Ahttps%3A%2F%2Fcypherpunks-core.github.io%2Fethereumbook%2F+%22smart+contract%22&sxsrf=ALiCzsae8SMs5nL3MeBKzPJxwLl-XDy6xA%3A1663772802254&ei=gigrY8yWD-vekPIPvoWUqAE&ved=0ahUKEwjM3_XWlKb6AhVrL0QIHb4CBRUQ4dUDCA4&uact=5&oq=site%3Ahttps%3A%2F%2Fcypherpunks-core.github.io%2Fethereumbook%2F+%22smart+contract%22&gs_lcp=Cgdnd3Mtd2l6EANKBAhBGAFKBAhGGABQyhFYsCRguitoAnAAeACAAdYBiAGdCpIBBjEzLjAuMZgBAKABAcABAQ&sclient=gws-wiz) *Mastering Ethereum*. --- #### Authorities vs the Public, Hierarchies vs Networks <br> Martin Gurri. The Revolt of The Public and the Crisis of Authority in the New Millennium (2014/2018) Wael Ghonim. The Revolution 2.0: The Power of the People Is Greater Than the People in Power (2012) --- #### Psychology and Evolution of Human Cooperation <br> Joseph Henrich. The WEIRDest People in the World (2020) Bart Wilson. The Property Species (2020) Michael Tomasello. Becoming Human (2019) Mercier and Sperber. The Enigma of Reason (2019) Richard Wrangham. The Goodness Paradox (2019) Kim Sterelny. The Evolved Apprentice (2012) Jonathan Haidt. The Righteous Mind (2012) --- ## Acknowledgements <br> *Students:* Luke Burns, Christopher Chang, Kevin Jeon, Ronan Kearns, Tyler Lewis, Sri Pranav, Subhash Prasad, Jun Yoon <br> *Colleagues:* Andrea Bracciali, Mohammad Hammoudeh, Gabriele Camera, David Rojo Arjona, Tom Bell, Seth Benzell --- ## Concluding Quote <br> "In the end, computers plus networks plus people add up to something significantly greater than the parts. The ensemble eventually grows beyond human creativity. To become what? We can't know until we get there." <br> Vernor Vinge, [The creativity machine](https://rdcu.be/cV2YK), 2006. <!-- ## Random Links ![](https://hackmd.io/_uploads/Hy14gILbi.png) (image from [Proof of Work based blockchain consensus](https://medium.com/@drstone/an-overview-of-proof-of-work-based-blockchain-consensus-protocols-part-1-e04102885093)) -->

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully