When making the Ethereum smartcontract for Ethergoods (www.ethergoods.com) I had to struggle through a LOT!

Assuming you have a truffle contract all compiled and ready, you need to configure your truffle.js file. Here is my working config for Ropsten:

module.exports = {

networks: {

development: {

host: "localhost",

port: 8545,

network_id: "*" // Match any network id

},

ropsten: {

network_id: 3,

host: "localhost",

port: 8545,

gas: 2900000 }

},

rpc: {

host: 'localhost',

post:8080

}

};

Once that is all set up you need to install the ethereum client Geth. Then, run:

geth --testnet account new

This will generate a new Ropsten account for you. You will need some Ropsten ETH so check a faucet, Metamask, or a nice person on reddit. Transfer the Ropsten Ether into that account.

Run the geth instance with permissions opened up like this :

geth --testnet --fast --rpc --rpcapi eth,net,web3,personal

Then, unlock that geth account with the following commands in a new tab:

^ This one will open your geth console

personal.unlockAccount(eth.accounts[0])

^ this one will unlock the account in geth so it will be able to spend its Ropsten Ether

Now go back into your Truffle folder with your compiled smart contract and run this command:

truffle migrate --network ropsten

You should see this output :

Using network ‘ropsten’.

Running migration: 2_deploy_contracts.js

Deploying EtherGoods…

… 0x1f61eb2b7ab998141354dbfcc0c37cc3da2938d3f8fe924d0ed159e635a9bbea Saving successful migration to network…

… 0xb5c8dda5b50986020ceaa1989d47d71b12845a854d722919fbd685878e0e8b72

YOU ARE A ROCKSTAR

.-"`'"-.

/ BURR \

| |

/'---'--`\

| |

\.--.---.-./

(_.--._.-._)

\=-=-=-/

\=-=-/

\=-/

\/

Heres an extra goodie for you: sample code for a button that calls a smartcontract function using Metamask:

https://gist.github.com/admazzola/7c62a4a4c6724773f9d61c71a243b3a5