GithubHelp home page GithubHelp logo

koa-playground's Introduction

koa-playground

koa-playground provides an environment where you can easily test and run the language of your koa project.

Back End

koa-playground uses HTTP protocol. It has 3 communications. Also, all data is encoded in UTF-8.

bindings package includes HTTP Request. And renderings package includes HTTP Response.

Compile

Compiling reads source code and generates bytecode. Bytecode is a code to execute the program. URL to compile is "/compile".

type CompileRequest struct {
    Code    string
}

code is a source code written by the user.

type CompileResponse struct {
    ABI             abi
    RawByteCode     []byte
    ASM             []string
}

ABI is an interface needed to user for calling the functions. RawByteCode is a byte which has information of how to execute the program. And RawByteCode consists of hexadecimal code. AsmCode is a collection of assemble codes which is more readable to human than bytes.

Deploy

Deploying deliveries the bytecode of the contract to blockchain. Users can call the functions only after deploying. URL to deploy is "/deploy".

type DeployRequest struct {
    RawByteCode string
    DateTime    string
}

RawByteCode is the code for deploying to the blockchain. DateTime is time when RawByteCode is deployed in the vm.

type DeployResponse struct {
    Address string
}

Address is the address of the contract. User should call the functions with this address.

Execute

Executing is executed by user calling the function with parameters. Then, the response delivers the result of the function call. URL to Execute is "/execute".

type ExecuteRequest struct {
    Address             string
    FunctionSelector    string
    Params              []Param
}

Address is an address of the contract which includes the function to call. FunctionSelector is the identifer to call a function. Params is a collection of parameters of the function to call.

type ExecuteResponse struct {
	EncodedOutput string
	DecodedOutput DecodedOutput
	Cost          int
	ExecutionTime int
}

EncodedOutput is the not decoded result of function call. For example, if the output is 1, EncodedOutput is 0x00000001. DecodedOutput is the decoded result of function call. In above example, DecodedOutput is integer 1. Cost is the cost to execute the function. ExecutionTime is the time when the function was executed.

Contribution

Contribution Guide CONTRIBUTION

License

Project source code files are made available under the Apache License, Version 2.0 (Apache-2.0), located in the LICENSE.

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.