ETH私有鏈搭建與使用-搭建區塊鏈瀏覽器(5)


操作系統環境:CentOS 7.6.1810,操作基礎目錄/data,如無該目錄請手動創建(mkdir /data)

1.安裝docker環境

yum install -y yum-utils device-mapper-persistent-data lvm2

yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

yum update -y && yum install docker-ce

systemctl daemon-reload && systemctl restart docker && systemctl enable docker

docker --version

 

 2.拉取鏡像文件

docker pull julianliu/eth-explorer:latest

docker images

 

 3.創建容器eth-explorer

docker run -d -p 8000:8000 --name eth-explorer julianliu/eth-explorer

docker ps

 

啟動成功后,打開對應服務器8000端口訪問權限即可看到界面,但界面上並沒有區塊數據,需要修改容器內頁面配置 

4.進入容器並修改配置

4.1進入容器

docker exec -it eth-explorer sh

4.2修改節點配置信息(/app/app/app.js)

/app/app/app.js為容器內路徑,修改app.js中GETH_HOSTNAME為自己的節點ip地址

4.3下載所需的css/js/html文件到服務器,並從服務器拷貝到容器中

angular.min.js:https://mituxiaogaoyang.club/eth-source/angular.min.js

jquery.min.js:https://mituxiaogaoyang.club/eth-source/jquery.min.js

animate.min.css:https://mituxiaogaoyang.club/eth-source/animate.min.css

mainController.js:https://mituxiaogaoyang.club/eth-source/mainController.js

index.html:https://mituxiaogaoyang.club/eth-source/index.html

 

docker cp /root/nginx/html/eth-source/angular.min.js eth-explorer:/app/app/scripts

docker cp /root/nginx/html/eth-source/jquery.min.js eth-explorer:/app/app/scripts

docker cp /root/nginx/html/eth-source/animate.min.css eth-explorer:/app/app/styles

docker cp /root/nginx/html/eth-source/mainController.js eth-explorer:/app/app/scripts/controllers

docker cp /root/nginx/html/eth-source/index.html eth-explorer:/app/app

 5.啟動節點並查看效果

5.1啟動節點

geth --datadir "./data" --rpc --rpcaddr=0.0.0.0 --rpcport 8545 --rpccorsdomain "*" --rpcapi "eth,net,web3,personal,admin,txpool,debug,miner" --nodiscover --maxpeers 30 --networkid 1981 --port 30303 --allow-insecure-unlock --mine --miner.etherbase "0xFfD4a30C08d9f16F095f6315e14bd034F7d04fb0" console

5.2使用geth console發送轉賬並查看效果

 

 這里通過0xffd4a30c08d9f16f095f6315e14bd034f7d04fb0地址向0x1ef3c8b97c47ba09d01be4a0cf633d9f08ef4cd1地址轉賬2ETH,下面是區塊鏈瀏覽器上的效果

5.3使用java調用智能合約方法並查看效果

 

 

 交易詳情:

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM