SlideShare a Scribd company logo
EWASM VM - 次世代的
Ethereum Virtual Machine
@hydai
2019/08/17
hydai
Blog: hyd.ai
Mail: hydai@hyd.ai
GitHub: @hydai
Work: @SecondState
Focus on Compiler and Virtual
Machine technology.
– Eth1x/Istanbul meetup Berlin
Save Ethereum,
Scale Ethereum.
EVM recap
• Stack-based virtual machine (or interpreter…)
• 256 bit stack items
• Too many high level instructions
• Storage(SSTORE, SLOAD)
• SHA3(keccak-256)
• Call, Create Contract…
• Too far away from actual machine architecture
• Less language support (Vyper, Solidity)
How about wasm?
• Also, a stack-based machine but…
• has locals ( ~= register or memory)
• only access top 3 items from stack v.s EVM’s 16
• Support 32/64 bit operations
• No high level instructions
• RISC Instruction Set, can map to a common CPU ISA
• Large community power
• Supported in all major browser
• Lots of implementations
• Lots of language support (C++, Rust, …)
wasm engine
• Tool
• binaryen (a toolkit contains an interpreter in C++)
• wabt (a toolkit contains an interpreter in C++)
• wavm (LLVM-based JIT)
• wagon (interpreter in Golang)
• parity-wasm (interpreter in Rust)
• Browser (hyper interpreter/JIT)
• Chrome (V8)
• Edge (chakra)
• Firefox (spidermonkey)
What is ewasm?
• ewasm ⊂ wasm
• NOT support floating point number
• LIMITED imports and exports (wasm section)
• Will inject bytecode metering and has runtime
metering
Where did the high level
instructions go?
Ethereum Environment Interface
• EEI defines a set of ewasm imported functions
• With standard interface, clients can implement
easier
• Because EEI is not native instructions in bytecode
• Quick prototyping and doing specific upgrades
ewasm module EEI blockchain
Definition
Use
How about
Invalid instructions issues?
System Contract
• Compiled into wasm bytecode
• Deployed on chain (like normal contract)
• Or be part of client (like precompiles)
• Examples:
• Byzantium precompiles
• sha256, ripemd160, ecrecover, modexp, …
• Use upper-bound metering
• Sentinel (verification and metering)
Sentinel Contract?
• Before contract deployment
• Reject non-ewasm bytecode (e.g. floating point)
• Insert metering statements
• basic-block-based metering (call useGas in the beginning
of block)
ewasm
bytecode
Sentinel
deployed
on chain
ewasm stack
Client
with EVM-C support
EVM-C
Heru
Wasm Engine in C++
EEI
Runtime
ewasm
bytecode
Sentinel
EVM-C
• Connect client and VM implementation
• Ethereum Virtual Machine includes EVM1 and eWASM
• With EVM-C, VM can be linked statically or loaded
as plugin (.dll, .so)
• C means C language API
wasm sections
src: https://rsms.me/wasm-intro
wasm engine
ewasm
bytecode
Parse
ewasm
module
Validate
validated
ewasm module
Instantiate
ewasm
module
instance
Execute
Is ewasm a panacea for
ethereum?
Calm Down
Issue 1 - Storage Model
• eWASM = EVM 1.0 mirrored in wasm
• Storage model is not compatible with rent
• Here comes eWASM 1.X!!!
• New storage model designed for rent!!!
Issue 2 - Performance
Is eWASM always better than EVM1?
What happens?!!!!!
• General wasm engine supports 32/64 bit operations
• 128/256 bit operations will be simulated by 32/64
bit operations
• EVM has the precompiles……
Issue 3 - Metering
• Basic block metering
• Super block metering
• Upper bound metering
Basic Block Metering
Super Block Metering
Q & A
Reference
• ewasm for sharding
• https://drive.google.com/file/d/19t4qCqEK2RPt0p1XYx-
a2FdZSAlCq7H0/view
• ewasm updates
• https://drive.google.com/file/d/
1CRc0qBQTebNKw7NRZXzxbHovrigW0bqf/view
• ewasm design
• https://github.com/ewasm/design
• EEI
• https://github.com/ewasm/design/blob/master/eth_interface.md
• wasm-intro
• https://rsms.me/wasm-intro

