SlideShare a Scribd company logo
1 of 66
Smart Contracts that Learn
(Extended Version)
Mike Slinn
June 29, 2018
IBM Ottawa
About Mike Slinn
• Distinguished engineer
• Contributor to Ethereum Java and Scala libraries
• Operates ScalaCourses.com
• Author of EmpathyWorks (artificial personality)
• Expert witness
• Twitter: mslinn
Key Facts about Mike Slinn
• Focuses on generating business value by
applying people, process and technology
• Wrote 3 books on distributed computing
• Created hundreds of online lectures on
advanced computing concepts
• Uses many computer languages (“polyglot”)
In 10 Years
(2028)
The most popular language or framework used
to write smart contracts in 10 years probably
has not been conceived of yet.
-- Mike Slinn, March 3, 2018 --
Machine Learning & Smart Contracts
• Machine learning (ML) will be commonly used
with smart contracts in 10 years.
• Highly specialized languages will evolve to
define and verify contracts in various industries.
• ML will have features added to guarantee
deterministic results for decentralized apps.
• Security will surely have to improve
Espionage
• In 10 years time corporate and nation/state
espionage will include:
o Sabotaging training data
o Spoofing smart contract events
o Seeding smart contract templates with security
weaknesses
o … and lots more …
Newspaper Style
Key Takeaways
Dogma and ideology are not good for business
Dial Back the Koolaid
Confession
On-chain smart contracts cannot actually learn
However, these can learn:
• User interfaces for on-chain distributed applications
(ĐApps)
• Oracles
• Gateway contracts
• Off-chain smart contracts (systems integrated via json-
rpc, IPC and other mechanisms)
On/Off Chain Computation
Geth
Parity
etc
Beware Non-Deterministic Behavior
• Blockchain requires determinism for consensus
• A ML-driven product may not have deterministic
behavior and may produce counter-intuitive
results
• A personalized recommender system may
produce different results for a user action after
learning additional preferences
ML is Done Offchain
ML is currently centralized offchain, because
significant computation and storage are
required
• Centralized, offchain processes can respond
to onchain events and initiate activity via
json-rpc or IPC to Ethereum clients
• ML likely not decentralized for several years
‘(De)centralization’ is Misleading
• Decentralization uses consensus before
output is accepted from multiple EVMs, which
then leads to transactions.
• Centralization does not use consensus; note
that the web3 definition of centralization
includes federated systems and distributed
applications that employ DNS with
geolocation routing and failover.
Centralization
• Architectural (de)centralization 
• Political (de)centralization 
• Logical (de)centralization
Logical Clocks
• Distributed systems experience Einstein’s
relativistic effects due to the limitation of the
speed of light
• If ML systems were enhanced to incorporate
logical clocks to associate the learned state
at arbitrary global timestamp values they
could become deterministic.
Security Issues
• Discussion later in this talk
o Features/Complexity versus Security
o Solidity is misnamed
Dogma Is Bad For Business
• The degree of centralization is mostly a
business decision
• System integration strategies
o ML systems can indirectly interact with the blockchain
using json-rpc or IPC to an Ethereum client such as
geth or Parity
o Native apps can combine ML with blockchain
• Solidity is suboptimal
Issues With Solidity:
• Primitive type system.
• Compiler bugs (more surely exist).
• Few software tools available.
• Expensive to work with
o Hard to hire for
o Low productivity
o High risk
• Very expensive to maintain.
• Shelf life for this technology will be short.
Avoid Solidity If Possible
• Write the smart contract in the language of your
choice, and use json-rpc calls as desired.
• Resulting code will be well understood by all.
• Audits will be more reliable.
• Costs will be much less using a common
language instead of Solidity.
• Talent will be much easier to find.
Ethereum Is Not Symmetric
• Onchain smart contracts are distributed and
use consensus
• Offchain smart contracts (using Ethereum
clients) are currently centralized and so do
not use consensus
• This will likely evolve over the next several
years
ChainLink (1/2)
• Wraps existing singleton services and
presents them as a decentralized oracles
• Run by a for-profit organization
• See smartcontract.com
ChainLink (2/2)
• Does not address the motivations for
decentralization:
o Fault tolerance – single point of failure
o Attack resistance
o Collusion resistance
• Wrapping a singleton and presenting it in a
decentralized manner does not make the
singleton decentralized
Transpiling
• Process of converting a program written in one
language into another language.
• Solidity could be transpiled to json-rpc calls from
node.js and JVM languages (Java, Scala,
JRuby, Jython, Groovy, etc).
• … but don’t bother because you endure all the
problems with Solidity and get none of the
benefits of native contracts
Use Cases
With Architecture Diagrams
Self-Optimizing Contracts
• Optimize transactions for greatest margin,
minimal waste, constant deal flow, or other
criteria
• Results would improve over time
• This is an onchain example
Genetic algorithms
Evolution strategies
Evolutionary programming
Simulated annealing
Gaussian adaptation
Hill climbing
Swarm intelligence
Integer linear programming
Fraudulent Event Detection
• Smart contracts currently act on all events
• Fraud detection often employs machine
learning
• Incorporating ML into smart contracts could
make them resistant to fraud
• This is an onchain example
Automated Customer Service Agents
• Chatbots and voice interfaces (Alexa)
• Much more natural to use
• Can be built into devices
• This is an onchain example
Geth
Parity
etc
Medical Diagnosis Expert System
• Smart contract mediates access to an expert system
(oracle, incorporates machine learning)
• Accepts anonymous patient data
• Passes data to an expert system that performs analysis
• Returns diagnostic results
• Charges for the service
• This is an offchain example
Geth
Parity
etc
Supply Chain
• Native application (JVM, .NET, C++, whatever)
uses json-rpc to interact with the blockchain
• Solidity is not required
• This is an offchain example
Supply Chain
Node.js
Java
Scala
Jython
JRuby
C
C++
C#
F#
Geth
Parity
etc
Contracts
Traditional Contracts…
• Outline the terms of a relationship
• According to a specific jurisdiction
• So that the specified government can enforce
the terms
Smart Contracts…
• Enable rule-based autonomous actions in
response to events.
• Work within and between organizations and
the rest of society, world-wide.
Smart Contracts Threaten Tradition
• Enforce a relationship with cryptographic
code
• Without regard to the jurisdiction of any
government
Smart Contracts …
• Also known as cryptocontracts
• Are computer programs
• Directly control the transfer of blockchain-based
digital currencies or assets
• Define the rules and penalties for an agreement
• Might automatically enforce those obligations
System Integration
• Collecting inputs and outputs to smart
contracts requires system integration.
• Approaches vary according to input sources,
output destinations, volumes of data, required
reliability, fairness (near-constant latency),
etc.
• Beware of introducing single points of failure
Smart Contract Capabilities
Manage relationship between parties by:
• Maintaining virtual ledgers
• Reading/writing arbitrary on-chain data
• Reading/writing off-chain data
• Forwarding events to other contracts
• Acting as a software library
Smart Contract Requirements
• Observability
• Verifiability
• Privity
• Enforceability
Oracles
• Smart contracts need oracles to resolve details
that cannot be precisely known at the time the
contract is written.
• Oracles provide reference information for smart
contracts.
• An oracle is usually a (singleton) REST API
connected to a data source.
• Using oracles generally decreases security
Smart Contract Platforms
• Bitcoin
• Cardano (eventually)
• DFinity
• EOSIO
• Ethereum
• Hyperledger
• Lisk
• Pact on Kadena
• NEO
• Quorum
• Qtum
• RSK
• Stratis
• Wanchain
Ethereum Virtual Machine (EVM)
• Deterministic.
• Each Ethereum node has an EVM instance.
• EVM has a similar execution model to both the
Java and the .NET virtual machines.
• All these VMs are stack machines executing
bytecode.
• EVM adds storage and its bytecode is somewhat
more suited for contracts.
Interesting Smart Contract Languages
All compile to EVM byte code except Chaincode
• AxLang
• Chaincode (Hyperledger)
• LLL
• Pact (Kadena)
• Solidity
Solidity
Solidity
• Solidity contracts are difficult to secure.
• Formal verification could help.
• Most Solidity contracts ignore security
recommendations.
• Solidity’s support for types is rather primitive.
Solidity and Security
• Contracts written in Solidity are difficult to
make secure.
o Formal verification could help.
• Solidity’s support for types is primitive
Better On-Chain
Language Support
AxLang
AxLang
• Smart contract language designed to support
formal verification.
• Cross-compiled Scala DSL for Ethereum
• Designed to scale
• Not yet ready
Pact / Kadena
• Functional, interpreted Lisp-like syntax
• Features type inference
• Similar to database stored procedures in an
online transaction processing (OLTP) system
• Not Turing complete
• Runs on the Kadena blockchain
json-rpc
(Off-Chain apps)
json-rpc
• Popular communications protocol
• Communicates between off-chain
applications and their Ethereum clients
Some json-rpc Libraries
• web3.js – for node.js
o Can also transpile Solidity to JavaScript
• web3j – for Java
• Can also transpile Solidity to Java
• web3j-scala – for Scala
o (I wrote this one)
o Idiomatic Scala wrapper around web3j
Learning
How do Computers Learn?
• Trial and error with feedback
• Training
Types of Machine Learning
Classifier systems
Reinforcement
Representation
Rule-based
Similarity and metric
Sparse dictionary
Support vector machines
Association rule
Artificial neural networks
Bayesian networks
Clustering
Decision tree
Deep
Genetic algorithms
Inductive logic programming
How Might Smart Contracts Learn?
• “Learning” computation must occur off-chain
• Enforced by the Ethereum fee structure
Machine Learning Applications
Machine perception, including computer
vision and object recognition
Optimization and metaheuristic
Recommendation systems
Robot locomotion (autonomy)
Sentiment analysis
Speech and handwriting recognition
Structural health monitoring
Syntactic pattern recognition
User behavior analytics
Translation
Automated theorem proving
Adaptive websites
Bioinformatics
Classifying DNA sequences
Detecting credit-card fraud
General game playing
Information retrieval
Internet fraud detection
Insurance
Linguistics
Medical diagnosis
Caution
Security / Complexity Tradeoff
Security Cannot Be Retrofitted
• Secure systems can only be designed that
way from the start
o Trying to secure an existing platform can only give
marginal improvements
• Need orders of magnitude of improvements
to smart contract security
o Not possible without a fresh start
Thank you!
Mike Slinn
mslinn@micronauticsresearch.com
650-678-2285

