From 682fefef1b0a709e33de520859b2e7410f6bb981 Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Mon, 09 Jan 2023 16:36:08 +0800 Subject: [PATCH] 20221227 充值归集 --- src/main/java/cc/mrbird/febs/mall/chain/service/EthService.java | 33 +++++++++++++++++++-------------- 1 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/main/java/cc/mrbird/febs/mall/chain/service/EthService.java b/src/main/java/cc/mrbird/febs/mall/chain/service/EthService.java index 76de900..a4f1f82 100644 --- a/src/main/java/cc/mrbird/febs/mall/chain/service/EthService.java +++ b/src/main/java/cc/mrbird/febs/mall/chain/service/EthService.java @@ -33,15 +33,15 @@ /** * ETH类,使用Web3j 下面为使用教程 * https://kauri.io/article/925d923e12c543da9a0a3e617be963b4/manage-an-ethereum-account-with-java-and-web3js - * + * * @author Administrator * */ public class EthService { - private static String ethWalletPath = "/home/javaweb/webresource/eth"; - // private static String ethWalletPath="E://"; + private static String ethWalletPath = "/home/javaweb/webresource/rabbit"; +// private static String ethWalletPath="E://"; private Web3j web3j; // private Admin admin; // private Parity parity; @@ -66,7 +66,7 @@ /** * 查询ETH余额 - * + * * @param address * @return */ @@ -90,7 +90,7 @@ /** * 创建ETH钱包 - * + * * @return */ public static Map<String, String> createEth() { @@ -116,6 +116,7 @@ } return wallet; } + public boolean checkTransferResult(String hash) { // 0xa3e6a0ccc3aac30d866a86ca9c0477dd58b7b061787ba40b16c3844803273816 交易hash @@ -145,22 +146,26 @@ } public static void main(String[] args) throws IOException { - HttpService service = new HttpService(ETH_UTL); - Web3j build = Web3j.build(service); - //Request<?, EthTransaction> ethTransactionRequest = build.ethGetTransactionByHash("0xa3e6a0ccc3aac30d866a86ca9c0477dd58b7b061787ba40b16c3844803273816"); - Request<?, EthGetTransactionReceipt> ethGetTransactionReceiptRequest = build.ethGetTransactionReceipt("0xa3e6a0ccc3aac30d866a86ca9c0477dd58b7b061787ba40b16c3844803273816"); - EthGetTransactionReceipt send = ethGetTransactionReceiptRequest.send(); - String status = send.getResult().getStatus(); - System.out.println(status);//0x1 +// HttpService service = new HttpService(ETH_UTL); +// Web3j build = Web3j.build(service); +// //Request<?, EthTransaction> ethTransactionRequest = build.ethGetTransactionByHash("0xa3e6a0ccc3aac30d866a86ca9c0477dd58b7b061787ba40b16c3844803273816"); +// Request<?, EthGetTransactionReceipt> ethGetTransactionReceiptRequest = build.ethGetTransactionReceipt("0xa3e6a0ccc3aac30d866a86ca9c0477dd58b7b061787ba40b16c3844803273816"); +// EthGetTransactionReceipt send = ethGetTransactionReceiptRequest.send(); +// String status = send.getResult().getStatus(); +// System.out.println(status);//0x1 // EthTransaction send = ethTransactionRequest.send(); // String input = send.getResult().getInput(); // System.out.println(input); + + + Map<String, String> eth = createEth(); + System.out.println(eth); } /** - * + * * 方法描述:获取代币余额 - * + * * @param fromAddress * @param * @param -- Gitblit v1.9.1