Hello,
I do not like long introductions. I'm from Poland. I'm computer programer very interested in programming Ethereum Smart Contracts. I've registered here because I want to see how Steemit works, because from what Ive heard It's really cool.
I want to show how easy programming on Ethereum can be.
So Let's Start!
What do You need for programming on Ethereum Blockchain?
Well...........Chrome Browser. and thats it!.
What can You use Ethereum Blockchain For?
Everything, anything. Ethereum is Turing complete what means any alghoritm can be runned on it.
How to start
- Download and install Chrome
- Install Metamask Plugin
- Configure Metamsk like in this movie
- Go to Rinkeby Ether Fucet to get some test ether
- Go to Remix IDE and start coding!
Ok, but what we can we code?
Let's start with something simple but usefull
Let say You and Your friend work on the website together and You want to recive donations in ether and split it 60% to You (you also need to maitain a server so it is more work to do!) and 40% to Your friend (he participate in creating a content)
Your address is
0x59A5aC4033dB403587e8BEAb8996EDe2F170413a
And your friend
0xAF97e87375d97F45b1C5F4ea4cC87650f640581F
Doing an Exercise change addresses to two You own (or Your and Your friend!)
You want to create contract address that sends 60% of any transfer to You and 40% to Your friend
Code looks like that:
contract EthSpliter {
address YourAddress = address(0x59A5aC4033dB403587e8BEAb8996EDe2F170413a);
address YourFriendAddress = address(0xAF97e87375d97F45b1C5F4ea4cC87650f640581F);
function () public payable{
YourAddress.transfer(msg.value*60/100);
YourFriendAddress.transfer(msg.value*40/100);
}
}
First let us look how to deploy that contract
Remember Remix IDE? Go there and paste that code instead of what it is there now
Now Click >>Start to Compile<<
And go to Run Tab
Choose in environment >>Injected Web3<<
if You installed Metamask properly and You are logged in with Rinkeby Test Net (Left upper corner of Metamask window)
You should see Your Account address and some ether as a balance
Click Red Button >>Create<<
now in the bottom window you should see " creation of browser/ballot.sol:EthSpliter pending..."
when the transaction is finished You will se some more lines popping out and also
contract with address on the right
See >>(fallback)<< button?
You can click it, but first set >>Value<< To 1 - that will cause to send 1 Eth to the contract
Metamask will Pop-up
confirm transaction.
You can click Metamask icon and then a line with transaction - it will redirect You to Etherscan Page with transaction.
When Transaction is Finished You will see that 0.6 Eth went from sender address to YourAddress You set in a contract and 0.4 Eth Went to YourFriendAddress .
This app will be work forever ! Easy ?
In Part II I will Explain differrent Parts of code and Give some more hints about tools.
Please Comment, what You want to see, how to improve this posts, what was unclear?. Any advices appreciated!
Cheers