examples/

directory
v0.0.0-...-113f0ac Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2018 License: LGPL-3.0

README

An example to show how to crate DAPP using sol2proto and grpc-contract.

Build

This example requires a Go (version 1.7 or later) compiler. You can install them using your favorite package manager. Once the dependencies are installed,

  1. Install proto and solc

  2. Install other tools

$ make setup
  1. Put the solidity file into this folder and build.
# name=${contract_name}
$ make run name=NameService

Trouble shootings

  1. Old export format no longer supported
  • Got error message like this:
could not import google.golang.org/grpc (/path/pkg/darwin_amd64/google.golang.org/grpc.a: import "google.golang.org/grpc": old export format no longer supported (recompile library))
  • How to resolve?

Some libraries installed in your $GOPATH are in the old format, which are built go1.6 or before. Make sure all libraries under your $GOPATH are recompiled with your current go compiler.

go install google.golang.org/grpc
  1. Inconsistent context library path
  • Got error message like this:
cannot use server literal (type *server) as type NameServiceServer in return argument:
    *server does not implement NameServiceServer (wrong type for GetName method)
        have GetName("context".Context, *Empty) (*GetNameResp, error)
        want GetName("golang.org/x/net/context".Context, *Empty) (*GetNameResp, error)
  • How to resolve?

The context is in the standard library Go 1.7 already. Make sure the latest version of grpc and protoc plugin are installed.

go get -u google.golang.org/grpc
go get -u github.com/golang/protobuf/protoc-gen-go
  1. Wrong imports in generated file
  • You may find you have wrong imports in the generated file, such as:
github.com/markya0616/go-ethereum/core/types

The correct one should be:

github.com/ethereum/go-ethereum/core/types

The main reason is that goImports finds the wrong imports. The solution is to create a configuration file at $GOPATH/src/.goimportsignore and put in the ignore wrong path, i.e., github.com/markya0616/go-ethereum/. After that, generate files again, it should work.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL