Skip to content

Latest commit

 

History

History

tutorial-28

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Getting going

Ganache + MetaMask

  1. First, start up Ganache
  2. Click on settings (cog top right)
  3. Go to the "Accounts & Keys" tab
  4. Set the Mnemonic to match the seed words generated by MetaMask under settings and "Reveal Seed Words"
  5. Restart Ganache
  6. Test your Metamask connection to Ganache

Truffle

You'll first need to set-up the contract before we can continue.

To build and migrate the contract run the following:

$ cd solidity
$ truffle migrate

Once it has migrated make note of the contract's address.

The output will look like this:

Using network 'development'.

Running migration: 1_initial_migration.js
  Deploying Migrations...
  ... 0x5231df496194ed312b63b352b48b8ed1d51cf43ca472565d4eebff80a2dcb1e5
  Migrations: 0x2411aa047ca7be82a189f8268dfea2009b7ab670
Saving successful migration to network...
  ... 0x39712854c026802e7a65af5928a78b1b6309f0e71e14366f6cb286b8907ae33d
Saving artifacts...
Running migration: 2_deploy_contracts.js
  Deploying AddressBook...
  ... 0xc8f0c50442fe056eb667d20a31ea5f317e92784af10d1c7147e78d5788c50087
  AddressBook: 0x897c95fed51d8b89a8a57d8bbe7f1522bf530571
Saving successful migration to network...
  ... 0x1c98ffba8159a5eeb0b4af3d51028884c0ca7c611c0213330cbb7573c7268faa
Saving artifacts...

You just need the part which says:

AddressBook: 0x897c95fed51d8b89a8a57d8bbe7f1522bf530571

In public/src/scripts/controllers/addresses.js paste this address on line 12 wrapped in quotes.

This will have also generated a directory called build. If you change the structure of the address book contract you will need to:

  1. Inside solidity/build/contracts/AddressBook.json there is a json structure, at the first level there is an "abi" object
  2. Copy the entire value of this abi into public/src/scripts/contracts/addressbook.json

Node

Now you've set-up Truffle we can build the web application.

The first thing we will need to do is get grunt installed by running:

$ cd public
$ npm update
$ grunt

This will build, minify and serve the application at http://localhost:8000