Upgrade to Pro — share decks privately, control downloads, hide ads and more …

FinTech Lecture 9 : Blockchain and Smart Contracts

Kenji Saito
December 02, 2022

FinTech Lecture 9 : Blockchain and Smart Contracts

Slides I used for FinTech - Financial Innovation and the Internet 2022 Fall at Graduate School of Business and Finance, Waseda University on December 2, 2022.

Kenji Saito

December 02, 2022
Tweet

More Decks by Kenji Saito

Other Decks in Technology

Transcript

  1. Sending money — generated by Stable Diffusion. FinTech — Financial

    Innovation and the Internet 2022 Fall Lecture 9 : Blockchain and Smart Contracts Kenji Saito, Graduate School of Business and Finance, Waseda University Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.1/55
  2. This class is recorded 7 out of 15 lectures will

    be online only. When online, Camera ON is recommended, but not required You do need to speak often anyway (we are going to have a lot of dialogue) We will use breakout rooms a lot, but those won’t be recorded unless you do it yourselves (need to be allowed) Keep your Zoom client updated! We might use latest features The recordings could be used for research on (online) learning Transcribed for use and anonymized Will let you know when the necessity arises Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.2/55
  3. The lecture slides can be found at : https://speakerdeck.com/ks91 Recording

    and chat text will be posted at Moodle and Discord Trial automatic transcriptions will be posted at Discord Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.3/55
  4. Schedule (provisional) Lecture 1 9/30 Overview of FinTech (1) •

    Lecture 2 10/7 Overview of FinTech (2) • Lecture 3 10/14 Internet Technology and Governance (1) — online • Lecture 4 10/21 Internet Technology and Governance (2) • Lecture 5 10/28 The World of Apps (1) — online (close enough to Halloween) • Lecture 6 11/11 The World of Apps (2) — online • Lecture 7 11/18 Basics of Cryptography and Blockchain — online • Lecture 8 11/25 Blockchain • Lecture 9 12/2 Blockchain and Smart Contracts — online • Lecture 10 12/9 Smart Contracts Lecture 11 12/16 Further Smart Contracts — online Lecture 12 12/23 Cyber-Physical Society and Future of Finance Lecture 13 1/13 FinTech Ideathon (1) — online Lecture 14 1/20 FinTech Ideathon (2) Lecture 15 1/27 Presentations and Conclusions Online presence is possible but not recommended for non-online lectures for interactivity reasons Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.4/55
  5. Last Time, We Did . . . Understanding Blockchain Beaker/Newspaper

    Model (physical model of Bitcoin) Validity/Existence/Uniqueness layers Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.5/55
  6. Today’s Topics Understanding Blockchain (revisited) Validity/Existence/Uniqueness layers Applicability of Blockchain

    Impossibility and Challenges of Blockchain Brief Introduction to Upgrading and Governance of Blockchain Assignment Review — Science Fiction Prototyping Smart Contracts and Ethereum — Brief Introduction Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.6/55
  7. Understanding Blockchain (revisited) Lecture 9 : Blockchain and Smart Contracts

    — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.7/55
  8. World of Beaker / Newspaper Model (1) 21,000,000 cm3 (cc)

    of liquid of no value to mankind Contained in a tank Individuals can hold as many beakers as they like, measuring down to 1 100 , 000 , 000 cm3 (it has a locked lid) Only “editor” selected every 10 minutes on average can pump now 6.25cm3 into their beaker Chosen by a special lottery The winning lottery is held in everyone’s box, and each person draws the lottery with all their strength → non-stoppable procedure Coordinate the proportion of winning lots so that someone is chosen every 10 minutes on average Volume pumped is reduced by half every about 4 years (every 210 thousand pages of “newspaper” described later) Started from 50cm3 in January 2009 Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.8/55
  9. World of Beaker / Newspaper Model (2) Relatively free flow

    of fluid between beakers Recorded as “a signed article” by the pourer Post the article in the “newspaper” made by everyone Selected “Editor” verifies the articles and publishes them in the last page of newspaper (of which everyone has a local copy) Page carries the evidence of winning the lottery Editor also gets “overflow” of trades on the page If people publish a page with the same page number. . . Longer sequence of pages wins People sometimes lose the key of their beakers Create this digitally, and pretend that it’s a currency → Bitcoin There is no money or currency that does not need pretension Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.9/55
  10. Guarantee of Validity ∼ (so-called) UTXO Structure An input requires

    a digital signature of the party to which the referenced output is addressed Referenced output (= coin) is consumed → never double-spent (UTXO : Unspent transaction (TX) Output) Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.10/55
  11. Proof of Existence ∼ Hash-chain w/ Proof of Work page

    number : n page number : n+1 page number : n+2 Cryptographic digest of the previous page (must be less than or equal to the target value) some extra number (Nonce : Number used Once) (random value to make the digest less than or equal to the target) Page digest (output by a cryptographic hash function) must be less than or equal to target We don’t know how to manipulate the original data to get the right digest This is the principle of the lottery, which requires the same amount of cost to fake the history Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.11/55
  12. Consent of Uniqueness ∼ Nakamoto Consensus page number : n

    page number : n+1 page number : n+2 page number : n+3 page number : n+1 page number : n+2 page number : n+3 page number : n+4 This history is valid Sometimes page sequences are split when someone else wins the lottery at about the same time A history is the hardest to tamper with when the cumulative cost of lottery for the whole sequence is the highest Everyone agrees that such history is the official one (strict consensus is not achieved because it can be overturned) Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.12/55
  13. Abstract (narrow-sense) Blockchain (getting obsolete) block_no : n block_no :

    n+1 block_no : n+2 block_no : n+3 block_no : n+1 block_no : n+2 block_no : n+3 block_no : n+4 Histroy with the largest cost to record or modify (history the most difficult to alter) is chosen Cryptographic digest of the previous block Transactions are digitally signed To create a block, its cryptographic digest needs to be below some certain number (Proof of Work) or one needs to win by voting weighted by the stakes in cryptocurrency (Proof of Stake) [both costly] Creator of a block can record the reward in cryptocurrency in the block, which is effective only when the block is included in the chosen history Means are provided to confirm existence of transactions validity existence uniqueness In case of Proof of Work, the cost of power is balanced against the market value of the native currency Everyone confirms that records are not tampered with by the mechanism protected by the price of the native currency Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.13/55
  14. Proof and/or Message Embedded in block 0 You can embed

    data unrelated to Bitcoin in the free space of transaction (TX) data Text string embedded in the 1st TX of the 1st block “The Times 03/Jan/2009 Chancellor on brink of second bailout for banks” Anyone can verify this Specify 0 in the search field of https://www.blockchain.com/explorer , proceed to BTC Block See the input for the only TX in the block that came up Use “Hex to ASCII Text Converter” for example What is the intention? Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.14/55
  15. Applicability of Blockchain Possible applications and what you can actually

    do today Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.15/55
  16. Possible Applications (as Hyperledger project sees them) Financial Assets Direct

    access (no need for mediation), agreed real-time settlements, business rule descriptions, and confidentiality Corporate behavior (automating corporate management, especially in financial matters) Real-time execution and confidentiality control of share splits, capital reductions and consolidations, share transfers and exchanges, mergers, third-party allocation of new shares, etc. Supply Chain Traceback of materials, and record and search from production, storage to sales (beware of linkage problem) Master Data Management Only authorized personnel can update and designated reviewers approve it Sharing Economy and IoT Smart cities/towns, transportation, healthcare/fitness, retail, architecture, education, etc. (implicitly real-time and on a large scale) where trust is not necessarily established Red letters denote parts that blockchains are not good at Within the problems we want to solve, there are sub-problems that have not been solved yet Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.16/55
  17. Actual Applications to Date Currency and Remittance Ex. Bitcoin, .

    . . Remittances that bypass banking networks That’s a huge impact Proof of Existence Ex. Proof of Existence, Everledger (in the past), . . . Embed arbitrary digests in a blockchain (piggybacking hack) There is also a method of embedding a single digest of a large number of records Proof that a record has existed and has not been tampered with Certification of Origin or Provenance (traceability, tracking and accounting) This is the originally intended application category of blockchain (an alternative to “newspaper”) Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.17/55
  18. General Model of Existence and Certification EPD  EJHFTU EJHFTU

    EJHFTU EJHFTU EJHFTU EJHFTU EJHFTU EVQMJDBUFJO DBTFPGPEE OVNCFS 6QPOSFDFJWJOHEPD "MJDFBMTPSFDFJWFTEJHFTUTTIPXOJOCMVFBOEXIFUIFSUIFZBSFPOUIFMFGUPSSJHIU 4UBSUJOHXJUIUIFEJHFTUPGEPD "MJDFXJMMLOPXUIFTFSJFTPGEJHFTUTUPCFDPODBUFOBUFE TPTIFDBOSFQSPEVDFUIFDBMDVMBUJPOTVQUP UIF.BSLMFSPPUBOEDPOpSNUIBUUIFSFTVMUJOH.BSLMFSPPUNBUDIFTUIFWBMVFSFDPSEFEJOUIFCMPDLDIBJO "OZPOFDBOSFQSPEVDFUIFQSPDFTTBOEWFSJGZUIFFYJTUFODFPGEPDTJGUIFZVOEFSTUBOEUIFQSJODJQMFBOEIBWFOFDFTTBSZJOGPSNBUJPO SFDPSE DBOSFUSJFWFJOGPSNBUJPO *OGPSNBUJPOEJTDMPTFE UPQBSUJFTSFRVJSJOH QSPPGT QVCMJDJOGPSNBUJPO .FSLMFSPPU .FSLMFUSFF LFQUCZUIFTFSWJDF BOETFOUQBSUJBMMZUPFBDIDMJFOU ʜʜ ʜʜ ʜʜ ʜʜ ʜʜ EJHFTU EJHFTU EJHFTU EJHFTU EJHFTU EJHFTU CMPDLDIBJO ʜ ʜ EPD  EPD  EPD  EPD O Merkle trees are also used within blocks in blockchain to record transactions or states Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.18/55
  19. Impossibility and Challenges of Blockchain Transitional technology, in the process

    of trial and error In fact, a lot of new designs are being tested If we do not have governance for (or if we do not know how to accommodate) technological changes, we cannot use it in society Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.19/55
  20. Hash Rate Transitions (Jan. 2009 - Nov. 2022) If malicious

    participants gain half of the hash rate, blockchain cannot be guaranteed to work correctly Risky in principle if the hashrate is doubled quickly → It has happened On the other hand, what if it doesn’t double rapidly? → Dilemma of providing room for malicious participants What if it suddenly halves? → Very risky in principle, and it also happened Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.20/55
  21. The DAO Incident (uncovered governance challenges) The DAO, an autonomous

    decentralized investment fund built on Ethereum Split (fund split) was recursively called, and 360,000 ETH (5 to 6 billion yen) was stolen (2016/6/17) Choices Do nothing Soft fork (maintains compatibility → freezes the address of the thief) Funds are not returned Hard fork (No compatibility → rewrites history; who controls the present controls the past) Worst occurrence of “Oneness Trap” (described later) in a sense Community chose “hard fork” ! (executed on 2016/7/20) “Most interesting. Gravity’s silhouette remains, but the star and all its planets have disappeared. How can this be?” “Because someone erased it from the archive memory.” — from Star Wars: Episode II – Attack of the Clones So the incident never happened Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.21/55
  22. Scaling Out Question There is one ATM that always has

    10 people in line Sorry if you are in an advanced environment, and you don’t know what we are talking about (or even wonder what an ATM is) ;) What happens to the number of people in the queue if we add one ATM? Other conditions remain the same cf. Daisuke Yamazaki, “Rethinking Scaling Out” (in Japanese) http://www.slideshare.net/yamaz2/ss-58813038 Performance problems can be solved by adding a server ⇒ The system scales out Blockchain does not scale out in its bare form (because everyone makes and maintains a replica) Improvement is possible if you see it as a KVS (Key-Value Store) Because of the distributed KVS technology But you might lose autonomy Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.22/55
  23. Scaling Out and Blockchain 7PMVNFPG%BUBUP1SPDFTT -PBEQFS/PEF #MPDLDIBJO 1SPQFSMZEFTJHOFEEJTUSJCVUFETZTUFN In blockchain,

    the cost of maintaining data structures rises linearly as transactions increase It does not scale out Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.23/55
  24. Blockchain’s “Oneness Trap” It does not scale out Adding more

    nodes does not solve or mitigate performance challenges Must be “the world is one” to work System does not work correctly if the network is partitioned by a large-scale disasters or political change Difficulty of governance to advance technology You cannot “try something different partially, and if it works, apply it to the whole” Impossibility of governance : Agreement by the “whole” must be maintained, but the “whole” cannot be defined ⇒ Powered few changes the technology instead ⇒ Those are disadvantages of non-decentralized nature of blockchain Conversely, there are great expectations and potential for truly decentralized “record fixation device in the air” Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.24/55
  25. Incentive Mismatch Ethereum cannot survive as an application platform if

    ETH as a currency crashes and declines Supported by validators’ motivation to get ETH When the value of ETH drops, validators withdraw Can people who want to run apps (smart contracts) buy ETH to maintain the price? If ETH’s market participants are primarily app users, may be . . . (but they aren’t) The design of the raw Bitcoin is goal-consistent, but . . . In other words, “Bitcoin cannot survive if BTC declines” would be fine But as proof applications such as Proof of Existence advance, similar problems arise Either way, the future of the system depends on the interests of the miners/validators ⇒ Need to separate application platforms from currency systems That is where the recent ledger technology is going, hopefully (because many still aren’t) Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.25/55
  26. What is the True Worth of Blockchain? Roughly speaking, what’s

    the thing you can never do without blockchain? Ex1 : Digitizing the last will and testament (in a thought-experiment sense) After the death of the person, the private key used for the digital signature may no longer be a secret Can’t believe a notary saying, “it is as signed before the death” (possible collusion with malicious heir) Ex2 : Online banking passbook data as proof (for the liabilities of banks) If you download it as a CSV file, the data anyone can create is not considered as evidence Even with the digital signature of the bank, once the private key is leaked, the data can be created by anyone Prove “data digitally signed at cetain past date has not been tampered with” (instead of believing those who insist so) “The Last Will Test” is to ask them if they can do that with their blockchain A test to see if something that someone has been pitching as “it’s a blockchain” really makes sense An idea (hash-chain with proof of work) that may satisfy this true worth, combined with existing technologies around the idea is the Bitcoin blockchain Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.26/55
  27. How Well Is It Realized Today? Is there a technology

    that can pass the “last will test”? Public blockchain may pass the test while the market value of the native currency is high Defense such that it would cost a lot to tamper with When the price of the native currency drops or crashes it becomes unreliable Private ledger systems in general only insist, so they do not pass the test Mostly, “blockchain made and operated by XXX Inc.” is meaningless ← please be careful We are building new technology to make it pass the test BBc-1 (Beyond Blockchain One; https://github.com/beyond-blockchain) (just an example) There is an inherent challenge of linkage between records and entities Includes areas that cannot be solved by engineering alone (does the public key really belong to the person?) Including the openness of the source code, it is roughly the problem of . . . “How can we trust automated mechanisms?” Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.27/55
  28. Brief Introduction to Upgrading and Governance of Blockchain Weaknesses are

    not left untouched, but continue to be improved But governance issues remain Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.28/55
  29. Enhancements to Bitcoin Blockchain Virtualization – Open Assets Protocol (no

    fork) Interpret transaction data in a specific way so that quantities independent from BTC can be defined and used Bug fix – Segregated Witness (SegWit) (soft fork) Signatures are separated from the transaction body Better privacy and conciseness – Taproot (and Schnorr signatures) (soft fork) Scripts can be partially disclosed by expressing them in Merklized Abstract Syntax Trees (kind of Merkle trees) Quickness – Payment channels (no fork) Only write to the blockchain when the channel is opened and closed, and in between you can make fast payments Conceptually, connected payment channels form a Lightning Network How do we upgrade? Soft fork : miners vote by setting a bit in a block header Wait, voting? Is it an Internet way? (remember “We reject kings, presidents and voting”?) Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.29/55
  30. Payment Channel (Bitcoin’s case) "MJDF " #PC # #MPDLDIBJO 

    UP"#  UP#  UP"  UP" MPDLUJNF QBZUSBOTBDUJPOGFFUPNJOFS PQFODIBOOFM pOBMQBZNFOUDMPTFDIBOOFM QBZ QBZ QBZUSBOTBDUJPOGFFUPNJOFS  UP#  UP"   UP#  UP"        MPDLUJNF Alice pays fast by sending Bob transactions to pay, which are cut out of the deposit addressed to Alice and Bob Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.30/55
  31. Science Fiction Prototyping What about it? Lecture 9 : Blockchain

    and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.31/55
  32. Why Science Fiction Prototyping? What is Science Fiction? Fantasy based

    on or disguised as the thoughts and ideas of science and technology The world with existing science and technology is the real world Ex1 : Medical drama Ex2 : Economic novels The world with science and technology unknown to the real world → Fiction Ex1 : Medical drama with nano-machines Ex2 : Drama with digital currency that depreciates (my book “NEO in Wonderland”) Designing new media and putting it into society = living science fiction To work out plans for that = to write science fiction Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.32/55
  33. Assignment Review Lecture 9 : Blockchain and Smart Contracts —

    FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.33/55
  34. Assignment 4. “Smart Contracts” Please think freely with the image

    of the word “smart contract” to fantasize a specific application example, and state the application briefly That is, go ahead and write a very short science fiction Deadline and how to submit November 29, 2022 at 17:59 JST From Moodle (mandatory) (Q&A forum) So that your classmates can read your report, refer to it, and comment on it Optionally, you can also post to #assignments channel at Discord So that anyone in our Discord can read your report, refer to it, and comment on it Just plain text, and be concise, please You may want to apply Kent Beck style for abstracts (4 sentences) (problem) (why it is a problem) (startling sentence) (consequences) of a story Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.34/55
  35. Trends and Measures Trends . . . of your reports

    Measures . . . how to improve the class 17 out of 28 students submitted (always better late than never) Your fictions : smart wills / (health) insurance / rent contract (that explodes when broken) / smart loan / inheritance / legal business / means against climate change / education / job market / flying-car parts / flying-car dealer / sharing clothes / metaverse and physical bodies / religion / DAO / poverty alleviation funds / car rental Had a lot of fun to read! Many of you have set the story in the distant future If you use this assignment for a new business idea, the near future is better, but sometimes putting it in the far future can reveal underlying problems of a new idea If we were to make them look more like the current smart contracts . . . Use the contracts (programs on blockchain) where a proof is needed (like the last will) Conditions to run the code need to be checked outside the contracts Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.35/55
  36. J-san’s Story (on inheritance) 1. Before, when the user is

    alive, it is necessary to specify the wallet address of the heir through the smart contract, which can be multiple heirs, and can be divided into multiple inheritance priorities 2. When the user passes away, multiple signatures are required to trigger the smart contract to initiate the inheritance behavior The signing party here needs a government organization (to prove that the user has passed away), the signature of the heir, and possibly the signature of the designated lawyer 3. When the required multi-person signatures are completed (or the minimum number of signatures specified in advance is reached), the smart contract will transfer all assets on the user chain to the address of the heir ⇒ I would think the same about the signatures Because I think death is a social rather than a physical phenomenon Sensing the stop of heartbeats (cf. TENET), for example, would not work Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.36/55
  37. M-san’s Story (on certifying goods) We are in 2100, in

    a world where cars no longer exist because they were polluting too much People are having trouble to move and travel On the market, there are new forms of electrics cars but some of them are not working and only scams People cannot be sure to buy the right one In the blockchain people would be able to find secure data and have a certificate for the car they are buying The smart contract will enable people to trust which car they are buying and also be reassured about their payment ⇒ If the number of automobiles is to be reduced, I feel that it would be better to introduce self-driving cars They would not be bought (owned) but rented out as J-san suggested BTW, do you think money will still exist in year 2100? Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.37/55
  38. L-san’s Story (on poverty alleviation funds) Civil affairs departments can

    allocate poverty alleviation funds through smart contract of digital coins, and set payment contracts according to the requirements of poverty alleviation funds use (such as carrying out medical assistance), and the payment contracts are executed automatically by the digital currency system, and the digital currency can only enter and exit the fund channel limited by the rules of use specified in the payment contracts The civil affairs department can independently control the use of subsequent poverty alleviation funds to achieve dedicated and precise control of poverty alleviation funds More complex payment contracts can also be developed to achieve more precise use of funds, such as limiting the usage rules to specific groups of people (those eligible for poverty relief), specific industries (can only be used in hospitals designated for medical aid), and specific rules (whether the payment settlement list meets the conditions for medical aid) ⇒ It shows the concept of programmable money CBDC (Central Bank Digital Currency) is feared by some for this reason Because people’s consumption behaviors can be controlled by the central bank (≃ government) Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.38/55
  39. Smart Contracts and Ethereum What is Smart Contract? Ethereum Lecture

    9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.39/55
  40. What is Smart Contract? Speak in a narrow sense Speak

    in a broad sense Smart contracts and vending machines What is a contract? Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.40/55
  41. Speak in a Narrow Sense A smart contract is, A

    system for automatically transferring and transitioning digitally represented assets according to predetermined rules Or more mechanically, To write program code and data to a blockchain, Or to a ledger that can pass the last will test (censorship-resistent in a broad sense) And run the program blockchain-wise to update data Run when miners/validators verify transactions They do not agree with the feeling of the word But there is a meaning to this narrow sense Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.41/55
  42. Speak in a Broad Sense A smart contract is, Mechanisms

    for implementing contracts mechanically Or, contracts implemented as such ↑ Definition in future dictionaries A vending machine is a primitive form of smart contracts Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.42/55
  43. What is a Contract Anyway? Contracts (by Oxford Dictionary) A

    written or spoken agreement, especially one concerning employment, sales, or tenancy, that is intended to be enforceable by law ⇒ Well, code may be law Essential requirement for its establishment Coherence of manifestation of intention between the parties And the medium for that, Oral, handshake, carving/baking on clay tablets and breaking them, paper (handwriting), paper (print) What can a machine do? cf. “The medium is the message.” by McLuhan cf. “Gutenberg Galaxy” by McLuhan Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.43/55
  44. Gutenberg Galaxy (typography) (revisited) Birth of the concept of “authors”

    (meaningless concept unless texts are copied word for word without difference) Scientific methodology (publish papers and have results tested) Nationalism (one standard language, one country) Prepared “movies” (series of photos from one viewpoint) Clear distinction between finished and unfinished “products” (printed copies are the products, handwritten manuscripts are not) Individualism (can carry knowledge personally) Unification of popular culture (massive copies) . . . ⇒ Prepared the industrial society Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.44/55
  45. Reversed Gutenberg Galaxy (digital media) (revisited) Destruction of the concept

    of “authors” (social media time lines are like mosaic media) Overturned scientific methodology (automated hypothesis-testing loops for discoveries) Global perspective (connected across borders) Everyone becomes a moviemaker (YouTubers, TikTokers) Obscured finished and unfinished products ⇒ open design Promotion of collaboration (sharing by default) Diversification of cultural events (long tail) . . . ⇒ Preparing for the next society Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.45/55
  46. Overview of Ethereum Blockchain and State Transition EVM (Ethereum Virtual

    Machine) Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.46/55
  47. What is Ethereum? Vitalik Buterin, “Ethereum White Paper: A NEXT

    GENERATION SMART CONTRACT & DECENTRALIZED APPLICATION PLATFORM” Applying blockchain technology Block interval : at most 1 block in a 12-second time slot Put a programming language on it Turing complete = can emulate a universal Turing machine (well that’s almost a definition of a programming language) Foundation for DApps (applications that automate the center) An attempt to make the current financial and monetary system obsolete That’s what smart contracts are all about Automate digital asset transfers and their state transitions Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.47/55
  48. Blockchain and State Transitions TUBUF FYUFSOBMBDUPST BDDPVOU &7.DPEF &UIFSˠHBT JOWPLF

    DPOUSBDUDPEF NFTTBHFPSBOFXBVUPOPNPVTPCKFDU EBUBFYDIBOHFEBNPOHBDDPVOUTPS&UIFS TUPSBHF TUBUF` TFUPG USBOTBDUJPOT EJHJUBMTJHOBUVSF &7. IVNBO GPSFYBNQMF Blockchain = Run of a state machine (state transition system) = Operation of a computer Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.48/55
  49. Glossary Ether (ETH) Native currency of Ethereum (compensation for validating)

    External Actor A real person/entity who can digitally sign, having an account EOA : Externally-Owned Account Autonomous Object (internal actor) Operates autonomously within the system, and has an account That said, if you don’t send a message, it won’t work (and validators run them) Account Has an Ether balance, and can have storage (state) and EVM code EVM Code Smart contract program Smart contract = application program on Ethereum = intelligent contract Authenticity is ensured by being written in blockchain Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.49/55
  50. EVM : Ethereum Virtual Machine TUBUF FYUFSOBMBDUPST BDDPVOU &7.DPEF &UIFSˠHBT

    JOWPLF DPOUSBDUDPEF NFTTBHFPSBOFXBVUPOPNPVTPCKFDU EBUBFYDIBOHFEBNPOHBDDPVOUTPS&UIFS TUPSBHF TUBUF` TFUPG USBOTBDUJPOT EJHJUBMTJHOBUVSF &7. IVNBO GPSFYBNQMF BVUPOPNPVT PCKFDU Triggered when an autonomous object receives a message, performs a contract, and changes state Gas (computing resource) must be bought (to avoid infinite loops and compensate the block proposer) (mostly burnt) Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.50/55
  51. Demonstration Using Brownie, a Python-based development and testing framework for

    smart contracts on EVM, https://eth-brownie.readthedocs.io/en/stable/ Today, we will use the Python interpreter environment it provides And infura.io that provides accesses to Ethereum (main and test) networks, https://infura.io Let’s demonstrate sending some fractions of Ether between accounts Both on memory (simulated network) and on a test network Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.51/55
  52. Technical Challenges of Blockchain Non real-time (probabilistic behavior) Difficulty of

    secrecy (guarantee of verifiability to all) Oneness (distribution vs. replication) Not scalable (do not scale if replicated to all participants) Harder governance of evolution (can’t change if everyone needs to be united) Incentive mismatch (discrepancy of motivations for participation in infrastructure and applications) Supported by the value of the native currency (crash would stop all applications) ⇒ Can be solved by redesigning it zero-base Actually in progress (ex. BBc -1) Problem with many ledgers is that they are not redesigned zero-base ex. Hash-chains without proof of work can be tampered with ex. Talking about “newspaper model”, you can’t prove anything by publishing articles in company newsletters Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.52/55
  53. Ethereum’s Approach (solutions blockchain-way) Non real-time (probabilistic behavior) ⇒ Transactions

    are finalized after two epochs; 1 epoch = 32 slots Difficulty of secrecy (guarantee of verifiability to all) ⇒ ZoE (Zcash on Ethereum) Oneness (distribution vs. replication) Not scalable (do not scale if replicated to all participants) ⇒ Sharding, Plasma (multi-layered) Harder governance of evolution (can’t change if everyone needs to be united) ⇒ Benevolent Dictator For Life (BDFL) (with bitter smile ;) ) Incentive mismatch (discrepancy of motivations for participation in infrastructure and applications) Supported by the value of the native currency (crash would stop all applications) ⇒ Will people who want to run the apps buy Ether and support? Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.53/55
  54. BBc-1’s Approach (solutions non-blockchain-way) Non real-time (probabilistic behavior) ⇒ No

    probabilistic behavior before transaction commits Difficulty of secrecy (guarantee of verifiability to all) ⇒ Transaction content is kept secret outside the domain, and can be encrypted inside Oneness (distribution vs. replication) Not scalable (do not scale if replicated to all participants) ⇒ Scale-out on a domain-by-domain basis, intra-domain DHT in the future Harder governance of evolution (can’t change if everyone needs to be united) ⇒ Autonomy by domain (don’t care about intra-domain protocols) Incentive mismatch (discrepancy of motivations for participation in infrastructure and applications) Supported by the value of the native currency (crash would stop all applications) ⇒ No native currency, proof of context work by mutual aid Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.54/55
  55. See You Next Week in Classroom! Have a nice weekend!

    Lecture 9 : Blockchain and Smart Contracts — FinTech — Financial Innovation and the Internet 2022 Fall — 2022-12-02 – p.55/55