Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
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
 Bhaskar Bhaskar
Author Profile Icon Bhaskar
Bhaskar
Arrow right icon
View More author details
Toc

Gas versus gas limit versus gas price


One of the most common concepts to get your head around is the the difference between gas, gas price, and gas limit. Knowing the difference between these different things is crucial. Let's start with gas.

Gas

Every transaction you do costs gas. What's gas? Well, it's the fuel needed to execute a transaction, denominated in Gwei, which is usually equal to 1*10-9 ETH. Recall the smallest denomination of ETH, wei, which is 1*10-18 ETH, that denominates the amount you will be paying for the transaction.

As we've seen before, you can specify a gas amount in a transaction. We've done this before using web3. Recall that in Chapter 6, Testing Your Dapp, we had the following line:

instance.reward(recipient, REWARD_WEI, { from: recipient, gas:3000000 })

As you can see, we specify a gas of 3000000

We can also specify gas in our truffle.js file, as we've seen in Chapter 4, Migrating Your Dapp to Ethereum Blockchains:

// Allows us to use ES6 in our migrations and tests...
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 £13.99/month. Cancel anytime
Visually different images