运行 android 中私有网络的以太坊节点会耗尽电池电量吗?

Would running an ethereum node of a private network in android drain battery?

我正在构建一个 android 应用程序,用户可以在其中为他们使用以太币购买的商品付款。应用程序将使用私有以太坊网络。

据我所知,我必须 运行 android 设备中的一个以太坊节点作为一个单独的进程,我的 android 应用程序必须使用发送命令或通过 JSON RPC.

既然android很在意功耗,那么android会不会允许运行连续一个单独的进程呢? android 会在一段时间后终止进程吗?

此外,运行在设备中连续使用节点会导致大量电池耗尽吗?

是的,会的。您基本上有两个选择,创建一个集中式 server/client 设置,您 android 应用程序对您为特定应用程序设置的 HttpProvider 进行 JSON RPC 查询,或者您 运行 一个轻客户端。

我认为,要走的路是运行一个轻客户端(LES protocol),它只在需要时连接到一个完整的节点。轻客户端目前正在大量开发中,并且已经在进行一些 beta 测试。

查看 light client roadmap. In june the light client testing was opened to the public. You can test it by running a fork of the go-ethereum client

  • git clone -b light-stable https://github.com/zsfelfoldi/go-ethereum.git
  • build it with Go 1.6 (won't compile with earlier versions)
  • add the --light flag for light client mode (run geth --light console for console mode)
  • you can also run it on the testnet by specifying the --testnet flag or the original unforked "classic" chain with the --oppose-dao-fork flag
  • you can run the light client with the same (default) data directory you use with the normal client, it uses a separate "lightchaindata" database directory instead of the standard "chaindata" so it won't interfere with your regular chain database (can't run the two simultaneously with the same datadir though).
  • initial syncing starts from a trusted checkpoint (later this will be implemented in a trustless way). Past headers are still accessible on-demand. Trusted checkpoints are hardcoded into the source both for the mainnet and testnet.

有专门的 gitter channel 可以提问。