Exemple #1
0
func (app *EthereumApplication) StartIPC(ctx *cli.Context) error {
	eth := app.ethereum
	config := comms.IpcConfig{
		Endpoint: utils.IpcSocketPath(ctx),
	}

	initializer := func(conn net.Conn) (comms.Stopper, shared.EthereumApi, error) {
		fe := useragent.NewRemoteFrontend(conn, eth.AccountManager())
		xeth := xeth.NewFromApp(app, fe)
		ethApi := api.NewEthApi(xeth, eth, codec.JSON)
		personalApi := api.NewPersonalApi(xeth, eth, codec.JSON)
		web3Api := api.NewWeb3Api(xeth, codec.JSON)
		return xeth, api.Merge(ethApi, personalApi, web3Api), nil
	}

	return comms.StartIpc(config, codec.JSON, initializer)
}
Exemple #2
0
// Start the local RPC server
func (app *EthereumApplication) StartRPC(ctx *cli.Context) error {
	config := comms.HttpConfig{
		ListenAddress: ctx.GlobalString(utils.RPCListenAddrFlag.Name),
		ListenPort:    uint(ctx.GlobalInt(utils.RPCPortFlag.Name)),
		CorsDomain:    ctx.GlobalString(utils.RPCCORSDomainFlag.Name),
	}

	eth := app.ethereum
	xeth := xeth.NewFromApp(app, nil)
	codec := codec.JSON

	// We only run a few of the APIs.
	// For now, all block related functionality will fail (ie. only state!)
	// Eventually, replace with calls to tendermint core
	ethApi := api.NewEthApi(xeth, eth, codec)
	personalApi := api.NewPersonalApi(xeth, eth, codec)
	web3Api := api.NewWeb3Api(xeth, codec)
	return comms.StartHttp(config, codec, api.Merge(ethApi, personalApi, web3Api))
}