Deploying Smart Contract in Windows

meetreksmeetreks Member Posts: 59
edited August 2015 in Education
1. Geth and Eth

The packages are available in chocolatey. So first step is download chocolatey

Once you get chocolatey, go to where the exe is located or set PATH.

Once you have decided (cd to the location or set PATH), then

choco install geth-stable -version

this will install geth for you.

To get eth, this is the simplest way.

Go to and downlaod the latest exe from there


geth.exe will be available in a path similar to this

HomeDirectory:/Chocolatey / lib / geth-stable / tools

eth.exe will be available in a path similar to this

C:\Program Files\Ethereum (++) 0.9.40\Release

Now -- you decide which one you are going to use. I have decided to use Geth.

2. Start a test network

geth --networkid 12345 --genesis ~/test/genesis.json --datadir ~/.ethereum_experiment console

now replace this "~/test/genesis.json" with the path where you can find the json file called genesis.json.
Kindly note that this is a RPC-Json instalation of geth. if you want change the 12345 but really you do not need to.
To locate the genesis.json, just google it or send me a PM and I shall provide this to you.

Now replace ~/.ethereum_experiment with the actual path on your computer where .ethereum_expriement is present

So the geth statement will look like this for me
(first Cd to the geth.exe location or set path)
geth --networkis 123445 --genesis C:/stuff/genesis.json --datadir C:/stuff/.ethereum_expriment console

This will start getting all the blocks and will give you a promt (within the command prompt)
That is the geth prompt

3. Getting Ethers
Best way is to provide your address in a forum like this and ask for test ethers and some good souls will provide you with one!!!

4. Smart Contracts
2 steps here

2 steps here
1. Get Solifity :)
Now, if you folow the instructions present in the ethereum website it will not work :)
Remember we spoke about eth in STep1. Well one of the advanatges is it also downlods solc automatically.
so all you have to do is this
admin.setSolc("C:/Program Files/Ethereum (++) 0.9.40/Release/solc")
and then type
geth.getCompilers() and its done.
NOw you can follow the things mentioned in the ethereum webiste and it will work.

2. Now if you are not too bothered (like me), then use the online compiler from our dear friend Chris.

Here on the left hand side, delete the default stuff and put our own contract. Generate stuff and on the right hand sige you will get something like
Geth Deploy and a text box by the SIDE of it. Copy the contents of this and this is your compiled contract.

1. Either follow the instructions in the website -- if you have solidity
2. If you used online compiler, copy the text present in Geth Deplpoy text box and paste it in the geth console

Now it will ask you to to unlock your account (I presume you would have followed instructions and created an account for yourself once you had geth going)
Just type the password!

if you had enough GAS, then you will receive a contract mined message else just the same address with a 0X at front.

Sample compiled code
var _greeting = "I told you that my ny name is Neo!!!" ;

var greeterContract = web3.eth.contract([{"constant":false,"inputs":[],"name":"kill","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"greet","outputs":[{"name":"","type":"string"}],"type":"function"},{"inputs":[{"name":"_greeting","type":"string"}],"type":"constructor"}]);
var greeter =
     from: web3.eth.accounts[0], 
     data: '60606040526040516102b43803806102b48339016040526060805160600190602001505b5b33600060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908302179055505b806001600050908051906020019082805482825590600052602060002090601f01602090048101928215609e579182015b82811115609d5782518260005055916020019190600101906081565b5b50905060c5919060a9565b8082111560c1576000818150600090555060010160a9565b5090565b50505b506101dc806100d86000396000f30060606040526000357c01000000000000000000000000000000000000000000000000000000009004806341c0e1b514610044578063cfae32171461005157610042565b005b61004f6004506100ca565b005b61005c60045061015e565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f1680156100bc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561015b57600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b5b565b60206040519081016040528060008152602001506001600050805480601f016020809104026020016040519081016040528092919081815260200182805480156101cd57820191906000526020600020905b8154815290600101906020018083116101b057829003601f168201915b505050505090506101d9565b9056', 
     gas: 1000000
   }, function(e, contract){
    if (typeof contract.address != 'undefined') {
    console.log(e, contract);
    console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);
Post edited by StephanTual on


Sign In or Register to comment.