Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Truffle Quick Start Guide

You're reading from   Truffle Quick Start Guide Learn the fundamentals of Ethereum development

Arrow left icon
Product type Paperback
Published in Jun 2018
Publisher Packt
ISBN-13 9781789132540
Length 170 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Author (1):
Arrow left icon
Nikhil Bhaskar Nikhil Bhaskar
Author Profile Icon Nikhil Bhaskar
Nikhil Bhaskar
Arrow right icon
View More author details
Toc

Web3 in Truffle

Now that we have a clear understanding of web3 in an isolated environment, it's time to get out of our comfort zone and see how it interacts with Truffle. We've already seen a bit of this in Chapter 1, Truffle for Decentralized Applications.



Let's refer back to our app.js file under chapter1/app/javascripts/ (https://github.com/PacktPublishing/Truffle-Quick-Start-Guide/blob/master/chapter1/app/javascripts/app.js).

Let's see how we import web3:

import { default as Web3} from 'web3';

Now, let's see how we set the blockchain network provider for web3:

window.web3 = new Web3(new Web3.providers.HttpProvider("http://127.0.0.1:9545"));

Remember how we simply glossed over this in Chapter 1, Truffle for Decentralized Applications? Hopefully, you now have a better understanding of what's going on here. Since we don&apos...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image