Overview – 概述区块链毕设代写

区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,Overview – 概述区块链毕设代写 是一篇很好的国外资料

Overview - 概述

Overview

pb3-gen-sol is a proto3 to solidity library generator that supports proto3 native types and uses field option for solidity native types. Both the message and generated code are more efficient than other solutions. It also includes a library to decode protobuf wireformat. Currently it generates decoders, with encoder support planned.

Usage

.proto files

Example:

syntax = "proto3"; // package name is used for both generated .sol file name and library name package mytest;  import "google/protobuf/descriptor.proto"; extend google.protobuf.FieldOptions {     string soltype = 54321;  // must > 1001 and not conflict with other extensions }  message MyMsg {     bytes addr = 1 [ (soltype) = "address" ];     uint32 num = 2 [ (soltype) = "uint8" ];     bool has_moon = 3;  // for matching native types, no need for soltype option }

Check .proto files under test folder for more examples.

Generate solidity library

Run

$ go build -o protoc-gen-sol $ export PATH=$PWD:$PATH $ protoc --sol_out=. [list of proto files]

proto files can have different package names, and generated .sol file name is proto package name.

Params

  • msg: only generate solidity struct and decode functions for msg name. Multiple can be specified.
  • importpb: default false, if set to true, generated .sol file will import pb.sol instead of embed library pb in the file

Example:

$ protoc --sol_out=msg=Msg1,msg=Msg2,msg=Msg3,importpb=true:test/solidity/contracts/lib/ test/test.proto

Kwown Issues

  • No support for int32/int64
  • Support embedded message/enum, but no nested message/enum definition

Contributors

  • stevenlcf

update


pb3 gen sol是一个proto3到solidity库生成器,支持proto3本机类型,并使用字段选项来生成solidity本机类型。消息和生成的代码都比其他解决方案更有效。它还包括一个库来解码protobuf wireformat。目前,它生成解码器,与编码器支持计划。

概述

示例:

用法

.proto文件

检查test文件夹下的.proto文件以获取更多示例。

syntax = "proto3"; // package name is used for both generated .sol file name and library name package mytest;  import "google/protobuf/descriptor.proto"; extend google.protobuf.FieldOptions {     string soltype = 54321;  // must > 1001 and not conflict with other extensions }  message MyMsg {     bytes addr = 1 [ (soltype) = "address" ];     uint32 num = 2 [ (soltype) = "uint8" ];     bool has_moon = 3;  // for matching native types, no need for soltype option }

运行

生成solidity库

proto文件可以有不同的包名,并且生成的.sol文件名是proto包名。

$ go build -o protoc-gen-sol $ export PATH=$PWD:$PATH $ protoc --sol_out=. [list of proto files]

示例:

参数

  • msg:仅为msg name生成solidity结构和解码函数。可以指定多个。
  • importpb:default false,如果设置为true,则将导入生成的.sol文件铅溶胶不在文件中嵌入库pb,不支持int32/int64,但不支持嵌套的消息/枚举定义

$protoc–solu out=msg=Msg1,msg=Msg2,msg=Msg3,进口港=正确:test/solidity/contracts/lib/试验/测试.proto

$ protoc --sol_out=msg=Msg1,msg=Msg2,msg=Msg3,importpb=true:test/solidity/contracts/lib/ test/test.proto

Kwown Issues

  • No support for int32/int64
  • Support embedded message/enum, but no nested message/enum definition

贡献者

  • stevenlcf

update

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/20511.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » Overview – 概述区块链毕设代写

提供最优质的资源集合

立即查看 了解详情