Code Monkey home page Code Monkey logo

wasm-dvm's Introduction

WASM DVM

Introduction

WASM DVM is a WebAssembly-based data vending machine.

Currently, this uses extism as the execution environment. The Wasm code is executed in a WebAssembly runtime environment. If you want to develop a wasm plugin, you can use the extism PDK for developing and testing your wasm code.

Currently Supported Features

  • Pay per time execution
  • Pre-paid execution with zaps
  • Encrypted input and output
  • Scheduled execution
  • DLC announcement based execution

Nostr Events

Input

Clients must provide the Wasm code in the i tag field. The Wasm code must be directly accessible at the provided URL. It must also provide the input data and the provided function name to be executed.

The input should be a stringified JSON object with the following fields:

  • url (string): The URL of the Wasm binary.
  • function (string): The name of the function to be executed.
  • input (string): The input data for the function.
  • time (number): The maximum time in milliseconds to execute the function.
  • checksum (string): The sha256 hash of the Wasm binary in hex.
  • shedule (object): Scheduling parameters for the execution. The object should have the following fields:
    • run_date (number): The date in seconds since the epoch to execute the function.
    • name (optional string): Name of the event. Only used for DLC announcement
    • expected_outputs (optional string array): The list of expected outputs from the function. Only used for DLC announcement.

Output

The result of the execution is returned in the content field.

Example

Count number of vowels in a string.

Request

{
  "content": "",
  "kind": 5600,
  "tags": [
    [
      "i",
      "{\"url\":\"https://github.com/extism/plugins/releases/download/v0.5.0/count_vowels.wasm\",\"function\":\"count_vowels\",\"input\":\"Hello World\",\"time\": 1000, \"checksum\": \"93898457953d30d016f712ccf4336ce7e9971db5f7f3aff1edd252764f75d5d7\"}",
      "text"
    ]
  ]
}

Response

{
  "content": "{\"count\":3,\"total\":3,\"vowels\":\"aeiouAEIOU\"}",
  "kind": 6600
}

wasm-dvm's People

Contributors

benthecarman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

22388o wavesrcool

wasm-dvm's Issues

DLC Oracle

Add ability to schedule events with an announcement

Zap balance

If the user zaps me it should add to their balance and their next requests should deduct from that instead of requiring payment.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.