More Related Content

What's hot

Alternative Consensus & Enterprise Blockchain
Alternative Consensus & Enterprise BlockchainAlternative Consensus & Enterprise Blockchain
Alternative Consensus & Enterprise BlockchainTobias Disse
 
Icsa2018 blockchain tutorial
Icsa2018 blockchain tutorialIcsa2018 blockchain tutorial
Icsa2018 blockchain tutorialLen Bass
 
Anatomy of a hyperledger application
Anatomy of a hyperledger applicationAnatomy of a hyperledger application
Anatomy of a hyperledger applicationEric Cattoir
 
How AI benefits from Blockchain and Game Theory with Scalable Censorship-resi...
How AI benefits from Blockchain and Game Theory with Scalable Censorship-resi...How AI benefits from Blockchain and Game Theory with Scalable Censorship-resi...
How AI benefits from Blockchain and Game Theory with Scalable Censorship-resi...Pandora Boxchain
 
Advanced Cryptography for Cloud Security
Advanced Cryptography for Cloud SecurityAdvanced Cryptography for Cloud Security
Advanced Cryptography for Cloud SecurityNeel Chakraborty
 
Security Model of Blockchain
Security Model of BlockchainSecurity Model of Blockchain
Security Model of Blockchainsaficus
 
Smart Contract Security Testing
Smart Contract Security TestingSmart Contract Security Testing
Smart Contract Security TestingDilum Bandara
 
150625_핀테크포럼 6월 정기모임_빅데이터시대와 블록체인
150625_핀테크포럼 6월 정기모임_빅데이터시대와 블록체인150625_핀테크포럼 6월 정기모임_빅데이터시대와 블록체인
150625_핀테크포럼 6월 정기모임_빅데이터시대와 블록체인StartupAlliance
 
Blockchain and IoT / Atlanta BlockChainConf
Blockchain and IoT / Atlanta BlockChainConfBlockchain and IoT / Atlanta BlockChainConf
Blockchain and IoT / Atlanta BlockChainConfIgor Artamonov
 
[한국핀테크포럼] 제7회 핀테크포럼
[한국핀테크포럼] 제7회 핀테크포럼[한국핀테크포럼] 제7회 핀테크포럼
[한국핀테크포럼] 제7회 핀테크포럼Hyeseon Yoon
 
EUIPO DPM knowledge share: Blockchain and IP
EUIPO DPM knowledge share: Blockchain and IPEUIPO DPM knowledge share: Blockchain and IP
EUIPO DPM knowledge share: Blockchain and IPAudrius Ramoska
 
Analysing Data from Blockchains - Keynote @ SOCCA 2020
Analysing Data from Blockchains - Keynote @ SOCCA 2020Analysing Data from Blockchains - Keynote @ SOCCA 2020
Analysing Data from Blockchains - Keynote @ SOCCA 2020Ingo Weber
 
Privacy Preserving Paradigms of Blockchain Technology
Privacy Preserving Paradigms of Blockchain TechnologyPrivacy Preserving Paradigms of Blockchain Technology
Privacy Preserving Paradigms of Blockchain TechnologyGokul Alex
 
Blockchain and Virtual Currency - Technical issues -
Blockchain and Virtual Currency- Technical issues -Blockchain and Virtual Currency- Technical issues -
Blockchain and Virtual Currency - Technical issues -Kindai University
 
Komodo Blockchain Security Service Brochure
Komodo Blockchain Security Service BrochureKomodo Blockchain Security Service Brochure
Komodo Blockchain Security Service BrochureJean-Phi N✅
 
Security in the blockchain
Security in the blockchainSecurity in the blockchain
Security in the blockchainBellaj Badr
 
Blockchain-based Applications
Blockchain-based ApplicationsBlockchain-based Applications
Blockchain-based ApplicationsSadegh Dorri N.
 

What's hot (20)

Alternative Consensus & Enterprise Blockchain
Alternative Consensus & Enterprise BlockchainAlternative Consensus & Enterprise Blockchain
Alternative Consensus & Enterprise Blockchain
 