More Related Content

What's hot

E1000 is faster than VMXNET3
E1000 is faster than VMXNET3E1000 is faster than VMXNET3
E1000 is faster than VMXNET3
Eric Sloof
 
Phpconf 2013 - Agile Telephony Applications with PAMI and PAGI
Phpconf 2013 - Agile Telephony Applications with PAMI and PAGIPhpconf 2013 - Agile Telephony Applications with PAMI and PAGI
Phpconf 2013 - Agile Telephony Applications with PAMI and PAGI
Marcelo Gornstein
 
Socket.IO
Socket.IOSocket.IO
Socket.IO
Davide Pedranz
 
Introduce warden
Introduce wardenIntroduce warden
Introduce warden
Hieu Nguyen Trung
 
Tomcat openssl
Tomcat opensslTomcat openssl
Tomcat openssl
Jean-Frederic Clere
 
y3dips hacking priv8 network
y3dips hacking priv8 networky3dips hacking priv8 network
y3dips hacking priv8 network
idsecconf
 
Tomcat openssl
Tomcat opensslTomcat openssl
Tomcat openssl
Jean-Frederic Clere
 
DDD Melbourne 2014 security in ASP.Net Web API 2
DDD Melbourne 2014 security in ASP.Net Web API 2DDD Melbourne 2014 security in ASP.Net Web API 2
DDD Melbourne 2014 security in ASP.Net Web API 2
Pratik Khasnabis
 
Advanced Seaside
Advanced SeasideAdvanced Seaside
Advanced Seaside
ESUG
 
Securing Microservices using Play and Akka HTTP
Securing Microservices using Play and Akka HTTPSecuring Microservices using Play and Akka HTTP
Securing Microservices using Play and Akka HTTP
Rafal Gancarz
 

What's hot (10)

E1000 is faster than VMXNET3
E1000 is faster than VMXNET3E1000 is faster than VMXNET3
E1000 is faster than VMXNET3
 
Phpconf 2013 - Agile Telephony Applications with PAMI and PAGI
Phpconf 2013 - Agile Telephony Applications with PAMI and PAGIPhpconf 2013 - Agile Telephony Applications with PAMI and PAGI
Phpconf 2013 - Agile Telephony Applications with PAMI and PAGI
 
Socket.IO
Socket.IOSocket.IO
Socket.IO
 
Introduce warden
Introduce wardenIntroduce warden
Introduce warden
 
Tomcat openssl
Tomcat opensslTomcat openssl
Tomcat openssl
 
y3dips hacking priv8 network
y3dips hacking priv8 networky3dips hacking priv8 network
y3dips hacking priv8 network
 
Tomcat openssl
Tomcat opensslTomcat openssl
Tomcat openssl
 
DDD Melbourne 2014 security in ASP.Net Web API 2
DDD Melbourne 2014 security in ASP.Net Web API 2DDD Melbourne 2014 security in ASP.Net Web API 2
DDD Melbourne 2014 security in ASP.Net Web API 2
 
Advanced Seaside
Advanced SeasideAdvanced Seaside
Advanced Seaside
 
Securing Microservices using Play and Akka HTTP
Securing Microservices using Play and Akka HTTPSecuring Microservices using Play and Akka HTTP
Securing Microservices using Play and Akka HTTP
 

Similar to Introduction to ewasm

Introduction to Ewasm - crosslink taipei 2019
Introduction to Ewasm - crosslink taipei 2019Introduction to Ewasm - crosslink taipei 2019
Introduction to Ewasm - crosslink taipei 2019
hydai
 
State of virtualisation -- 2012
State of virtualisation -- 2012State of virtualisation -- 2012
State of virtualisation -- 2012
Jonathan Sinclair
 
AMC & VPX Form Factor Boards With High Speed SERDES: Embedded World 2010
AMC & VPX Form Factor Boards With High Speed SERDES: Embedded World 2010AMC & VPX Form Factor Boards With High Speed SERDES: Embedded World 2010
AMC & VPX Form Factor Boards With High Speed SERDES: Embedded World 2010
Altera Corporation
 
CloudStack - LinuxFest NorthWest
CloudStack - LinuxFest NorthWestCloudStack - LinuxFest NorthWest
CloudStack - LinuxFest NorthWest
ke4qqq
 
What's new in System Center 2012 R2: Virtual Machine Manager
What's new in System Center 2012 R2: Virtual Machine ManagerWhat's new in System Center 2012 R2: Virtual Machine Manager
What's new in System Center 2012 R2: Virtual Machine Manager
Tomica Kaniski
 
The Quest for the Perfect API
The Quest for the Perfect APIThe Quest for the Perfect API
The Quest for the Perfect API
microkerneldude
 
ZaloPay Merchant Platform on K8S on-premise
ZaloPay Merchant Platform on K8S on-premiseZaloPay Merchant Platform on K8S on-premise
ZaloPay Merchant Platform on K8S on-premise
Chau Thanh
 
Getting Started with Apache CloudStack
Getting Started with Apache CloudStackGetting Started with Apache CloudStack
Getting Started with Apache CloudStack
Joe Brockmeier
 
Vulnerabilities on Various Data Processing Levels
Vulnerabilities on Various Data Processing LevelsVulnerabilities on Various Data Processing Levels
Vulnerabilities on Various Data Processing Levels
Positive Hack Days
 
Lecture 1-vs.pptx.......................
Lecture 1-vs.pptx.......................Lecture 1-vs.pptx.......................
Lecture 1-vs.pptx.......................
HassamShahid2
 
stackconf 2020 | Replace your Docker based Containers with Cri-o Kata Contain...
stackconf 2020 | Replace your Docker based Containers with Cri-o Kata Contain...stackconf 2020 | Replace your Docker based Containers with Cri-o Kata Contain...
stackconf 2020 | Replace your Docker based Containers with Cri-o Kata Contain...
NETWAYS
 
Unikernels: Rise of the Library Hypervisor
Unikernels: Rise of the Library HypervisorUnikernels: Rise of the Library Hypervisor
Unikernels: Rise of the Library Hypervisor
Anil Madhavapeddy
 
OpenStack and Windows
OpenStack and WindowsOpenStack and Windows
OpenStack and Windows
Alessandro Pilotti
 
Vulnerabilities in data processing levels
Vulnerabilities in data processing levelsVulnerabilities in data processing levels
Vulnerabilities in data processing levels
beched
 
Virtualization 101 - DeepDive
Virtualization 101 - DeepDiveVirtualization 101 - DeepDive
Virtualization 101 - DeepDive
Amit Agarwal
 
Txlf2012
Txlf2012Txlf2012
Txlf2012
Joe Brockmeier
 
Web (dis)assembly
Web (dis)assemblyWeb (dis)assembly
Web (dis)assembly
Shakacon
 
elfconv: AOT compiler that translates Linux/AArch64 ELF binary to LLVM bitcod...
elfconv: AOT compiler that translates Linux/AArch64 ELF binary to LLVM bitcod...elfconv: AOT compiler that translates Linux/AArch64 ELF binary to LLVM bitcod...
elfconv: AOT compiler that translates Linux/AArch64 ELF binary to LLVM bitcod...
Masashi Yoshimura
 
Unikernels: the rise of the library hypervisor in MirageOS
Unikernels: the rise of the library hypervisor in MirageOSUnikernels: the rise of the library hypervisor in MirageOS
Unikernels: the rise of the library hypervisor in MirageOS
Docker, Inc.
 
XPDS16: Hypervisor-based Security: Vicarious Learning via Introspektioneerin...
XPDS16:  Hypervisor-based Security: Vicarious Learning via Introspektioneerin...XPDS16:  Hypervisor-based Security: Vicarious Learning via Introspektioneerin...
XPDS16: Hypervisor-based Security: Vicarious Learning via Introspektioneerin...
The Linux Foundation
 

Similar to Introduction to ewasm (20)

