I installed geth and solc by following

sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install ethereum-unstable
sudo apt-get install solc

then i ran

geth --dev

and did

geth attach

I created a contract and compiled it and "deployed" it to my blockchain.

var abi = <abi from solc>;
var jarContract = eth.contract(abi); 
var bin = '0x' + "<bytecode from solc>";
var txDeploy = {from:eth.accounts[0], data: bin, gas: 1000000}; 
var jar = jarContract.new(txDeploy); 

It was instantly mined and I got an address for it and could work with it.

But then I did

var jar2 = jarContract.new(txDeploy); 

i.e. using EXACTLY the same variables as before, and nothing ever happened. It was not "mined", I got no address and could not interact with the contract.

I am a bit stumped. I only seem to be able to get one contract out of --dev and then have to stop and start it again to "mine" another one.

Any thoughts would be welcome!


  • Works perfectly fine for me. Just tested.
    – ivicaa
    Feb 28, 2018 at 23:06
  • Are you making sure to run more than 1 sealer nodes? If not, I think this issue could perhaps be due to the fact that running 1 sealer node will cause block generation issues (totally preventing it I believe)
    – hextet
    Mar 1, 2018 at 8:14

1 Answer 1


based on the doc, you shouldn't add '0x' before your byte code. The way to get the byte code of the contract is just:

let source = fs.readFileSync('nameContract.sol', 'utf8');
let compiledContract = solc.compile(source, 1);
let abi = compiledContract.contracts['nameContract'].interface;
let bytecode = compiledContract.contracts['nameContract'].bytecode;

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.