Icsa2018 blockchain tutorial
Icsa2018 blockchain tutorialIcsa2018 blockchain tutorial
Icsa2018 blockchain tutorial
 
Anatomy of a hyperledger application
Anatomy of a hyperledger applicationAnatomy of a hyperledger application
Anatomy of a hyperledger application
 
How AI benefits from Blockchain and Game Theory with Scalable Censorship-resi...
How AI benefits from Blockchain and Game Theory with Scalable Censorship-resi...How AI benefits from Blockchain and Game Theory with Scalable Censorship-resi...
How AI benefits from Blockchain and Game Theory with Scalable Censorship-resi...
 
Advanced Cryptography for Cloud Security
Advanced Cryptography for Cloud SecurityAdvanced Cryptography for Cloud Security
Advanced Cryptography for Cloud Security
 
Security Model of Blockchain
Security Model of BlockchainSecurity Model of Blockchain
Security Model of Blockchain
 
Smart Contract Security Testing
Smart Contract Security TestingSmart Contract Security Testing
Smart Contract Security Testing
 
150625_핀테크포럼 6월 정기모임_빅데이터시대와 블록체인
150625_핀테크포럼 6월 정기모임_빅데이터시대와 블록체인150625_핀테크포럼 6월 정기모임_빅데이터시대와 블록체인
150625_핀테크포럼 6월 정기모임_빅데이터시대와 블록체인
 
Blockchain and IoT / Atlanta BlockChainConf
Blockchain and IoT / Atlanta BlockChainConfBlockchain and IoT / Atlanta BlockChainConf
Blockchain and IoT / Atlanta BlockChainConf
 
[한국핀테크포럼] 제7회 핀테크포럼
[한국핀테크포럼] 제7회 핀테크포럼[한국핀테크포럼] 제7회 핀테크포럼
[한국핀테크포럼] 제7회 핀테크포럼
 
EUIPO DPM knowledge share: Blockchain and IP
EUIPO DPM knowledge share: Blockchain and IPEUIPO DPM knowledge share: Blockchain and IP
EUIPO DPM knowledge share: Blockchain and IP
 
Analysing Data from Blockchains - Keynote @ SOCCA 2020
Analysing Data from Blockchains - Keynote @ SOCCA 2020Analysing Data from Blockchains - Keynote @ SOCCA 2020
Analysing Data from Blockchains - Keynote @ SOCCA 2020
 
Privacy Preserving Paradigms of Blockchain Technology
Privacy Preserving Paradigms of Blockchain TechnologyPrivacy Preserving Paradigms of Blockchain Technology
Privacy Preserving Paradigms of Blockchain Technology
 
Blockchain and Virtual Currency - Technical issues -
Blockchain and Virtual Currency- Technical issues -Blockchain and Virtual Currency- Technical issues -
Blockchain and Virtual Currency - Technical issues -
 
02 hello smart contracts
02 hello smart contracts02 hello smart contracts
02 hello smart contracts
 
Etherium Intro for techies
Etherium Intro for techiesEtherium Intro for techies
Etherium Intro for techies
 
Brief Introduction to Blockchain Security
Brief Introduction to Blockchain SecurityBrief Introduction to Blockchain Security
Brief Introduction to Blockchain Security
 
Komodo Blockchain Security Service Brochure
Komodo Blockchain Security Service BrochureKomodo Blockchain Security Service Brochure
Komodo Blockchain Security Service Brochure
 
Security in the blockchain
Security in the blockchainSecurity in the blockchain
Security in the blockchain
 
Blockchain-based Applications
Blockchain-based ApplicationsBlockchain-based Applications
Blockchain-based Applications
 

Similar to Fullsize Smart Contracts That Learn

Blockchain Experiments 1-11.pptx
Blockchain Experiments 1-11.pptxBlockchain Experiments 1-11.pptx
Blockchain Experiments 1-11.pptxsaiproject
 
How to Build Your Blockchain Project with Chainstack
How to Build Your Blockchain Project with ChainstackHow to Build Your Blockchain Project with Chainstack
How to Build Your Blockchain Project with ChainstackChainstack
 
Write Smart Contract with Solidity on Ethereum
Write Smart Contract with Solidity on EthereumWrite Smart Contract with Solidity on Ethereum
Write Smart Contract with Solidity on Ethereum劉 維仁
 
Blockchain Tech Approach Whitepaper
Blockchain Tech Approach WhitepaperBlockchain Tech Approach Whitepaper
Blockchain Tech Approach WhitepaperProperty Bihar
 
Blockchain with HyperLedger (Public version)
Blockchain with HyperLedger (Public version)Blockchain with HyperLedger (Public version)
Blockchain with HyperLedger (Public version)Benjamin Fuentes
 
Cryptographic Agility in Corda
Cryptographic Agility in CordaCryptographic Agility in Corda
Cryptographic Agility in CordaGuy Hochstetler
 
