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

      This note has no invitees

    • Publish Note

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

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

    This note has no invitees

  • Publish Note

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

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Toward an Extensible Blockchain Martin Becze github.com/wanderer Alex Beregszaszi github.com/axic [comment]: # (this talk will give an overview of ewasm) --- ## Evolution of the web 1. HTML as a markup<!-- .element: class="fragment" data-fragment-index="0" --> 2. Scripting languages: Javascript with high level methods<!-- .element: class="fragment" data-fragment-index="1" --> 3. Browser plugins: for CPU intensive operations, such as Java and Flash<!-- .element: class="fragment" data-fragment-index="2" --> 4. HTML5: implementing what browser plugins do natively in the browser (video/audio input/output, etc.)<!-- .element: class="fragment" data-fragment-index="3" --> 5. ?<!-- .element: class="fragment" data-fragment-index="4" --> --- ## The Extensible Web Manifesto - See extensiblewebmanifesto.org<!-- .element: class="fragment" data-fragment-index="0" --> - Focus on adding new low-level capabilities to the web platform that are secure and efficient.<!-- .element: class="fragment" data-fragment-index="1" --> - Expose low-level capabilities that explain existing features<!-- .element: class="fragment" data-fragment-index="2" --> - Develop, describe and test new high-level features in terms of the low-level capabilites <!-- .element: class="fragment" data-fragment-index="3" --> --- ## The Extensible Web Manifesto - Contain new security surface area.<!-- .element: class="fragment" data-fragment-index="0" --> - Reduce the rate of growth in complexity, and therefore bugs, in implementations.<!-- .element: class="fragment" data-fragment-index="1" --> - Allow browser vendors and library authors to iterate on libraries that provide developer-friendly, high-level APIs.<!-- .element: class="fragment" data-fragment-index="2" --> --- ## The Extensible Web Manifesto - WebAssembly (wasm) - Canvas - WebGL - simd.js --- ## Useful Generalities A generality in software development is axiom or low level feature that can be used to implement two or more desired high level features<!-- .element: class="fragment" data-fragment-index="0" --> You know you have a useful generality when axiom or set of axiom not only encompasses the desired high level features but also reduces implementation complexity <!-- .element: class="fragment" data-fragment-index="1" --> --- ## Evolution of the blockchain 1. Bitcoin (scripting restricted early on) <!-- .element: class="fragment" data-fragment-index="0" --> 2. Namecoin and OP_RETURN usage <!-- .element: class="fragment" data-fragment-index="1" --> 3. Ethereum <!-- .element: class="fragment" data-fragment-index="2" --> 4. Ethereum Precompiles <!-- .element: class="fragment" data-fragment-index="3" --> 5. ? <!-- .element: class="fragment" data-fragment-index="4" --> --- ## The Extensible Blockchain? - New capabilities require hardforks <!-- .element: class="fragment" data-fragment-index="0" --> - Strong incentive against expanding the trusted computing base <!-- .element: class="fragment" data-fragment-index="1" --> - Hard to iterate on features <!-- .element: class="fragment" data-fragment-index="2" --> --- ## What we face today ![](https://docs.google.com/drawings/d/1zUNIkJgooMP0jVbasWVUGKXgA-BRi7F5ANuNC3AKP_U/pub?w=787&h=359) --- ## What we face today - Precompiles - Potential new precompiles in Metropolis (hard fork): <!-- .element: class="fragment" data-fragment-index="0" --> - Elliptic curve arithmetic <!-- .element: class="fragment" data-fragment-index="0" --> - Big number arithmetic (modexp) <!-- .element: class="fragment" data-fragment-index="0" --> - Elliptic curve pairing functions <!-- .element: class="fragment" data-fragment-index="0" --> - Later hard forks: <!-- .element: class="fragment" data-fragment-index="1" --> - Blake2 <!-- .element: class="fragment" data-fragment-index="1" --> - SHA1 <!-- .element: class="fragment" data-fragment-index="1" --> - Also SHA3 as an instruction and not as a precompile <!-- .element: class="fragment" data-fragment-index="2" --> --- ## What we face today - IPC - Current IPC methods: - CALL - CALLDELEGATE - CALLCODE - Upcoming new IPC methods: - CALL_STATIC - CALL_PURE --- ## What we face today - Inextensible VM - State & environment operations: - BLOCKHASH - SELFDESTRUCT - BALANCE - ORIGIN - CALLER - CALLVALUE - CALLDATALOAD - CALLDATASIZE - etc. --- ## What we face today - Calculations - Current arithmetics: <!-- .element: class="fragment" data-fragment-index="0" --> - only 256 bit wide operations <!-- .element: class="fragment" data-fragment-index="0" --> - no shift operations <!-- .element: class="fragment" data-fragment-index="0" --> - Upcoming arithmetics: <!-- .element: class="fragment" data-fragment-index="1" --> - additional 64 bit wide operations <!-- .element: class="fragment" data-fragment-index="1" --> - shift operations <!-- .element: class="fragment" data-fragment-index="1" --> - additional SIMD operations <!-- .element: class="fragment" data-fragment-index="1" --> --- ## What we face today - Interpolarity - Incompatible with the ecosystem outside of Ethereum <!-- .element: class="fragment" data-fragment-index="0" --> - It is a new compilation target for programming languages <!-- .element: class="fragment" data-fragment-index="1" --> --- ## What we face today Big Trusted Computing bases are really bad for symmetric computation platform --- ## Ze future ![](https://docs.google.com/drawings/d/1AOV5J2tKJjh_KXnkozmv7eZbpbwM68-kYC6fYbWryCw/pub?w=960&h=720) --- ## Waist Thin ![](https://docs.google.com/drawings/d/1sXkSbMx-f2OYKEHXJFLSCQPXapZvN4U6qpxrXwZM9ug/pub?w=951&h=591) --- ## Risk of becoming a Big Ball of Mud ![](https://docs.google.com/drawings/d/178bK7ooePlnMP1U8mEnIh1yz_bWJmkFAsbrsMaqUIic/pub?w=653&h=544) Footnote: Interesting read "Big Ball of Mud" on Wikipedia. --- ## Modular Ethereum ![](https://docs.google.com/drawings/d/1f87beiJ7VakT9ififzN0f_NMO6UAOTdmDPSBioVXato/pub?w=653&h=544) --- ## Modular Ethereum ![](https://docs.google.com/drawings/d/1yquesWIOFG_sTMYypVMZsO2GbfhQy4uKRRCJD6as9EY/pub?w=653&h=544) --- ## Low Level Primitives - RISC VM (like WebAssembly) <!-- .element: class="fragment" data-fragment-index="0" --> - Non-atomic messaging <!-- .element: class="fragment" data-fragment-index="1" --> - Filesystem like model for I/O (and create State Trie on top of it)<!-- .element: class="fragment" data-fragment-index="2" --> - Microkernel for IPC management <!-- .element: class="fragment" data-fragment-index="3" --> --- ## Why do we need it? - We don't need C, you can do it all Assembly! <!-- .element: class="fragment" data-fragment-index="0" --> - We don't need Java/Python/Ruby, you can do it all in C! <!-- .element: class="fragment" data-fragment-index="1" --> - 640K is more memory than anyone will ever need - Bill Gates <!-- .element: class="fragment" data-fragment-index="2" --> - Give me any ethereum use-case & I'll tell you how to do it with bitcoin. - Paul Sztorc <!-- .element: class="fragment" data-fragment-index="3" --> --- ## Why do we need it? ![](https://upload.wikimedia.org/wikipedia/commons/0/00/Transistor_Count_and_Moore%27s_Law_-_2011.svg) --- ## Can there be a better way? --- ## What is WebAssembly? > WebAssembly or wasm is a new, portable, size- and load-time-efficient binary format that aims to execute at native speed by taking advantage of common hardware capabilities available on a wide range of platforms. --- ## What is WebAssembly? - Fast & Efficient <!-- .element: class="fragment" data-fragment-index="1" --> - Secure Sandbox <!-- .element: class="fragment" data-fragment-index="2" --> - Toolchain Compatibility <!-- .element: class="fragment" data-fragment-index="3" --> - Extensible <!-- .element: class="fragment" data-fragment-index="4" --> --- ### W3C Working Group www.w3.org/community/webassembly - Participants (660) <!-- .element: class="fragment" data-fragment-index="1" --> - Mozilla <!-- .element: class="fragment" data-fragment-index="2" --> - Google <!-- .element: class="fragment" data-fragment-index="3" --> - Microsoft <!-- .element: class="fragment" data-fragment-index="4" --> - Apple <!-- .element: class="fragment" data-fragment-index="5" --> --- ### Instruction Set - RISC like <!-- .element: class="fragment" data-fragment-index="1" --> - Integer and floating point operations <!-- .element: class="fragment" data-fragment-index="2" --> - Defined as an annotated stack machine <!-- .element: class="fragment" data-fragment-index="3" --> - can be easily processed - can be easily transformed - can be interpreted with a Stack Machine - or JITed --- ### Assembly represented in S-Expressions ```clojure= (module (import $useGas "ethereum" "useGas" (param i32)) (memory 1) (export "memory" memory) (export "main" $main) (func $main (local $sp i32) (local $jump_dest i32) (set_local $sp (i32.const -32)) (set_local $jump_dest (i32.const -1)) (loop $done $loop (block $1 (block $0 (br_table $0 (if (i32.eq (get_local $jump_dest) (i32.const -1)) (then (i32.const 0)) (else (unreachable))))) (call_import $useGas (i32.const 6)) (if (i32.gt_s (get_local $sp) (i32.const 32672)) (then (unreachable))) (call $PUSH (i64.const 0) (i64.const 0) (i64.const 0) (i64.const 96) (get_local $sp)) (set_local $sp (i32.add (get_local $sp) (i32.const 32))) (call $PUSH (i64.const 0) (i64.const 0) (i64.const 0) (i64.const 0) (get_local $sp)) (set_local $sp (i32.add (get_local $sp) (i32.const 32))))))) ``` --- ### Semantics * Types<!-- .element: class="fragment" data-fragment-index="1" --> * i32 (i32.<instr> <args..>) * i64 (i64.<instr> <args..>) * <!-- .element: class="fragment" data-fragment-index="2" --> (i64.const 42) * <!-- .element: class="fragment" data-fragment-index="3" --> (local $a) * Memory Access <!-- .element: class="fragment" data-fragment-index="4" --> * (i64.load (i64.const 4)) * (i64.store (get_local $a) (i64.const 4)) * Arithmetics<!-- .element: class="fragment" data-fragment-index="5" --> * Conditionals <!-- .element: class="fragment" data-fragment-index="6" --> * <!-- .element: class="fragment" data-fragment-index="7" -->Calls * (call_import $useGas (i64.const 33)) --- ### Binary Encoding ``` 0061 736d 0b00 0000 0474 7970 6500 0140 0201 0101 0108 6675 6e63 7469 6f6e 0001 0002 0665 7870 6f72 7400 0100 0206 6164 6454 776f 0463 6f64 6500 0100 0014 ``` - Fast decoding <!-- .element: class="fragment" data-fragment-index="1" --> - Single pass validation <!-- .element: class="fragment" data-fragment-index="2" --> - Extensible <!-- .element: class="fragment" data-fragment-index="3" --> --- ### Binary Dissected ```python= 0000000: 0061 736d ; WASM_BINARY_MAGIC 0000004: 0b00 0000 ; WASM_BINARY_VERSION ; section "type" 0000008: 04 ; string length 0000009: 7479 7065 ; section id: "type" 000000d: 00 ; section size (guess) 000000e: 01 ; num types ; type 0 000000f: 40 ; function form 0000010: 02 ; num params 0000011: 01 ; param type 0000012: 01 ; param type 0000013: 01 ; num results 0000014: 01 ; result_type ; section "function" 0000015: 08 ; string length 0000016: 6675 6e63 7469 6f6e ; section id: "function" 000001e: 00 ; section size (guess) 000001f: 01 ; num functions 0000020: 00 ; function 0 signature index 000001e: 02 ; FIXUP section size ; section "export" 0000021: 06 ; string length 0000022: 6578 706f 7274 ; section id: "export" 0000028: 00 ; section size (guess) 0000029: 01 ; num exports 000002a: 00 ; export func index 000002b: 06 ; string length 000002c: 6164 6454 776f ; export name ; section "code" 0000032: 04 ; string length 0000033: 636f 6465 ; section id: "code" 0000037: 00 ; section size (guess) 0000038: 01 ; num functions ; function body 0 0000039: 00 ; func body size (guess) 000003a: 00 ; local decl count 000003b: 14 ; OPCODE_GET_LOCAL ``` --- ### Availability of VMs - <!-- .element: class="fragment" data-fragment-index="1" -->Chrome (chrome://flags - enable-webassembly) - <!-- .element: class="fragment" data-fragment-index="2" -->Firefox Nightly (about:config and set javascript.options.wasm to true) - <!-- .element: class="fragment" data-fragment-index="3" -->Microsoft Edge - <!-- .element: class="fragment" data-fragment-index="4" -->node.js 7.0 (--enable-wasm) - <!-- .element: class="fragment" data-fragment-index="5" -->wasm-jit-prototype (github.com/WebAssembly/wasm-jit-prototype) - <!-- .element: class="fragment" data-fragment-index="6" -->Ocaml "the spec" (github.com/WebAssembly/spec) - interpreters<!-- .element: class="fragment" data-fragment-index="7" --> - wabt (github.com/WebAssembly/wabt) - binaryen (github.com/WebAssembly/binaryen) --- ## Ethereum flavored WebAssembly `e^WASM` - A proposed replacement for EVM<!-- .element: class="fragment" data-fragment-index="1" --> - A restricted subset of WebAssembly<!-- .element: class="fragment" data-fragment-index="2" --> - No floating point operations - Defines Backwards Compatibility<!-- .element: class="fragment" data-fragment-index="3" --> - Defines Metering<!-- .element: class="fragment" data-fragment-index="4" --> - Defines an interface for interacting with the Ethereum Blockchain<!-- .element: class="fragment" data-fragment-index="5" --> --- ### EVM2WASM - Transcompiles EVM code to WebAssembly<!-- .element: class="fragment" data-fragment-index="1" --> - Can be run as a contract<!-- .element: class="fragment" data-fragment-index="2" --> - Compliant with the offical EVM tests<!-- .element: class="fragment" data-fragment-index="3" --> - Produces very fast EVM code<!-- .element: class="fragment" data-fragment-index="4" --> - ~5000 line of wasm<!-- .element: class="fragment" data-fragment-index="5" --> - ~400 line of js<!-- .element: class="fragment" data-fragment-index="6" --> --- ### EVM2WASM ![](https://i.imgur.com/KOsU7mB.png) Visit: https://ewasm.github.io/evm2wasm-frontend/dist/ --- ### Metering Injection Metering is decoupled from the VM ```flow st=>start: raw wasm e=>end: run op=>operation: Validate op2=>operation: Injection Metering cond=>condition: Yes or No? st->op->op2->e ``` --- ### Metering By Branch ![](https://i.imgur.com/axIXk25.jpg) --- ### Metering By Branch ![](https://i.imgur.com/dngglBx.jpg) --- ## Gas Cost Calculation 1) Gas cost is based on the cycle count of the instructions.<!-- .element: class="fragment" data-fragment-index="1" --> 2) "Gas cost oracle": The gas cost table is stored in a contract.<!-- .element: class="fragment" data-fragment-index="2" --> 3) SHA256 performance (of 8kb data):<!-- .element: class="fragment" data-fragment-index="3" --> - precompile cost: ~3 100<!-- .element: class="fragment" data-fragment-index="3" --> - eWASM cost: ~6 500<!-- .element: class="fragment" data-fragment-index="3" --> - EVM (Solidity) cost: ~32 000 000<!-- .element: class="fragment" data-fragment-index="3" --> - EVM (Solidity) cost (with shifts): ~1 000 000<!-- .element: class="fragment" data-fragment-index="3" --> --- ## Interfaces <!-- Transition: by now you all are experts in WebAssembly and S-expressions. Let's glue all of this together. --> *Glueing all this together* --- ### eWASM Ethereum Interface (EEI) Defines the Ethereum blockchain methods for contracts: - getCallDataSize ~ CALLDATASIZE - callDataCopy ~ CALLDATACOPY - storageLoad ~ SLOAD - storageStore ~ SSTORE - call ~ CALL - delegateCall ~ DELEGATECALL - return ~ RETURN - ... A total of 32 methods. --- ### Example: storageLoad ```clojure (call_import $storageLoad (i32.const 0) (i32.const 32)) ;; ^ key offset in memory ;; ^ result offset in memory ``` Simples. --- <!-- Transition: now it is time to wrap all these calls into an actual contract. --> ### eWASM Contract Interface (ECI) Defines the format of contracts: - WebAssembly binary encoding version 0xd - Single entry point: *main* - Sets other limitations. --- ### Example contract Drumroll: ```clojure (module (memory 1 (segment 0 "Hello World!") ) (import $return "ethereum" "return" (param i32 i32)) (export "main" $main) (func $main (call_import $return (i32.const 0) (i32.const 12)) ) ) ``` --- <!-- Transition: if we can write contract, we can also write system contracts --> ### System Contracts 1) Sentinel - ECI validation - metering injection - wrap into deployer 2) evm2wasm! <!-- .element: class="fragment" data-fragment-index="3" --> 3) EVM1 precompiled contracts <!-- .element: class="fragment" data-fragment-index="4" --> --- <!-- Transition: having system contracts simplifies the client implementation a lot --> ## VM Semantics Only 3 new rules for a client: 1) Check contract code for eWASM signature <!-- .element: class="fragment" data-fragment-index="1" --> 2) Use evm2wasm to transcompile if needed <!-- .element: class="fragment" data-fragment-index="2" --> 3) Use sentinel contract during contract creation <!-- .element: class="fragment" data-fragment-index="3" --> <!-- Note: transcompiled code is not stored in the state. --> --- ## ewasm-kernel and Hera 1) ewasm-kernel - Javascript - runs in browsers and node.js - < 1000 lines for the interface and VM core 2) Hera - C++ - *EVM-C compatible* - works with cpp-ethereum (eth --vm hera) - and pyethereum \o/ - ... and hopefully go-ethereum + parity in the future --- <!-- Transition: don't be afraid, no need to write S-expressions. Contracts can be written in C and C++. --> ## Programming in C and the precompiles *clang & ewasm-libc* --- ## Example: sha256 ```c #include "ethereum.h" #define BASE_FEE 60 #define WORD_FEE 12 void main() { size_t datasize = ethereum_calldatasize(); unsigned char data[datasize]; unsigned char ret[32] = { 0 }; ethereum_calldatacopy(data, 0, datasize); ethereum_usegas(BASE_FEE + (((datasize + 31) / 32) * WORD_FEE)); mbedtls_sha256(data, datasize, ret, 0); ethereum_return(ret, 32); } ``` --- <!-- Transition: afraid of C? Solidity! --> ## Solidity for eWASM Input: ```js contract A { function a() { throw; } function b() payable returns (uint64) { uint64 x = 42; return x; } } ``` --- ## Solidity for eWASM Output: ```clojure ;; Contract: A (module (import $callDataCopy "ethereum" "callDataCopy" (param i32 i32 i32)) (import $getCallValue "ethereum" "getCallValue" (param i32)) (import $return "ethereum" "return" (param i32)) (memory 1 1) (export "memory" memory) (export "main" $main) (func $main (call_import $callDataCopy (i32.const 0) (i32.const 0) (i32.const 4)) (call $dispatcher (i32.load (i32.const 0))) (unreachable) ) (func $ensureNotPayable (call_import $getCallValue (i32.const 0)) (if (i64.ne (i64.const 0) (i64.load (i32.const 0)) (unreachable)) (if (i64.ne (i64.const 0) (i64.load (i32.const 8)) (unreachable)) ) (func $dispatcher (param $sig i32) (if (i32.eq (get_local $sig) (i32.const 0x0dbe671f)) (then (call $__0dbe671f))) (if (i32.eq (get_local $sig) (i32.const 0x4df7e3d0)) (then (call $__4df7e3d0))) (unreachable) ) ;; function: a() (func $__0dbe671f (call $ensureNotPayable) (block (unreachable) ) ) ;; function: b() payable (func $__4df7e3d0 (block (local $x (param i64)) (set_local $x (i64.const 42)) (i64.store (i32.const 0) (i64.const 0)) (i64.store (i32.const 8) (i64.const 0)) (i64.store (i32.const 16) (i64.const 0)) (i64.store (i32.const 24) (get_local $x)) (call_import $return (i32.const 0) (i32.const 32)) ) ) ) ``` --- ## (call_import $ethereumReturn) See more awesome details at https://github.com/ewasm >:::danger >:fire: Error: Out-Of-Gas! :fire: >::: <!-- .element: class="fragment" data-fragment-index="2" -->

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

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

    This team is disabled

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

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

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

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

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

    Create a note from template

    Create a note from template

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

    Create a template

    Upgrade

    Delete template

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

    This page need refresh

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

    Sign in

    Forgot password

    or

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

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

    New to HackMD? Sign up

    Help

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

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

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

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

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

    Feedback

    Submission failed, please try again

    Thanks for your support.

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

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

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

        Link with GitHub

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

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

          Authorize again
         

        Choose which file to push to

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

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

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

        Syncing

        Push failed

        Push successfully