当先锋百科网

首页 1 2 3 4 5 6 7

Solidity官方文档“投票”智能合约部署到区块链,利用web3j完成交互

GitHub源码 完美上链运行: https://github.com/ybeario/ballot-web3j-demo

Readme.txt:

.sol .bin .abi 文件均在solidity文件夹下

  • step 1: install docker for your computer (安装docker for windows)
  • step 2: run command in shell or powershell (打开powershell运行 --dev进入开发模式)
docker run -d --name ethereum -p 8545:8545 -p 30303:30303 ethereum/client-go --rpc --rpcaddr "0.0.0.0" --rpcapi="db,eth,net,web3,personal" --rpccorsdomain "*" --dev

check ethereum if it’s running

docker ps

or start ethereum

docker start ethereum
  • step 3: improt this project as a maven project
  • step 4: run EthereumDemoApplication as Spring-Boot Application
  • step 5: open your chrome
localhost:8080/swagger-ui.html
  • step 6: enjoy swagger to call (deploy first then vote and get winner )
  • step 7: you can complete all to-do part by yourself

If you like please give me a star!

thank you!