| | |
| | | return Web3j.build(httpService); |
| | | } |
| | | |
| | | private static Web3j getInstanceScopes() { |
| | | |
| | | HttpService httpService = new HttpService(blockchainNode); |
| | | return Web3j.build(httpService); |
| | | } |
| | | |
| | | // 区块链节点地址 TODO |
| | | // private static String blockchainNode = "https://bsc-dataseed.binance.org"; |
| | | private static String blockchainNode = "https://bsc-dataseed1.ninicoin.io"; |
| | |
| | | System.out.println("启动投注监听事件"); |
| | | // 指定密钥文件并进行账号和密码的验证 |
| | | Credentials credentials = Credentials.create(privateKey); |
| | | Abi contract = Abi.load(contractAddr, getInstanceScope(), credentials, new DefaultGasProvider()); |
| | | Abi contract = Abi.load(contractAddr, getInstanceScopes(), credentials, new DefaultGasProvider()); |
| | | EthFilter filter = getFilter(startBlock); |
| | | contract.withdrawnEventFlowable(filter).subscribe(e->{ |
| | | try { |