The website states that
Go Ethereum is available ...as a library that you can embed in your Go... projects
However after pulling go-ethereum I find that difficult, particularly with the use of 'vendored' librairies in the arguments of functions that could constitute the "API".
For instance, the use of cli.Context from gopkg.in/urfave/cli.v1, which is vendored, in a a few utility functions, which therefore cannot be called (https://github.com/golang/go/issues/15162)
Am I missing something ?
Is there any guide to explain how to use geth as a library ? (API, packages that should be used / not used)
Don't try to use stuff from the cmd folder. Those are only useful to create the geth binary and associated tools. You can use anything else from go-ethereum and it should just work.
Thanks. I more or less managed to figure that one out. I guess a minimal example goes along the lines of
func Start() {
nodeConfig := node.DefaultConfig
n, err := node.New(&nodeConfig)
if err != nil {
utils.Fatalf("Failed to create the protocol node: %v", err)
}
ethConfig := eth.DefaultConfig
utils.RegisterEthService(n, ðConfig)
whisperConfig := whisper.DefaultConfig
utils.RegisterShhService(n, &whisperConfig)
// start the stack and watch for SIG events
utils.StartNode(n)
// wait for explicit shutdown
n.Wait()
}
how about all other functions like creating accounts and managing the accounts? @bgrieder
Most helpful comment
Thanks. I more or less managed to figure that one out. I guess a minimal example goes along the lines of