Ethereum Devcon1 Report (summary writing)
Ethereum Devcon1 Report (summary writing)Ethereum Devcon1 Report (summary writing)
Ethereum Devcon1 Report (summary writing)Tomoaki Sato
 
Vilnius blockchain club 20170413 consensus
Vilnius blockchain club 20170413 consensusVilnius blockchain club 20170413 consensus
Vilnius blockchain club 20170413 consensusAudrius Ramoska
 
An introduction to blockchain and hyperledger v ru
An introduction to blockchain and hyperledger v ruAn introduction to blockchain and hyperledger v ru
An introduction to blockchain and hyperledger v ruLennartF
 
Introduction to Blockchain and Smart Contracts
Introduction to Blockchain and Smart ContractsIntroduction to Blockchain and Smart Contracts
Introduction to Blockchain and Smart ContractsSaad Zaher
 
DWeb and Civil Society: An Introduction For Makers
DWeb and Civil Society: An Introduction For MakersDWeb and Civil Society: An Introduction For Makers
DWeb and Civil Society: An Introduction For MakersTechSoup
 
Wwc developing hyperledger applications v4
Wwc  developing hyperledger applications v4Wwc  developing hyperledger applications v4
Wwc developing hyperledger applications v4LennartF
 
BlockchainConf.tech - Hyperledger overview
BlockchainConf.tech - Hyperledger overviewBlockchainConf.tech - Hyperledger overview
BlockchainConf.tech - Hyperledger overviewPad Kankipati
 
Attacking and Exploiting Ethereum Smart Contracts: Auditing 101
Attacking and Exploiting Ethereum Smart Contracts: Auditing 101Attacking and Exploiting Ethereum Smart Contracts: Auditing 101
Attacking and Exploiting Ethereum Smart Contracts: Auditing 101Simone Onofri
 
Silicon Valley Code Camp Blockchain Oct 2017
Silicon Valley Code Camp Blockchain Oct 2017Silicon Valley Code Camp Blockchain Oct 2017
Silicon Valley Code Camp Blockchain Oct 2017Nelson Petracek
 

Similar to Fullsize Smart Contracts That Learn (20)

Blockchain Experiments 1-11.pptx
Blockchain Experiments 1-11.pptxBlockchain Experiments 1-11.pptx
Blockchain Experiments 1-11.pptx
 
Chapter 3.pptx
Chapter 3.pptxChapter 3.pptx
Chapter 3.pptx
 
How to Build Your Blockchain Project with Chainstack
How to Build Your Blockchain Project with ChainstackHow to Build Your Blockchain Project with Chainstack
How to Build Your Blockchain Project with Chainstack
 
How to design, code, deploy and execute a smart contract
How to design, code, deploy and execute a smart contractHow to design, code, deploy and execute a smart contract
How to design, code, deploy and execute a smart contract
 
Write Smart Contract with Solidity on Ethereum
Write Smart Contract with Solidity on EthereumWrite Smart Contract with Solidity on Ethereum
Write Smart Contract with Solidity on Ethereum
 
Blockchain Tech Approach Whitepaper
Blockchain Tech Approach WhitepaperBlockchain Tech Approach Whitepaper
Blockchain Tech Approach Whitepaper
 
Blockchain with HyperLedger (Public version)
Blockchain with HyperLedger (Public version)Blockchain with HyperLedger (Public version)
Blockchain with HyperLedger (Public version)
 
Block chain technology
Block chain technologyBlock chain technology
Block chain technology
 
Cryptographic Agility in Corda
Cryptographic Agility in CordaCryptographic Agility in Corda
Cryptographic Agility in Corda
 
Ethereum Devcon1 Report (summary writing)
Ethereum Devcon1 Report (summary writing)Ethereum Devcon1 Report (summary writing)
Ethereum Devcon1 Report (summary writing)
 
Block chain technology
Block chain technology Block chain technology
Block chain technology
 
Vilnius blockchain club 20170413 consensus
Vilnius blockchain club 20170413 consensusVilnius blockchain club 20170413 consensus
Vilnius blockchain club 20170413 consensus
 
Block chain
Block chainBlock chain
Block chain
 
An introduction to blockchain and hyperledger v ru
An introduction to blockchain and hyperledger v ruAn introduction to blockchain and hyperledger v ru
An introduction to blockchain and hyperledger v ru
 
Introduction to Blockchain and Smart Contracts
Introduction to Blockchain and Smart ContractsIntroduction to Blockchain and Smart Contracts
Introduction to Blockchain and Smart Contracts
 
DWeb and Civil Society: An Introduction For Makers
DWeb and Civil Society: An Introduction For MakersDWeb and Civil Society: An Introduction For Makers
DWeb and Civil Society: An Introduction For Makers
 
Wwc developing hyperledger applications v4
Wwc  developing hyperledger applications v4Wwc  developing hyperledger applications v4
Wwc developing hyperledger applications v4
 
BlockchainConf.tech - Hyperledger overview
BlockchainConf.tech - Hyperledger overviewBlockchainConf.tech - Hyperledger overview
BlockchainConf.tech - Hyperledger overview
 
Attacking and Exploiting Ethereum Smart Contracts: Auditing 101
Attacking and Exploiting Ethereum Smart Contracts: Auditing 101Attacking and Exploiting Ethereum Smart Contracts: Auditing 101
Attacking and Exploiting Ethereum Smart Contracts: Auditing 101
 
Silicon Valley Code Camp Blockchain Oct 2017
Silicon Valley Code Camp Blockchain Oct 2017Silicon Valley Code Camp Blockchain Oct 2017
Silicon Valley Code Camp Blockchain Oct 2017
 

More from Mike Slinn

Evaluating Blockchain Companies
Evaluating Blockchain CompaniesEvaluating Blockchain Companies
Evaluating Blockchain CompaniesMike Slinn
 
Dotty (Scala 3) Preview
Dotty (Scala 3) PreviewDotty (Scala 3) Preview
Dotty (Scala 3) PreviewMike Slinn
 
EmpathyWorks – Towards an Event-Based Simulation/ML Hybrid Platform
EmpathyWorks – Towards an Event-Based Simulation/ML Hybrid PlatformEmpathyWorks – Towards an Event-Based Simulation/ML Hybrid Platform
EmpathyWorks – Towards an Event-Based Simulation/ML Hybrid PlatformMike Slinn
 
Polyglot Ethereum - Smart Contracts for the Enterprise
Polyglot Ethereum - Smart Contracts for the EnterprisePolyglot Ethereum - Smart Contracts for the Enterprise
Polyglot Ethereum - Smart Contracts for the EnterpriseMike Slinn
 
Play Architecture, Implementation, Shiny Objects, and a Proposal
Play Architecture, Implementation, Shiny Objects, and a ProposalPlay Architecture, Implementation, Shiny Objects, and a Proposal
Play Architecture, Implementation, Shiny Objects, and a ProposalMike Slinn
 
Composable Futures with Akka 2.0
Composable Futures with Akka 2.0Composable Futures with Akka 2.0
Composable Futures with Akka 2.0Mike Slinn
 
Scala adoption by enterprises
Scala adoption by enterprisesScala adoption by enterprises
Scala adoption by enterprisesMike Slinn
 
Sbt, idea and eclipse
Sbt, idea and eclipseSbt, idea and eclipse
Sbt, idea and eclipseMike Slinn
 
Adobe Flash Platform for the Enterprise
Adobe Flash Platform for the EnterpriseAdobe Flash Platform for the Enterprise
Adobe Flash Platform for the EnterpriseMike Slinn
 

More from Mike Slinn (10)

Evaluating Blockchain Companies
Evaluating Blockchain CompaniesEvaluating Blockchain Companies
Evaluating Blockchain Companies
 
Dotty (Scala 3) Preview
Dotty (Scala 3) PreviewDotty (Scala 3) Preview
Dotty (Scala 3) Preview
 
EmpathyWorks – Towards an Event-Based Simulation/ML Hybrid Platform
EmpathyWorks – Towards an Event-Based Simulation/ML Hybrid PlatformEmpathyWorks – Towards an Event-Based Simulation/ML Hybrid Platform
EmpathyWorks – Towards an Event-Based Simulation/ML Hybrid Platform
 
Polyglot Ethereum - Smart Contracts for the Enterprise
Polyglot Ethereum - Smart Contracts for the EnterprisePolyglot Ethereum - Smart Contracts for the Enterprise
Polyglot Ethereum - Smart Contracts for the Enterprise
 
Play Architecture, Implementation, Shiny Objects, and a Proposal
Play Architecture, Implementation, Shiny Objects, and a ProposalPlay Architecture, Implementation, Shiny Objects, and a Proposal
Play Architecture, Implementation, Shiny Objects, and a Proposal
 
Composable Futures with Akka 2.0
Composable Futures with Akka 2.0Composable Futures with Akka 2.0
Composable Futures with Akka 2.0
 
Scala adoption by enterprises
Scala adoption by enterprisesScala adoption by enterprises
Scala adoption by enterprises
 
Sbt, idea and eclipse
Sbt, idea and eclipseSbt, idea and eclipse
Sbt, idea and eclipse
 
Hanuman
HanumanHanuman
Hanuman
 
Adobe Flash Platform for the Enterprise
Adobe Flash Platform for the EnterpriseAdobe Flash Platform for the Enterprise
Adobe Flash Platform for the Enterprise
 

Recently uploaded

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 

