Beyond the Bubble – Blockchain Applications and the Drupal Ethereum Module

#DrupalEthereum @digitaldonkey09

Drupal NYC Meetup 

About me

  • 20 years ​​web development  
  • 10+ years with Drupal
  • 2+ years in Ethereum 
  • Developer at ConsenSys 

Overview

  • What is a Blockchain
  • Ethereum Blockchain
  • Drupal Ethereum Module
  • Launching Daap's 
  • Discuss Blockchain applications
  • Law - investigating the legal side of "smart contracts" and tokens
  • NGOs - transparency in international aid & outcomes
  • Banks trying to improve their interbank settlement
  • Governments exploring digital IDs and e-government
  • Healthcare - sharing evidence, verified prescriptions
  • Energy - incentivizing energy efficiency and trading
  • IoT - Internet of things, sensors, appliances

Who cares about Blockchain?

What's a Blockchain?

Imagine the Blockchain as a
"Decentralized & Distributed Consensus Database"

"0xd62e7da1d30af2abed70f0ec677fefe0a0db5774  owns 5 Bitcoin"

agree
agree
agree
agree
agree
agree

Blockchain's promises

"Sharing Economy" of
Uber, Airbnb

Centralized User Data,
Facebook, Google

Reduce costs of
middlemen

Self-sovereign
user identity

Internet of
Information

Don Tapscott: "How the Blockchain is changing money and business"

Internet of
Trust and Value

Digital Identity Today

Is proprietary / Isn't self owned

  • Facebook / Google 
  • Visa, Master, Bank account
  • Equifax -> Random hackers
  • State IDs / Passports

You pay for your "free" online identity by exposing your privacy

You can be excluded ("You may leave if you don't like the new Terms & conditions")

Self Sovereign Identity

The Idea of decentralized identifier (DID)

  • You create a claim:
    "My address is 949 Metropolitan Av, Brooklyn"
  • Others attest your claim:
    "New York State verifies that this person is registered at this address with the offical NYS signature"
  • As a developer you would chose which attestation entities you consider trustworthy

Many people work on this

  • uPort (ConsenSys)
  • Blockstack
  • http://www.weboftrust.info
  • http://identity.foundation
  • https://sovrin.org
  • https://www.civic.com

Blockchain Applications

The decentralized long term perspective

  • Peer-to-peer Music / [add our digital good here] markets
  • Decentralizing Energy infrastructure
  • Asset Management: Trade Processing and Settlement
  • Supply chain records
  • Self governed organizations
  • Tokenized ownership
  • Peer-to-peer standards for Airbnb, Über ...
  • Fix Journalism
  • Self sovereign identity
    • Digital IDs (uPort piloted at "Zug ID" in Swiss)

Blockchain Applications

Lower hanging fruits

 

  • Payments, Money transfers
  • Paywall, Micropayment
  • Donations, tipping
  • Signature Systems - everything requiring a signature
  • Bounties
  • Subscriptions Services (EIP-948)
  • Voting
    ⇒ Investigate "good" contracts and implement in Drupal.

Ethereum

Ethereum is an open-source, public, blockchain-based distributed computing platform featuring smart contract functionality

Ethereum Blockchain

Decentralized
P2P consensus

No central authority

 

Any state change requires a cryptographically signed Transaction

Global ledger with immutable records

Programmable money:
Smart Contracts

Smart Contracts in Ethereum

  • Can run automatically when certain conditions are met
  • Addressable, can handle money / escrow, Turing-complete
  • Crowd founding as a Smart Contract:
Contract crowdFound
 if (account_balance) > $10,000
   move account_balance to founded_account
 else
   move donation_account to original_donor

(pseudocode)

Smart contracts are programs with a state stored on the blockchain

Ethereum - Global or Private

Private Consortium
Blockchain
(permissions, privacy)

 

Global Public
Blockchain

Transactions, Blocks & chaining

"Writing to Blockchain" requires:

  • the private key of the from address to sign the transaction
  • some gas fee for computation/data storage in Ether (public chain)
     

Blocks

  • contains a hash of the last block
  • are created about every 17 seconds

time

Ethereum

  • Ether is the currency in Ethereum
  • Computations  cost "gas" (payed in ether) to run
    -> anti-spam and incentivize to run the network
  • Data changes to a blockchain create immutable audit trails
  • Blockchain data is public! (on public chains, if not encrypted)
  • Smart Contracts: Code deployed to the blockchain that can control funds
  • Private-/public key cryptography like in PGP 

Signing & Signatures

  • Asymmetrical/public key cryptography
  • Signing requires user interaction (if you don't host the keys        )
  • Ethereum Address is derived from the private key
  • Signing Transactions (writing anything to the blockchain is a transaction, also sending money, deploying code)
  • Signing text (Signatures)
  • You may use the key for Encryption (Similar to PGP)
  • Any account is independent from the network

Transaction Signers

  • Mist browser   (Full Blockchain / Ethereum foundation)
  • Metamask   (Browser extension)
  • MetaMascara (Metamask in Browser)
  • uPort   (Identity provider)
  • MyEthereumWallet   (Online or Offline Browser)
  • Jaxx (Mobile App & Browser extension)
  • Hardware based signing (Ledger wallet)

Ethereum wallets, Identity providers ... 

Literally the key for the user 

Drupal Ethereum Module

  • Founded and abandoned in 2014
  • New approach started 2016
  • PHP Library (Ethereum-PHP)
  • POC for signup with registry (8.1.x)
  • Currently finalizing infrastructure
    • ​Manage Networks and Contracts
    • Ethereum Signup
    • Ethereum User connector

Current web

Ideal decentralization

How to connect Drupal and Ethereum?

Semi-decentralization

Client side signing using Transaction-signers

Server just pulls data

(no private key on Server)

Architecture challenges

Ethereum-PHP Library

  • Abstract Ethereum JsonRPC API
  • strict Datatypes, keccak hash , EC-Verify in PHP
  • SmartContract Objects
  • Lots of tests, ability to test against smart contracts
  • API documentation: http://ethereum-php.org
  • https://packagist.org/packages/digitaldonkey/ethereum-php
  • TODOs
    • complex data types (Arrays + Lists
    • Sustainable EC-verify 
    • Testing framework for PHP library for various Ethereum clients

Mapping Ethereum to Drupal

Infrastructure modules

Servers (Ethereum-nodes)

List Servers, gather information (Server Entity)

Deployability, Testability


Accounts

Ethereum Addresses
Map Accounts to Drupal Accounts
➡ Identity for known user group

          Transactions

               Read (own contracts/known ABI)

               ​Log TX based on Contract interaction

               Process TX data in Drupal
 

          Smart Contracts

               Manage deploy as Drupal Admin

               Provide ABI to process data in Drupal & frontend

               Watch for Blockchain Events triggers by Contracts

Two signup modules?

Ethereum Signup

  • Challenge/response authentication
  • No Blockchain interaction - no fee
    Just Elliptic Curve cryptography
  • Uses externalauth module

Ethereum user connector

  • Smart contract with registry
  • May be changed to a paywall
  • Transaction require little payment in Ether
  • Example module for contract interaction

Mascara & Dapp launcher

current pluggable TX signer solution

  • Dapp is a acronym for decentralized app
  • Metamask Mascara allows TX signing without Browser extension
  • Mascara Wrapper:
    • Evaluate a common way for blockchain interaction
    • Make sure the user
      • is on the right network
      • has unlocked his account (if you need his address)
  • Experiment interaction UX and develop standards for Blockchain 

Mascara & Dapp launcher

Visualize TX signer state 

Initialize dapplet when requirements are met

Architecture summary

State and Roadmap

POC (done)

  • "User connector" connects Ethereum accounts and user profiles via registry contract ("paywall"). Refactoring to new infrastructure.
    See Video https://youtu.be/Y5Sa7QtpXSE 
  • Identity: "Signup" (currently in github feature-ethereum_signup)

Finalizing infrastructure modules (MVP)

  • Refactor above to match the new Infrastructure
    (Mostly done. Results in much less code compared to POC)
  • Finalize Ethereum-PHP library
  • Add more Transaction-signers. Explore and improve UX
  • Contract deployment from Drupal backend (Maybe implement Remix)

Drupal Ethereum module

Why should Drupal care about Blockchain?

  • Blockchain adds a new trust layer to the internet (we call it web3)
  • Drupal can provide Identity in context of limited user groups
  • Implement enterprise level workflows, required for Document signing, Peer-to-peer platforms, Asset tracking ...
  • Explore new ways of NGO founding, budgeting, voting.
  • Investigate future payment methods.
  • Pioneer new blockchain based business models 

Lots of Thanks to early
contributors & testers

and all others I talked to

(Commit stats refer to the various involved projects)

Questions & Thank You

thorsten.krug@consensys.net
       @digitaldonkey09

The development of Drupal Ethereum Module
Has been sponsored by ConsenSys

       @ConsenSys

https://consensys.net

slides.com/digitaldonkey/drupal-ethereum-nyc

Drupal Camp NYC - Beyond the Bubble – Blockchain Applications and the Drupal Ethereum Module

By Thorsten Krug

Drupal Camp NYC - Beyond the Bubble – Blockchain Applications and the Drupal Ethereum Module

Presentation about Drupal Ethereum module at Drupal NYC user group May, 2nd 2018

  • 1,742