Introduction to Ewasm - crosslink taipei 2019
Introduction to Ewasm - crosslink taipei 2019Introduction to Ewasm - crosslink taipei 2019
Introduction to Ewasm - crosslink taipei 2019
 
State of virtualisation -- 2012
State of virtualisation -- 2012State of virtualisation -- 2012
State of virtualisation -- 2012
 
AMC & VPX Form Factor Boards With High Speed SERDES: Embedded World 2010
AMC & VPX Form Factor Boards With High Speed SERDES: Embedded World 2010AMC & VPX Form Factor Boards With High Speed SERDES: Embedded World 2010
AMC & VPX Form Factor Boards With High Speed SERDES: Embedded World 2010
 
CloudStack - LinuxFest NorthWest
CloudStack - LinuxFest NorthWestCloudStack - LinuxFest NorthWest
CloudStack - LinuxFest NorthWest
 
What's new in System Center 2012 R2: Virtual Machine Manager
What's new in System Center 2012 R2: Virtual Machine ManagerWhat's new in System Center 2012 R2: Virtual Machine Manager
What's new in System Center 2012 R2: Virtual Machine Manager
 
The Quest for the Perfect API
The Quest for the Perfect APIThe Quest for the Perfect API
The Quest for the Perfect API
 
ZaloPay Merchant Platform on K8S on-premise
ZaloPay Merchant Platform on K8S on-premiseZaloPay Merchant Platform on K8S on-premise
ZaloPay Merchant Platform on K8S on-premise
 
Getting Started with Apache CloudStack
Getting Started with Apache CloudStackGetting Started with Apache CloudStack
Getting Started with Apache CloudStack
 
Vulnerabilities on Various Data Processing Levels
Vulnerabilities on Various Data Processing LevelsVulnerabilities on Various Data Processing Levels
Vulnerabilities on Various Data Processing Levels
 
Lecture 1-vs.pptx.......................
Lecture 1-vs.pptx.......................Lecture 1-vs.pptx.......................
Lecture 1-vs.pptx.......................
 
stackconf 2020 | Replace your Docker based Containers with Cri-o Kata Contain...
stackconf 2020 | Replace your Docker based Containers with Cri-o Kata Contain...stackconf 2020 | Replace your Docker based Containers with Cri-o Kata Contain...
stackconf 2020 | Replace your Docker based Containers with Cri-o Kata Contain...
 
Unikernels: Rise of the Library Hypervisor
Unikernels: Rise of the Library HypervisorUnikernels: Rise of the Library Hypervisor
Unikernels: Rise of the Library Hypervisor
 
OpenStack and Windows
OpenStack and WindowsOpenStack and Windows
OpenStack and Windows
 
Vulnerabilities in data processing levels
Vulnerabilities in data processing levelsVulnerabilities in data processing levels
Vulnerabilities in data processing levels
 
Virtualization 101 - DeepDive
Virtualization 101 - DeepDiveVirtualization 101 - DeepDive
Virtualization 101 - DeepDive
 
Txlf2012
Txlf2012Txlf2012
Txlf2012
 
Web (dis)assembly
Web (dis)assemblyWeb (dis)assembly
Web (dis)assembly
 
elfconv: AOT compiler that translates Linux/AArch64 ELF binary to LLVM bitcod...
elfconv: AOT compiler that translates Linux/AArch64 ELF binary to LLVM bitcod...elfconv: AOT compiler that translates Linux/AArch64 ELF binary to LLVM bitcod...
elfconv: AOT compiler that translates Linux/AArch64 ELF binary to LLVM bitcod...
 
Unikernels: the rise of the library hypervisor in MirageOS
Unikernels: the rise of the library hypervisor in MirageOSUnikernels: the rise of the library hypervisor in MirageOS
Unikernels: the rise of the library hypervisor in MirageOS
 
XPDS16: Hypervisor-based Security: Vicarious Learning via Introspektioneerin...
XPDS16:  Hypervisor-based Security: Vicarious Learning via Introspektioneerin...XPDS16:  Hypervisor-based Security: Vicarious Learning via Introspektioneerin...
XPDS16: Hypervisor-based Security: Vicarious Learning via Introspektioneerin...
 

