I created a private blockchain console with an unlocked account.
I have a simple contract, simpleContract.sol
pragma solidity ^0.4.0;
contract SimpleStorage {
uint storedData;
function set(uint x) {
storedData = x;
}
function get() constant returns (uint) {
return storedData;
}
}
It was made into a js file using
echo "var simpleOutput=`solc --optimize --combined-json abi,bin,interface simpleContract.sol`" > simpleStorage.js
I load my contract in the console using
loadScript("simpleStorage.js")
var simpleStorageContract = eth.contract(JSON.parse(simpleOutput.contracts["simpleContract.sol:SimpleStorage"].abi));
var simpleStorage = simpleStorageContract.new( { from: eth.accounts[0], data: "0x" + simpleOutput.contracts["simpleContract.sol:SimpleStorage"].bin, gas: '47000' }, function (e, contract) { if(!e) { if(!contract.address) { console.log("Contract transaction send: TransactionHash: " + contract.transactionHash + " waiting to be mined..."); } else { console.log("Contract mined! Address: " + contract.address); console.log(contract); } }})
I see
Contract transaction send: TransactionHash: 0x0f01f04f0e266cdca62479413bf17d65d38ef0b497dcbe9e9232451c994892a0 waiting to be mined...
When I start the miner with
miner.setEtherbase(eth.accounts[0])
miner.start(4)
It prints
INFO [07-01|18:22:03] Updated mining threads threads=4
INFO [07-01|18:22:03] Transaction pool price threshold updated price=18000000000
INFO [07-01|18:22:03] Starting mining operation
INFO [07-01|18:22:03] Commit new mining work number=3062 txs=0 uncles=0 elapsed=309.753µs
INFO [07-01|18:22:06] Successfully sealed new block number=1 hash=a73c27…d68bae
INFO [07-01|18:22:06] 🔨 mined potential block number=2 hash=a73c27…d68bae
INFO [07-01|18:22:06] Commit new mining work number=3 txs=0 uncles=0 elapsed=126.412µs
INFO [07-01|18:22:08] Successfully sealed new block number=4 hash=577497…34db4e
How can I find when my contract will be mined? I was under the impression that I could find the block number using
eth.getTransaction
Any solutions?