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.
Your task is simply to output the following in your console via the tools/frameworks below:
"Hello World"
To do so you must
- Download this repository
- Download the required software dependencies
- Complete and compile the provided
Greeter.sol
"Hello World" smart contract - Deploy the smart contract to a test blockchain
- Use
truffle console
then call the deployed contract'sgreet()
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
- Node.js (v8.4.0 or greater)— a Javascript runtime for easily building fast and scalable network applications
- 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. - 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. - 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.
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.
- In an empty terminal, run
testrpc
to initialize a default testrpc server. If you get errors, read the Testrpc documentation - In a separate terminal, compile your Greeter smart contract with
truffle compile
. Truffle documentation
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.
Once your greeter passes the test:
- Run
truffle migrate
. (Dont worry about migrations, we will teach you everything once you've joined B@B) - 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 andgreet()
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.
Contact us at tech@blockchain.berkeley.edu 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.