android 应用连接电脑端eth测试节点

1.启动geth console

./build/bin/geth --datadir dev_data/node1 --rpc --rpcaddr "自己的电脑ip"  --rpcport 8545 console 

ubuntu下查看ip:
ifconfig

 inet 自己电脑ip  netmask 255.255.255.0  broadcast 

2.Android 里面连接geth

Web3j web3j = Web3jFactory.build(new HttpService("http://自己电脑ip:8545"));

3.nginx 配置

/etc/nginx/conf.d下添加配置文件,名字随意,后缀为conf

server {
    listen 80;
    server_name 自己电脑ip;
    charset utf-8;

    # Geth proxy that password protects the public Internet endpoint
    location /eth {
        # Proxy to geth note that is bind to localhost port                        
        proxy_pass http://127.0.0.1:8545;            
    }      
}

你可能感兴趣的:(android 应用连接电脑端eth测试节点)