"Voting" -- invalid bytes32 value (arg="candidateNames", coderType="bytes32", value="Rama").

區塊鏈中一個投票demo。在執行migrate命令部署合約時出錯。

解決方法:把[“Nick”, “Rama”, “Jose”]修改爲[“Nick”, “Rama”, “Jose”].map(x => web3.utils.asciiToHex(x))

原文https://medium.com/@betselothailu/thank-you-for-the-great-tutorial-6e0114b1d944

可能要弄個梯子。

 

下面是那個人的回覆:

Thank you for the great tutorial.

If the migration step ( truffle migrate — network ganache) gives the following error:

“Voting” — invalid bytes32 value (arg=”candidateNames”, coderType=”bytes32", value=”Nick”).

Then

open “migrations/2_deploy_contracts.js” and replace [“Nick”, “Rama”, “Jose”] with [“Nick”, “Rama”, “Jose”].map(x => web3.utils.asciiToHex(x)) (Truffle v5.0.19)

The strings need to be replaced with their hex equivalents.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章