Recently uploaded

Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
Zilliz
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 

Recently uploaded (20)

Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 

Introduction to ewasm

  • 1. EWASM VM - 次世代的 Ethereum Virtual Machine @hydai 2019/08/17
  • 2. hydai Blog: hyd.ai Mail: hydai@hyd.ai GitHub: @hydai Work: @SecondState Focus on Compiler and Virtual Machine technology.
  • 3. – Eth1x/Istanbul meetup Berlin Save Ethereum, Scale Ethereum.
  • 4. EVM recap • Stack-based virtual machine (or interpreter…) • 256 bit stack items • Too many high level instructions • Storage(SSTORE, SLOAD) • SHA3(keccak-256) • Call, Create Contract… • Too far away from actual machine architecture • Less language support (Vyper, Solidity)
  • 5. How about wasm? • Also, a stack-based machine but… • has locals ( ~= register or memory) • only access top 3 items from stack v.s EVM’s 16 • Support 32/64 bit operations • No high level instructions • RISC Instruction Set, can map to a common CPU ISA • Large community power • Supported in all major browser • Lots of implementations • Lots of language support (C++, Rust, …)
  • 6. wasm engine • Tool • binaryen (a toolkit contains an interpreter in C++) • wabt (a toolkit contains an interpreter in C++) • wavm (LLVM-based JIT) • wagon (interpreter in Golang) • parity-wasm (interpreter in Rust) • Browser (hyper interpreter/JIT) • Chrome (V8) • Edge (chakra) • Firefox (spidermonkey)
  • 7. What is ewasm? • ewasm ⊂ wasm • NOT support floating point number • LIMITED imports and exports (wasm section) • Will inject bytecode metering and has runtime metering
  • 8. Where did the high level instructions go?
  • 9. Ethereum Environment Interface • EEI defines a set of ewasm imported functions • With standard interface, clients can implement easier • Because EEI is not native instructions in bytecode • Quick prototyping and doing specific upgrades ewasm module EEI blockchain
  • 12. System Contract • Compiled into wasm bytecode • Deployed on chain (like normal contract) • Or be part of client (like precompiles) • Examples: • Byzantium precompiles • sha256, ripemd160, ecrecover, modexp, … • Use upper-bound metering • Sentinel (verification and metering)
  • 13. Sentinel Contract? • Before contract deployment • Reject non-ewasm bytecode (e.g. floating point) • Insert metering statements • basic-block-based metering (call useGas in the beginning of block) ewasm bytecode Sentinel deployed on chain
  • 15. Client with EVM-C support EVM-C Heru Wasm Engine in C++ EEI Runtime ewasm bytecode Sentinel
  • 16. EVM-C • Connect client and VM implementation • Ethereum Virtual Machine includes EVM1 and eWASM • With EVM-C, VM can be linked statically or loaded as plugin (.dll, .so) • C means C language API
  • 19. Is ewasm a panacea for ethereum?
  • 21. Issue 1 - Storage Model • eWASM = EVM 1.0 mirrored in wasm • Storage model is not compatible with rent • Here comes eWASM 1.X!!! • New storage model designed for rent!!!
  • 22. Issue 2 - Performance Is eWASM always better than EVM1?
  • 23.
  • 24.
  • 25.
  • 26. What happens?!!!!! • General wasm engine supports 32/64 bit operations • 128/256 bit operations will be simulated by 32/64 bit operations • EVM has the precompiles……
  • 27. Issue 3 - Metering • Basic block metering • Super block metering • Upper bound metering
  • 30.
  • 31. Q & A
  • 32. Reference • ewasm for sharding • https://drive.google.com/file/d/19t4qCqEK2RPt0p1XYx- a2FdZSAlCq7H0/view • ewasm updates • https://drive.google.com/file/d/ 1CRc0qBQTebNKw7NRZXzxbHovrigW0bqf/view • ewasm design • https://github.com/ewasm/design • EEI • https://github.com/ewasm/design/blob/master/eth_interface.md • wasm-intro • https://rsms.me/wasm-intro