Recently uploaded (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 

Fullsize Smart Contracts That Learn

  • 1. Smart Contracts that Learn (Extended Version) Mike Slinn June 29, 2018 IBM Ottawa
  • 2. About Mike Slinn • Distinguished engineer • Contributor to Ethereum Java and Scala libraries • Operates ScalaCourses.com • Author of EmpathyWorks (artificial personality) • Expert witness • Twitter: mslinn
  • 3. Key Facts about Mike Slinn • Focuses on generating business value by applying people, process and technology • Wrote 3 books on distributed computing • Created hundreds of online lectures on advanced computing concepts • Uses many computer languages (“polyglot”)
  • 5. The most popular language or framework used to write smart contracts in 10 years probably has not been conceived of yet. -- Mike Slinn, March 3, 2018 --
  • 6. Machine Learning & Smart Contracts • Machine learning (ML) will be commonly used with smart contracts in 10 years. • Highly specialized languages will evolve to define and verify contracts in various industries. • ML will have features added to guarantee deterministic results for decentralized apps. • Security will surely have to improve
  • 7. Espionage • In 10 years time corporate and nation/state espionage will include: o Sabotaging training data o Spoofing smart contract events o Seeding smart contract templates with security weaknesses o … and lots more …
  • 9. Dogma and ideology are not good for business Dial Back the Koolaid
  • 10. Confession On-chain smart contracts cannot actually learn However, these can learn: • User interfaces for on-chain distributed applications (ĐApps) • Oracles • Gateway contracts • Off-chain smart contracts (systems integrated via json- rpc, IPC and other mechanisms)
  • 12. Beware Non-Deterministic Behavior • Blockchain requires determinism for consensus • A ML-driven product may not have deterministic behavior and may produce counter-intuitive results • A personalized recommender system may produce different results for a user action after learning additional preferences
  • 13. ML is Done Offchain ML is currently centralized offchain, because significant computation and storage are required • Centralized, offchain processes can respond to onchain events and initiate activity via json-rpc or IPC to Ethereum clients • ML likely not decentralized for several years
  • 14. ‘(De)centralization’ is Misleading • Decentralization uses consensus before output is accepted from multiple EVMs, which then leads to transactions. • Centralization does not use consensus; note that the web3 definition of centralization includes federated systems and distributed applications that employ DNS with geolocation routing and failover.
  • 15. Centralization • Architectural (de)centralization  • Political (de)centralization  • Logical (de)centralization
  • 16. Logical Clocks • Distributed systems experience Einstein’s relativistic effects due to the limitation of the speed of light • If ML systems were enhanced to incorporate logical clocks to associate the learned state at arbitrary global timestamp values they could become deterministic.
  • 17. Security Issues • Discussion later in this talk o Features/Complexity versus Security o Solidity is misnamed
  • 18. Dogma Is Bad For Business • The degree of centralization is mostly a business decision • System integration strategies o ML systems can indirectly interact with the blockchain using json-rpc or IPC to an Ethereum client such as geth or Parity o Native apps can combine ML with blockchain • Solidity is suboptimal
  • 19. Issues With Solidity: • Primitive type system. • Compiler bugs (more surely exist). • Few software tools available. • Expensive to work with o Hard to hire for o Low productivity o High risk • Very expensive to maintain. • Shelf life for this technology will be short.
  • 20. Avoid Solidity If Possible • Write the smart contract in the language of your choice, and use json-rpc calls as desired. • Resulting code will be well understood by all. • Audits will be more reliable. • Costs will be much less using a common language instead of Solidity. • Talent will be much easier to find.
  • 21. Ethereum Is Not Symmetric • Onchain smart contracts are distributed and use consensus • Offchain smart contracts (using Ethereum clients) are currently centralized and so do not use consensus • This will likely evolve over the next several years
  • 22. ChainLink (1/2) • Wraps existing singleton services and presents them as a decentralized oracles • Run by a for-profit organization • See smartcontract.com
  • 23. ChainLink (2/2) • Does not address the motivations for decentralization: o Fault tolerance – single point of failure o Attack resistance o Collusion resistance • Wrapping a singleton and presenting it in a decentralized manner does not make the singleton decentralized
  • 24. Transpiling • Process of converting a program written in one language into another language. • Solidity could be transpiled to json-rpc calls from node.js and JVM languages (Java, Scala, JRuby, Jython, Groovy, etc). • … but don’t bother because you endure all the problems with Solidity and get none of the benefits of native contracts
  • 26. Self-Optimizing Contracts • Optimize transactions for greatest margin, minimal waste, constant deal flow, or other criteria • Results would improve over time • This is an onchain example
  • 27. Genetic algorithms Evolution strategies Evolutionary programming Simulated annealing Gaussian adaptation Hill climbing Swarm intelligence Integer linear programming
  • 28. Fraudulent Event Detection • Smart contracts currently act on all events • Fraud detection often employs machine learning • Incorporating ML into smart contracts could make them resistant to fraud • This is an onchain example
  • 29.
  • 30. Automated Customer Service Agents • Chatbots and voice interfaces (Alexa) • Much more natural to use • Can be built into devices • This is an onchain example
  • 32. Medical Diagnosis Expert System • Smart contract mediates access to an expert system (oracle, incorporates machine learning) • Accepts anonymous patient data • Passes data to an expert system that performs analysis • Returns diagnostic results • Charges for the service • This is an offchain example
  • 34. Supply Chain • Native application (JVM, .NET, C++, whatever) uses json-rpc to interact with the blockchain • Solidity is not required • This is an offchain example
  • 37. Traditional Contracts… • Outline the terms of a relationship • According to a specific jurisdiction • So that the specified government can enforce the terms
  • 38. Smart Contracts… • Enable rule-based autonomous actions in response to events. • Work within and between organizations and the rest of society, world-wide.
  • 39. Smart Contracts Threaten Tradition • Enforce a relationship with cryptographic code • Without regard to the jurisdiction of any government
  • 40. Smart Contracts … • Also known as cryptocontracts • Are computer programs • Directly control the transfer of blockchain-based digital currencies or assets • Define the rules and penalties for an agreement • Might automatically enforce those obligations
  • 41. System Integration • Collecting inputs and outputs to smart contracts requires system integration. • Approaches vary according to input sources, output destinations, volumes of data, required reliability, fairness (near-constant latency), etc. • Beware of introducing single points of failure
  • 42. Smart Contract Capabilities Manage relationship between parties by: • Maintaining virtual ledgers • Reading/writing arbitrary on-chain data • Reading/writing off-chain data • Forwarding events to other contracts • Acting as a software library
  • 43. Smart Contract Requirements • Observability • Verifiability • Privity • Enforceability
  • 44. Oracles • Smart contracts need oracles to resolve details that cannot be precisely known at the time the contract is written. • Oracles provide reference information for smart contracts. • An oracle is usually a (singleton) REST API connected to a data source. • Using oracles generally decreases security
  • 45. Smart Contract Platforms • Bitcoin • Cardano (eventually) • DFinity • EOSIO • Ethereum • Hyperledger • Lisk • Pact on Kadena • NEO • Quorum • Qtum • RSK • Stratis • Wanchain
  • 46. Ethereum Virtual Machine (EVM) • Deterministic. • Each Ethereum node has an EVM instance. • EVM has a similar execution model to both the Java and the .NET virtual machines. • All these VMs are stack machines executing bytecode. • EVM adds storage and its bytecode is somewhat more suited for contracts.
  • 47. Interesting Smart Contract Languages All compile to EVM byte code except Chaincode • AxLang • Chaincode (Hyperledger) • LLL • Pact (Kadena) • Solidity
  • 49. Solidity • Solidity contracts are difficult to secure. • Formal verification could help. • Most Solidity contracts ignore security recommendations. • Solidity’s support for types is rather primitive.
  • 50. Solidity and Security • Contracts written in Solidity are difficult to make secure. o Formal verification could help. • Solidity’s support for types is primitive
  • 53. AxLang • Smart contract language designed to support formal verification. • Cross-compiled Scala DSL for Ethereum • Designed to scale • Not yet ready
  • 54. Pact / Kadena • Functional, interpreted Lisp-like syntax • Features type inference • Similar to database stored procedures in an online transaction processing (OLTP) system • Not Turing complete • Runs on the Kadena blockchain
  • 56. json-rpc • Popular communications protocol • Communicates between off-chain applications and their Ethereum clients
  • 57. Some json-rpc Libraries • web3.js – for node.js o Can also transpile Solidity to JavaScript • web3j – for Java • Can also transpile Solidity to Java • web3j-scala – for Scala o (I wrote this one) o Idiomatic Scala wrapper around web3j
  • 59. How do Computers Learn? • Trial and error with feedback • Training
  • 60. Types of Machine Learning Classifier systems Reinforcement Representation Rule-based Similarity and metric Sparse dictionary Support vector machines Association rule Artificial neural networks Bayesian networks Clustering Decision tree Deep Genetic algorithms Inductive logic programming
  • 61. How Might Smart Contracts Learn? • “Learning” computation must occur off-chain • Enforced by the Ethereum fee structure
  • 62. Machine Learning Applications Machine perception, including computer vision and object recognition Optimization and metaheuristic Recommendation systems Robot locomotion (autonomy) Sentiment analysis Speech and handwriting recognition Structural health monitoring Syntactic pattern recognition User behavior analytics Translation Automated theorem proving Adaptive websites Bioinformatics Classifying DNA sequences Detecting credit-card fraud General game playing Information retrieval Internet fraud detection Insurance Linguistics Medical diagnosis
  • 65. Security Cannot Be Retrofitted • Secure systems can only be designed that way from the start o Trying to secure an existing platform can only give marginal improvements • Need orders of magnitude of improvements to smart contract security o Not possible without a fresh start