Preface
To get started, you need Ubuntu Linux running. An easy way is to- install VirtualBox on your machine;
- install Ubuntu there.
Then you need to install
- Solidity (object-oriented programming language for writing smart contracts);
- Geth (command line interface for running a full ethereum node implemented in Go).
$ sudo apt-get install software-properties-common $ sudo add-apt-repository -y ppa:ethereum/ethereum $ sudo apt-get update $ sudo apt-get install geth solc
Check your installation:
$ solc --version $ geth versionSee more details here.
Solidity Deployment
Synchronize blockchai:$ geth --rinkeby --fastThis will take a couple of minutes. Once you see something like this in the terminal, you are up to date (note that an average block time is 15s):
INFO [08-01|14:53:24] Imported new chain segment blocks=1 txs=1 mgas=0.021 elapsed=1.998ms mgasps=10.505 number=638703 hash=273388…bd5211Then you can CTR-C.
To launch the CLI:
$ geth attach $HOME/.ethereum/rinkeby/geth.ipcCreate an address (account) on the Rinkeby testnet:
$ geth --rinkeby account newEnter password and save address.
Start Geth:
$ geth --rinkeby --rpc --rpccorsdomain '*' --rpcapi "eth,net,web3,personal" --unlock 0 --password <(echo XXX)
Go to:
- http://ethereum.github.io/browser-solidity/
- change "Environment" (top right) from "JavaScript VM" to " Web3 Provider" (uses http://localhost:8545).
- Go to https://www.rinkeby.io/ and click "Crypto Faucet".
- You need a GitHub account.
- Login to create a Gist: description and filename can be anything, however, the first line (starting with "1") needs to contain the address you generated above, preceded by "0x" (see example).
- Refresh the GUI at http://ethereum.github.io/browser-solidity/ (and choose "Web3 Provider" again)
Now you should have an account balance showing a few ether.
Deploy Test Contract
Set up:- In http://ethereum.github.io/browser-solidity/ add a new contract (plus sign top left).
- Fill in example code from here.
- Click "Create" (orange/pink button right-hand side).
- Wait for transaction to be mined.
- Check terminal synchronizing blocks: you should see the address of the new contact "contract=0x0498b6289f48e28124ec23c30993fcf59af22092".
- You should have less ether (top right).
- Check contract address in https://rinkeby.etherscan.io/.
Play:
- You should have buttons in the browser on the right-hand side (http://ethereum.github.io/browser-solidity/) corresponding to the getter and setter functions.
- Enter in "set": 2,"MyAddr",42
- Entering 2 in "getAmount" or "getAddr" should return "42" and "MyAddr", respectively.
Create ERC20 Token
- Copy code from here into http://ethereum.github.io/browser-solidity/.
- Deploy contract with "Create" button ("browser/myToken.sol/MyToken").
- Check "totalSupply" button.
- Check your balance by putting your account address you generated with Geth above into the "balanceOf" field (right-hand side). NB: address is in quotes and add "0x" if missing in the beginning of the string.
- Check contract address (from synchronization terminal or "Copy address" button in browser) in
Voila, you just did an ICO and transferred some tokens.
See my example token (original address and my parity wallet).
1 comment:
Good information
Thank you @ Being Lgends
Post a Comment