Our thoughts on Ethereum, continued

Dec 18, 2015 · 6 min read

Developer Adoption of Ethereum

Bitcoin repository count is blue, Ethereum repository count is red

More contract examples

Coin flip

contract mortal {
/* Define variable owner of the type address*/
address owner;
/* this function is executed at initialization and sets the owner of the contract */
function mortal() { owner = msg.sender; }
/* Function to recover the funds on the contract */
function kill() { if (msg.sender == owner) suicide(owner); }
contract coinflip is mortal {
function() {
var bet = msg.value;
var flip = block.timestamp; // semirandom (more below)
if (flip % 2 == 0)
msg.sender.send(2 * bet);


contract Coin {
// The keyword “public” makes those variables
// readable from outside.
address public minter;
mapping (address => uint) public balances;
// Events allow light clients to react on
// changes efficiently.
event Sent(address from, address to, uint amount);
// This is the constructor whose code is
// run only when the contract is created.
function Coin() {
minter = msg.sender;

function mint(address receiver, uint amount) {
if (msg.sender != minter) return;
balances[receiver] += amount;
function send(address receiver, uint amount) {
if (balances[msg.sender] < amount) return;
balances[msg.sender] -= amount;
balances[receiver] += amount;
Sent(msg.sender, receiver, amount);

Concluding thoughts


Written by


KPCB Edge is a team of builders, investing in seed stage founders working on emerging areas of technology. | www.kpcbedge.com

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade