Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contract is always deployed, but a 'missing 0x prefix' error is returned (Kovan network) (beta50 and 52) #2673

Closed
UnclePetros opened this issue Apr 12, 2019 · 3 comments

Comments

@UnclePetros
Copy link

UnclePetros commented Apr 12, 2019

Hi,
on the beta50 and the new beta52 I receive a new error while deploying a contract on the Kovan Network:
{ error: Error: Invalid params: Invalid block number: missing 0x prefix. at D:\Mega\Lavoro\Freelance\Threads s.r.l\Progettazione\love_smart_contract_virtualization\node_modules\web3-provider-engine\subproviders\provider.js:19:36 at XMLHttpRequest.request.onreadystatechange (D:\Mega\Lavoro\Freelance\Threads s.r.l\Progettazione\love_smart_contract_virtualization\node_modules\web3-providers-http\src\index.js:96:13) at XMLHttpRequestEventTarget.dispatchEvent (D:\Mega\Lavoro\Freelance\Threads s.r.l\Progettazione\love_smart_contract_virtualization\node_modules\xhr2-cookies\xml-http-request-event-target.ts:44:13) at XMLHttpRequest._setReadyState (D:\Mega\Lavoro\Freelance\Threads s.r.l\Progettazione\love_smart_contract_virtualization\node_modules\xhr2-cookies\xml-http-request.ts:219:8) at XMLHttpRequest._onHttpResponseEnd (D:\Mega\Lavoro\Freelance\Threads s.r.l\Progettazione\love_smart_contract_virtualization\node_modules\xhr2-cookies\xml-http-request.ts:345:8) at IncomingMessage.<anonymous> (D:\Mega\Lavoro\Freelance\Threads s.r.l\Progettazione\love_smart_contract_virtualization\node_modules\xhr2-cookies\xml-http-request.ts:311:39) at IncomingMessage.emit (events.js:187:15) at IncomingMessage.EventEmitter.emit (domain.js:442:20) at endReadableNT (_stream_readable.js:1094:12) at process._tickCallback (internal/process/next_tick.js:63:19), receipt: false, confirmations: 0, confirmationChecks: 3 }
Contract is always correctly created on blockchain.
A few times (very few) I don't receive the error and my method return correctly.
I've tried to change transactionConfirmationBlocks from 1 to 24: always the same behaviour.
I've also checked bytecode and it has 0x prefix.
Web3 version is 1.0.0-beta.50
Web3 version is 1.0.0-beta.52

Regards
Pietro

@UnclePetros UnclePetros changed the title Contract is always deployed, but a 0x missing error is returned (Kovan network) (beta.52) Contract is always deployed, but a 'missing 0x prefix' error is returned (Kovan network) (beta.52) Apr 12, 2019
@UnclePetros UnclePetros changed the title Contract is always deployed, but a 'missing 0x prefix' error is returned (Kovan network) (beta.52) Contract is always deployed, but a 'missing 0x prefix' error is returned (Kovan network) (beta50 and 52) Apr 12, 2019
@nivida
Copy link
Contributor

nivida commented Apr 14, 2019

Could you please add the code example?

@UnclePetros
Copy link
Author

Sure:

...
web3 = identity.ethInitAdmin();
var accounts = await web3.eth.getAccounts();
var contract = new web3.eth.Contract(unitSQP.abi);
contract.options.data = unitSQP.bytecode;
 await contract.deploy({
                arguments: [params.name, 
                            params.symbol,
                            params.title,
                            params.shortDescription,
                            params.id,
                            params.sqiPerPacket,
                            params.totalSqiPackets,
                            params.availableSqiPacket,
                            params.unitIpfsAddress]
 })
.send({ from: accounts[0], gas: 4000000, gasPrice: 4000000000 })
 .on('error', function(error) { log.error(error) })
.on('transactionHash', function(transactionHash) {
    log.info(i18n.__('info.unitTransactionStarted',transactionHash));
})
 .on('receipt', async (receipt) => {
    log.info(i18n.__('info.unitDeployed',receipt.contractAddress));
});
...

Pietro

@nivida
Copy link
Contributor

nivida commented Apr 16, 2019

Thanks for providing me additional details. This will get fixed with issue: #2661

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants