Kleiner Perkins: A First Look at Ethereum

Kleiner Perkins: A First Look at Ethereum

A few months ago, the developer preview was released, and as investors focused on blockchain technology, we’ve seen a number of companies building things on the Ethereum ecosystem. For starters, Ethereum is “a decentralized platform for running smart contracts.” You can learn more about it on the Ethereum website, and there’s a good overview on Wikipedia that outlines the most important features of Ethereum. We wanted to get familiar with Ethereum the way we know best - do some demos and see what’s possible with the platform. Here, we share some simple commands to get started with Ethereum, as well as some ideas that got us excited. We also opened more complex contracts, which will be discussed in subsequent posts over the next two weeks.

Although Ethereum is relatively new, we are excited to see that it has already spawned a number of applications, and even more exciting is that we have directly observed strong developer adoption of the technology in recent months. We believe that Ethereum is a strong addition to the blockchain development toolchain, allowing users to easily use distributed computing and shared storage, and is censorship-resistant and anti-tampering. The project also urges us to implement the Ethereum Virtual Machine (EVM) on other blockchains, such as Rootstock and Counterparty. We believe this is a harbinger of the convergence of EVM bytecode as a general low-level contract language, but only time will tell whether EVM bytecode can become a mainstream contract language and whether Ethereum can remain the most commonly used implementation of the EVM. In our view, the existence of projects like these can reduce the platform risk faced by entrepreneurs when developing products on Ethereum.

What excites us most is that many companies are using blockchain as a fancy architecture that is sitting in the back room for adoption and is invisible to the end user. From a user perspective, we believe these services will be cheaper, faster, and more secure than ever before (more on this in the blog on blockchain technology investment topics). We think Ethereum as a software platform significantly increases the number of ways blockchain technology can be used in applied technology.

If you are a founder using blockchain technology, we welcome a chat!

Install Ethereum

Note: These demonstrations were written and executed on an OS X machine, but the same commands can be run on a Linux machine without modification, and only require minor adjustments on a Windows machine. These commands assume that the reader has a basic understanding of Ethereum, how blockchain works, and a good grasp of software engineering.

To get started, follow the instructions below to install an Ethereum client. Once installed, you will need to sync the Ethereum blockchain to your machine using the `geth` command in a shell with no arguments (this means it will be run as a background process, but for local testing I found it easier to run it in an interactive shell). Syncing the blockchain can take a while, and you can see the progress by looking at the number of blocks displayed at the end of the background process's log messages, and comparing it to the totals on the Ethereum dashboard. The rest of the demo assumes that your background process is running, so leave this shell window open in the background.

During your blockchain sync, you can open a local Ethereum account. You need to have some Ethereum's base currency, Ether, stored in a local wallet to enter into contracts. Ether is Ethereum's computational currency, which is used to enter into contracts and interact with contracts in units of "fuel", which is dynamically priced on the network. The currency fuel price can be viewed in the Ethereum dashboard above.

In the second shell window, run the command `geth account new`, set the account password, and confirm the reply address. There is more introduction to account opening and management in the Ethereum documentation.

Now you need to buy some Ether on a market like Poloniex or Cryptsy (if you already have some Bitcoin, you can convert it to Ether on an exchange), or you can follow the instructions on the Ethereum website to get Ether and transfer it to your local account address. A small amount of Ether is enough to get started - running the following demo only requires 0.1 Ether, which is about $0.10 at the time of writing.

You can check if your block count matches the Ethereum dashboard linked above. Once your blockchain is synced and you have a little ether in your account, you can make your first contract. You can open the Ethereum console to check your balance. In a new shell window, type the command "geth attach". Running `geth attach` is your entry point to the Ethereum javascript console, which provides a basic javascript execution environment and adds some Ethereum extensions. The full command manual is on the Ethereum Wikipedia.

Deploy your first contract

To make you more familiar with the contract deployment process, I suggest deploying a simple Hello World contract, which I found from the vast Ethereum contract tutorial:

This contract is written in Solidity, a Javascript-like language that is converted into bytecode and can be run on the Ethereum virtual machine. The receptionist contract will return a string that we provide, in this case something like "Hello, world!" When we end the contract, the "mortal" class can simply stop the contract and send the funds specified in the contract to the address that created it. The eternal contract can be used as a base class for any contract you want to make - Solidity supports a full inheritance model for contracts.

If you deploy this contract, you need to compile it into EVM bytecode. It is safe to install a compiler locally, because online compilers may produce unexpected code. For example only, we still use the web version of Solidity compiler.

Assuming you use the web compiler, all you need to do is paste the receptionist code into the editor and get the compiled bytecode on the right. Conveniently, the right panel contains a Javascript widget that runs in the Ethereum JS console, titled "Web3 deploy". Note that you need to fill in the welcome message at the top of this widget and then run it in the Ethereum console. You will still need this widget interface later.

Now, open a new Ethereum JS console in a new shell by running the command `geth attach` and paste the Web3 deployment tool. After a few minutes, you will see a message saying "Contract mined" with the address where the contract is saved. This way you have deployed your first Ethereum contract - congratulations!

You can also view your contract in the announcement block browser tool, such as here, where you can search for the hash of the transaction and see the deployed bytecode. Write down this address, you will need it when you interact with the contract.

In the same console as when interacting with the contract, run the command `greeter.greet();` and you will get the string you entered before. Since this does not require running any code on the blockchain, the operation costs 0 energy. The `greeter` object is instantiated when you paste it into the Web3 deploy code tool, but it can also be built separately so that anyone can run it without a local copy of the source code.

To show how a friend might run the same contract in their local Ethereum code, let's run the same contract in a new console environment. Exit the Ethereum console using the `exit` command and re-run the `geth attach` command to open it. To verify that you are in a new console environment, you can run the `greeter.greet()` command and you will get a reference error indicating that the greeter mentioned is not defined. Now instantiate a new greeter by running `var greeter = eth.contract(ABI).at("Address");`, where ABI is the interactive tool created by the Solidity compiler earlier and Address is the address that the previous contract was mined. You can then run "greeter.greet()" and get the same message as before.

An important note here is that the string you wrote down can now be stored on the blockchain and can be accessed by anyone. You can even create a function that only you as the contract owner can change.

I have another greeter at address "0xb55f89461a273f8dbde74a92cdc752d86427476b" that uses the same interactive tool that the Solidity web compiler provides for your welcome contract. As a bonus, you can run the functions in the contract and see the information I wrote in the contract.

From a technical developer's perspective, this is trivial, you are running a simple hello world program, it outputs what you expect. Interestingly, this code is already built into the Ethereum blockchain, giving you access to highly distributed, censorship-resistant, and anti-corruption storage and computation, without requiring you to create your own distributed infrastructure.

If you need to kill your contract, you can run `greeter.kill.sendTransaction({from:"ACCOUNT_ADDRESS"})`, where ACCOUNT_ADDRESS is the address you got when you created your account. After killing, your greeter will no longer run.

I've gone into some detail here, and hopefully it'll spark your interest in learning more. It's impossible to cover everything we've built in one post, so we'll continue to post more in the coming weeks.

Original article: https://medium.com/@kpcb_edge/our-thoughts-on-ethereum-31520b164e00#.60j5046bc
Author: KPCB Edge
Translator: gsj
Reward address: 1DHs7hZMdx6tgUHdqXiub3XrovrF6Pte7y
Editor: printemps
Source (translation): Babbitt Information (http://www.8btc.com/thoughts-on-ethereum ‎)


<<:  Nexuslab Switzerland: Blockchain startup training camp

>>:  Estonian High Court Asks Government to Clarify Stance on Bitcoin

Recommend

Bitcoin reputation startup Bonafide shuts down

Bitcoin reputation startup Bonafide has chosen to...

Why does MicroStrategy, a US listed company, keep buying Bitcoin?

Original article by Biraajmaan Tamuly Compiled by...

Opinion | Bitcoin price bull run may last 1,000 days

Source: Blockchain Pencil By William Suberg Compi...

How to look at eyes and face analysis

Eyes are the windows to the soul and are also the...

What does it mean for a boy to have no earlobes?

Different facial features actually have different...

Is Bitcoin an efficient market? | How do good and bad news affect the market?

one Do you think the current Bitcoin market is a ...