Yet another implementation of etherscan.io
A preview is here ==> http://47.105.121.164/#/
It is a java project using spring boot and web3j. Jdk8, Gradle and Mysql should be pre-installed.
The folder web3j-app/app is the core module doing sync job and providing rest api for frontend.
The project should be started after geth, because it will use geth ipc file to sync blockchain data to mysql.
Custom configurations are made in files:
-
web3j-app/app/src/main/resources/application.properties
-
web3j-app/app/src/main/java/me/bing/web3j/app/common/Constant.java
-
web3j-app/app/src/main/resources/logback.xml
By default:
//web3j-app/app/src/main/java/me/bing/web3j/app/common/Constant.java
public static String IpcAddress = "/Users/bing/test/data/geth.ipc";
public static String CapAddress = "https://api.coinmarketcap.com/v1/ticker/ethereum/";
#web3j-app/app/src/main/resources/application.properties
spring.datasource.url = jdbc:mysql://localhost:3306/eth_test?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.username = root
<!--/data/applogs should be accessable-->
<property name="log_path" value="/data/applogs/web3j-app"/>
It is a project copied from https://github.com/nebulasio/explorer/tree/develop/explorer-front with little modification.
npm run dev # start in development
npm run build # build html&js which are in dist folder
-
Pre-installation
Nginx, Mysql, Java8, Geth
-
build frontend, target directory is dist
cp dist/* /var/www/html
-
build web3j-app, target jar is app/build/web3j-app-1.0.0.jar
-
configure mysql, if you donot want to set your root password
use mysql;
update user set authentication_string=PASSWORD("") where User='root';
update user set plugin="mysql_native_password" where User='root';
create tables with these schemes
- It is recommanded to run geth via systemd
#/etc/systemd/system/geth.service
[Unit]
Description=geth
[Service]
Type=simple
User=root
Restart=always
WorkingDirectory=/root/webapp
ExecStart=/usr/bin/geth --datadir /Users/bing/test/data > geth.log
[Install]
WantedBy=default.target
#/etc/systemd/system/web3japp.service
[Unit]
Description=web3japp
After=geth.service
[Service]
Type=simple
User=root
Restart=always
WorkingDirectory=/root/webapp
ExecStart=/usr/bin/java -jar web3j-app-1.0.0.jar > app.log
[Install]
WantedBy=default.target
systemctl daemon-reload
systemctl enable geth && systemctl enable web3japp
systemctl start geth && systemctl start web3japp && systemctl restart nginx
The author is a newbie of gradle and vue, so there must be contributions you are willing to contribute.