forked from ethjava/web3j-sample
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuickStart.java
More file actions
30 lines (23 loc) · 717 Bytes
/
Copy pathQuickStart.java
File metadata and controls
30 lines (23 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.ethjava;
import com.ethjava.utils.Environment;
import org.web3j.protocol.Web3j;
import org.web3j.protocol.core.methods.response.Web3ClientVersion;
import org.web3j.protocol.http.HttpService;
import java.io.IOException;
/**
* 快速开始
*/
public class QuickStart {
private static Web3j web3j;
public static void main(String[] args) {
web3j = Web3j.build(new HttpService(Environment.RPC_URL));
Web3ClientVersion web3ClientVersion = null;
try {
web3ClientVersion = web3j.web3ClientVersion().send();
String clientVersion = web3ClientVersion.getWeb3ClientVersion();
System.out.println("clientVersion " + clientVersion);
} catch (IOException e) {
e.printStackTrace();
}
}
}