| | |
| | | |
| | | |
| | | @Component |
| | | @ConditionalOnProperty(prefix = "system", name = "quartz-job", havingValue = "true") |
| | | @ConditionalOnProperty(prefix = "system", name = "chain-listener", havingValue = "true") |
| | | public class AndaoContractMain { |
| | | |
| | | @Autowired |
| | |
| | | } |
| | | |
| | | private static Web3j getInstanceScope() { |
| | | |
| | | HttpService httpService = new HttpService(blockchainNode); |
| | | return Web3j.build(httpService); |
| | | } |
| | | |
| | | private static Web3j getInstanceScopes() { |
| | | |
| | | HttpService httpService = new HttpService(blockchainNode); |
| | | return Web3j.build(httpService); |
| | |
| | | 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 { |
| | |
| | | public static void main(String[] args) { |
| | | AndaoContractMain andaoContractMain = new AndaoContractMain(); |
| | | |
| | | String address = "0x7a9bfE048d110EF90a467803653f9B8666f9096C"; |
| | | String address = "0xA60AaC0da34C76F3f60207ee09e9F75043319ab4"; |
| | | BigInteger bigInteger = new BigInteger(Convert.toWei("1", Convert.Unit.ETHER).setScale(0).toString()); |
| | | String hash = andaoContractMain.trans(bigInteger,address); |
| | | System.out.println(hash); |