I have the following deployment script

var contract = web3.eth.contract(response.abi);
                var bytecode = response.bytecode;
                var options = {
                    from: web3.eth.defaultAccount,
                    gas: 1004000,
                    data: bytecode

                console.log("Deploying the contract");


Everything seems to work also my contracts is deployed


The problem is msg.sender is empty into the contracts and the function return 0x0000000000000000000000000000000000000000

this is set in the constructor in the Ownable OpenZeppelin contract but deployed this way it return 0x0000000000000000000000000000000000000000

My ABI https://pastebin.com/0XU4heNN

and bytecode https://pastebin.com/ThnDd1FC

The contract

pragma solidity ^0.5.2;

import '../../../node_modules/openzeppelin-solidity/contracts/ownership/Ownable.sol';
import '../../../node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20Mintable.sol';

contract PropertyContract is ERC20Mintable, Ownable {

  • can you try data: '0x' + bytecode? I had a similar issue a while back. this fixed that. May 10, 2019 at 12:13
  • I think this can help in older version - now 0x is in the bytecode pastebin.com/ThnDd1FC Let me know if there must be two 0x0x..... May 10, 2019 at 15:06
  • there need to be 1 0x May 10, 2019 at 16:31
  • Yes, I know and that is why I dont add it May 10, 2019 at 20:22

2 Answers 2


You didn't actually send any bytecode, so a contract got created with no code. No calls to it will do anything useful.

var options = {
  from: web3.eth.defaultAccount,
  gas: 1004000,
  data: "<bytecode here>", // <-- add this
  • When I add it my bytecode the contract fails to deploy because "out of gas", I try to increase it but when I increase I reach the maximum May 5, 2019 at 20:24
  • Are you have any idea why is this happening? May 6, 2019 at 8:46
  • Not without seeing your updated code. Ideally your smart contact code as well.
    – user19510
    May 6, 2019 at 15:09

Everything was fixed when I move to latest web3.js 1.0 and instead of


I use now the deploy method from the version and everything seems to work fine

                        from: web3.currentProvider.selectedAddress,
                        gas: 6004000,
                    .on('error', function (error) {
                        console.log("Error: " +error)
                    .on('transactionHash', function(transactionHash) {
                        console.log("Hash: " + transactionHash)
                    .on('receipt', function(receipt) {
                        console.log("Contract address: " + receipt.contractAddress) // contains the new contract address

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.