Skip to content

Greeter is a "Hello World" project for prospective Blockchain at Berkeley Developers

Notifications You must be signed in to change notification settings

BerkeleyBlockchain/greeter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ethereum "Hello World"

Hello! this project is for prospective Blockchain at Berkeley Developers. You should complete this before 2nd round interviews -we will be testing you on some of this.

Objective:

Your task is simply to output the following in your console via the tools/frameworks below:

"Hello World"

To do so you must

  1. Download this repository
  2. Download the required software dependencies
  3. Complete and compile the provided Greeter.sol "Hello World" smart contract
  4. Deploy the smart contract to a test blockchain
  5. Use truffle console then call the deployed contract's greet() function

Note: You will only be required to edit Greeter.sol

First, a brief introduction on each of the tools we will be using and the versions that you will need to download:

Windows Users go HERE

  1. Node.js (v8.4.0 or greater)— a Javascript runtime for easily building fast and scalable network applications
  2. Npm (v5.0.3 or greater) — Node.js’ package ecosystem. If you already have Node.js you can simply type: npm update into your terminal.
  3. Truffle Framework (v3.4.9 or greater) — npm install -g truffle *note the -g tag installs truffle globally so don’t worry about being in any specific directory. ***if you get permission errors, run the above command as root/admin. Truffle is a development framework for Ethereum that has built in smart contract compilation, linking, and deployment. In my opinion, these are some of the hardest technical concepts for a Solidity developer.
  4. Testrpc (v4.1.1 or greater) — npm install -g ethereumjs-testrpc This will be our blockchain on which we will deploy and mine your contracts from truffle. Specifically testrpc is an Ethereum client for testing and developing. It comes with the ability to play with accounts pre-filled with millions of dollars worth of Ether (sorry you can’t keep it) and customize everything from hostnames to gasPrice.

Compile Greeter.sol

Greeter is a simple smart contract in solidity that prints a greeting when poked. It can be found in the /contracts/ folder. Your task will be to implement the Constructor and greet() functions in Solidity. The Solidity documentation can be found HERE it will be your best friend when developing blockchain applications.

After you finish implementing:

  1. In an empty terminal, run testrpc to initialize a default testrpc server. If you get errors, read the Testrpc documentation
  2. In a separate terminal, compile your Greeter smart contract with truffle compile. Truffle documentation

Testing

You can verify that your smart contract is implemented correctly with truffle test. Be sure to have a testrpc server running in a separate terminal.

Truffle Console

Once your greeter passes the test:

  1. Run truffle migrate. (Dont worry about migrations, we will teach you everything once you've joined B@B)
  2. Run truffle console. This will open up a Node JavaScript console that is connected to your testrpc server. Find a way to reference the Greeter smart contract that you deployed and call both the Constructor and greet() functions. Truffle console docs

If your greeter returns "Hello World!" when prompted, then you have successfully completed the project. However, know that you will be tested not only on the functionality of your code, but your ability and knowledge of the tools and frameworks used in Ethereum Development.

Stuck?

Contact us at [email protected] or come to office hours: Monday, September 11th 3pm - Late in Moffit 1st floor Makerspace & Tuesday, September 12th 5pm - Late in Moffit 1st floor Makerspace. We will be wearing B@B jackets. Email us if you can't find us.