• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

DE-labtory/koa-playground

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

DE-labtory/koa-playground

开源软件地址:

https://github.com/DE-labtory/koa-playground

开源编程语言:

JavaScript 57.6%

开源软件介绍:

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.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
devcrafting/csKoans发布时间:2022-07-09
下一篇:
ladjs/i18n: i18n wrapper and Koa middleware for Lad发布时间:2022-07-09
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap