您好,登錄后才能下訂單哦!
本篇內容介紹了“怎么使用web3j將sol智能合約轉換成java文件”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!
一、安裝web3j
$ brew tap web3j/web3j $ brew install web3j $ web3j _ _____ _ _ | | |____ (_) (_) __ _____| |__ / /_ _ ___ \ \ /\ / / _ \ '_ \ \ \ | | | / _ \ \ V V / __/ |_) |.___/ / | _ | || (_) | \_/\_/ \___|_.__/ \____/| |(_)|_| \___/ _/ | |__/ Usage: web3j version|wallet|solidity ...
二、安裝solc
sudo npm install -g solc
三、生成.bin和.abi
solcjs /Users/shijun/Desktop/truffleWorkspace/eCommerce/contracts/ConfirmOrder.sol --bin --abi --optimze -o/Users/shijun/Desktop/truffleWorkspace/eCommerce_out
四、生成.java
$ web3j solidity generate --solidityTypes /Users/shijun/Desktop/truffleWorkspace/eCommerce_out/_Users_shijun_Desktop_truffleWorkspace_eCommerce_contracts_ConfirmOrder_sol_ConfirmOrderContract.bin /Users/shijun/Desktop/truffleWorkspace/eCommerce_out/_Users_shijun_Desktop_truffleWorkspace_eCommerce_contracts_ConfirmOrder_sol_ConfirmOrderContract.abi -o /Users/shijun/Desktop/truffleWorkspace/eCommerce_out -p www.membersheep.hk.web3j
=================================================================
web3j solidity generate --solidityTypes /Users/shijun/Desktop/truffleWorkspace/sheepCoin_out/_Users_shijun_Desktop_truffleWorkspace_sheepCoin_tokenecr20_sol_TokenERC20.bin /Users/shijun/Desktop/truffleWorkspace/sheepCoin_out/_Users_shijun_Desktop_truffleWorkspace_sheepCoin_tokenecr20_sol_TokenERC20.abi -o /Users/shijun/Desktop/truffleWorkspace/sheepCoin_out -p Shpcoin.web3j
web3j solidity generate --solidityTypes /Users/shijun/Desktop/truffleWorkspace/sheepCoin_out/_Users_shijun_Desktop_truffleWorkspace_sheepCoin_tokenecr20_sol_tokenRecipient.bin /Users/shijun/Desktop/truffleWorkspace/sheepCoin_out/_Users_shijun_Desktop_truffleWorkspace_sheepCoin_tokenecr20_sol_tokenRecipient.abi -o /Users/shijun/Desktop/truffleWorkspace/sheepCoin_out -p Shpcoin.web3j
五、將java文件放入項目
六、啟動私有鏈
miner.start(1)
miner.stop()
“怎么使用web3j將sol智能合約轉換成java文件”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注億速云網站,小編將為大家輸出更多高質量的實用文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。