All Projects → celer-network → pb3-gen-sol

celer-network / pb3-gen-sol

Licence: GPL-3.0 License
Generate solidity decoders from proto3 files

Programming Languages

go
31211 projects - #10 most used programming language
javascript
184084 projects - #8 most used programming language
solidity
1140 projects
shell
77523 projects

Labels

Projects that are alternatives of or similar to pb3-gen-sol

ocaml-grpc-envoy
Using OCaml + gRPC via Envoy
Stars: ✭ 41 (+173.33%)
Mutual labels:  protobuf
CppSerialization
Performance comparison of the most popular C++ serialization protocols such as Cap'n'Proto, FastBinaryEncoding, Flatbuffers, Protobuf, JSON
Stars: ✭ 89 (+493.33%)
Mutual labels:  protobuf
vtprotobuf
A Protocol Buffers compiler that generates optimized marshaling & unmarshaling Go code for ProtoBuf APIv2
Stars: ✭ 418 (+2686.67%)
Mutual labels:  protobuf
rpc
☎️ RPC: Type Driven Parser Generator
Stars: ✭ 16 (+6.67%)
Mutual labels:  protobuf
mnemosyne
Session management service with RPC API based on protobuf.
Stars: ✭ 15 (+0%)
Mutual labels:  protobuf
protobuf-compiler
online protobuf compiler
Stars: ✭ 24 (+60%)
Mutual labels:  protobuf
graphql-binary
GraphQL binary protocol for smaller network traffic and parsing performance
Stars: ✭ 41 (+173.33%)
Mutual labels:  protobuf
rails-microservices-book
A guide to building distributed Ruby on Rails applications using Protocol Buffers, NATS and RabbitMQ
Stars: ✭ 23 (+53.33%)
Mutual labels:  protobuf
protopatch
protoc-gen-go patch utility
Stars: ✭ 58 (+286.67%)
Mutual labels:  protobuf
zmq-protobuf
communication between python and cpp using zeromq and protobuf
Stars: ✭ 25 (+66.67%)
Mutual labels:  protobuf
protocell
Conjures up convenient OCaml types and serialization functions based on protobuf definition files
Stars: ✭ 18 (+20%)
Mutual labels:  protobuf
akka-http-scalapb
akka-http protobuf binary and json marshalling/unmarshalling for ScalaPB messages
Stars: ✭ 15 (+0%)
Mutual labels:  protobuf
CoffeeChat
opensource im with server(go) and client(flutter+swift)
Stars: ✭ 111 (+640%)
Mutual labels:  protobuf
javascript-serialization-benchmark
Comparison and benchmark of JavaScript serialization libraries (Protocol Buffer, Avro, BSON, etc.)
Stars: ✭ 54 (+260%)
Mutual labels:  protobuf
nimpb
Protocol Buffers for Nim
Stars: ✭ 29 (+93.33%)
Mutual labels:  protobuf
protobuf-d
Protocol Buffers Compiler Plugin and Support Library for D
Stars: ✭ 32 (+113.33%)
Mutual labels:  protobuf
grpcoin
API-driven cryptocurrency paper trading game. Write a bot and play!
Stars: ✭ 53 (+253.33%)
Mutual labels:  protobuf
ocaml-protoc-plugin
ocaml-protoc-plugin
Stars: ✭ 36 (+140%)
Mutual labels:  protobuf
fieldmask-utils
Protobuf Field Mask Go utils
Stars: ✭ 127 (+746.67%)
Mutual labels:  protobuf
nameko-grpc
GRPC Extensions for Nameko
Stars: ✭ 51 (+240%)
Mutual labels:  protobuf

Build Status

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].