everyone! Doing Dapp on Etheryum. When the contract was deployed, the Error: The data field must be HEX encoded data began to fly out. I do it on a site under Web3 \ JS. Thought the old js resource. Updated the link to the latest version https: //cdn.jsdelivr.net/gh/ethereum/web3.js@1.2.7-rc.0/dist/web3.min.js, but it did not help. Peace of js-code where error appeares:
transaction = myContract.deploy({ data: bytecode, arguments: [Param1Wei, Param2Wei, Param3Wei] });
const promiEvent = transaction.send({from: myAddress, value: ValueWei});
After a long search, I definitely installed only one thing: an error appears when a call from the SafeMath library calls something like:
uint256 C = A.sub (B);
when
uint256 C = A - B;
everything works great!
In this case, the symbols $__ and __$ appear in two places in the bytecode. I think the whole thing is in them. Until I find a solution, I can’t use the library (. Adding to the bytecode "0x" does not change anything in principle. Using web3.utils.asciiToHex (bytecode)
makes the contract inoperative. Error appeared only localhost, in remix all works good!
bytecode
? – goodvibration Apr 17 '20 at 15:18