Ethereum Wallets Explained Simply (Smart Contracts, Gas, Transactions)

What are the best
Ethereum wallets out there? How do Ethereum wallets work and what’s their purpose? What is Gas
and how is it calculated? Well stick around, in this episode of
Ethereum whiteboard Tuesday we’ll answer
these questions and more. Hi, I’m Nate Martin
from 99Bitcoins and today we’re going to
talk about Ethereum wallets – those pieces of software,
or hardware, that allow us to interact with
the Ethereum network. At its core, an Ethereum wallet,
also known as a client, holds your private key – the “secret password”
that gives you control over your coins. It also supplies you with
a public Ethereum address which people can use
to send you Ethereum’s currency known as Ether. This is almost as far as
Bitcoin and Ethereum go in terms of similarities. Many non technical users
think of Ether as a currency in the same sense
they view Bitcoin. They buy Ether in hopes
its price will rise, they pay for stuff with Ether
and more.

However, Ether wasn’t designed
for the same purpose as Bitcoin. If you’ve watched
our previous video “What is Ethereum?” and if you didn’t you should, you know that Ethereum is
a network of independent computers working together
as one supercomputer. This super computer
executes pieces of code known as contracts
or smart contracts. Interacting with contracts
requires more complex communication than to just send X amount of money from Y to Z like Bitcoin does.

Ethereum wallets
are the tool we use for this communication . So in order to truly
understand Ethereum wallets we need to first understand
how Ethereum is built. In Ethereum there are
two types of accounts: The most basic type of account
in Ethereum is called an EOA or Externally Owned Account. Similar to how
a Bitcoin wallet operates, EOAs have an Ethereum address
that is controlled by a private key. A person can open
as many EOAs as he likes. In addition to sending
and receiving Ether, EOAs have the ability to
create contracts and trigger them. The second type of account
is the Contract account. These are accounts that have code
associated with them. Every contract deployed to
the Ethereum network has its own account which includes
a unique Ethereum address. However,
unlike an external account a contract account doesn’t have
a private key that controls it. So how is a contract account controlled? Well, the code that
defines the contract includes a set of
predefined triggers which control the account.

In other words, the conditions to control
how the contract operates are hard coded from the get-go. Similar to EOAs, contract accounts
can receive Ether, and if triggered, send Ether or even create
additional contract accounts. It’s important to note that contracts can’t be changed
once they’ve been launched, so the author
must be very thorough in drafting the conditions
for each trigger. EOAs can interact with other EOAs and with contracts
through messages. These messages are
“wrapped” inside transactions which are paid for in Ether. So while in Bitcoin transactions are used
only to transfer value, Ethereum transactions
are used for a variety of reasons: First, transactions are used for
the transfer of value. This is the simplest
form of transaction, meaning sending Ether
between accounts. You can also use transactions
to create a new Smart contract. Creating a new contract is done by sending a transaction
that includes the contract’s code. And finally, transactions can be used
to trigger a contract. For example – when you send money to
an ICO’s contract account address, you’re actually
activating a contract that sends you tokens in return.

Now that you understand
how Ethereum is built and that transactions
are in fact used to help accounts talk to each other we can move on to
Ethereum wallets. Some Ethereum wallets
will only allow you to transfer value, or send Ether between accounts. Other wallets will allow you to
also deploy or trigger a contract. These wallets are known as
“Smart contract wallets”. Similar to Bitcoin, wallets are sometimes
referred to as clients or nodes. There are two types of clients – full clients and light clients A full node is
a computer that holds the entire Ethereum
blockchain history, since its inception until this day. Running a full node
has disadvantages like increased memory
and computer usage, however it allows you to verify transactions on
the Ethereum blockchain without needing to
trust anyone’s word for it. Full nodes are an integral
part of the Ethereum network as they are
the “muscles” of the network, that help execute contracts
in a decentralized manner. Each node that receives
a new block of transactions also executes the code
inside these transactions.

There are different programs to help you run
an Ethereum full node. We won't discuss all of 'em, however we will talk about
the most common clients: The first on is Geth – Short for Go Ethereum. Developed by
the Ethereum Foundation, a non-profit organization
established to develop the code and community
for Ethereum. Geth is the most popular
and widely used program. The second is Mist – Since Geth is a tool
made for developers Mist was created
in order to allow non technical users
to interact with it. So while technically
you’re using Geth, Mist provides you with
an easy user interface to talk to it.

And finally, Parity – which is a private company
based in London whose mission is to enable
businesses and organizations to capitalize on
blockchain technology. They developed software to run
full nodes for Ethereum and are considered
the second most popular full client. Just for reference, at the time of releasing this video there are 9713 nodes
running Geth and 4069 nodes running Parity. All full nodes
are smart contract wallets – meaning they can deploy
smart contracts to the Ethereum network.

If you don’t want to run
a full node you can use a light node. Light nodes,
similar to Bitcoin’s SPV wallets, are programs that rely on
3rd party full nodes in order to get information
when needed rather than holding
a full copy of the blockchain. This means
they require less space and can operate on
devices with limited space, such as mobile phones. Being the second largest currency by market cap
on the crypto market, Ether has caught
the eye of day to day users.

These users will usually
use light nodes as their wallet since it’s easier to
install and operate. If you don’t intend to write
smart contracts any time soon you can use any of
the light nodes listed on our website for the most user
friendly experience. Let’s talk a bit about
Ethereum hardware wallets If you're serious about security I suggest storing your Ether
on a hardware wallet. While being the most secure way
to store your coins, hardware wallets cost money.

Also, hardware wallets are not
smart contract wallets by design, they can only send
and receive Ether and ERC-20 tokens. Now let’s move on to
transaction fees and Gas; trust me, you’ll understand
in a few minutes. While Bitcoin can be divided into
100,000,000 units with the smallest unit called a Satoshi, Ether can be divided into
one quintillion units, that’s a 1 with 18 zeroes after it… with the smallest one called Wei. Wei is named after Wei Dai, a cryptography activist who is known for supporting
widespread use of strong cryptography and privacy-oriented technologies. Fees for transactions,
are usually calculated in Giga Wei. So 1 quintillion Wei equals 1 Ether and 1 billion Wei
equals one Giga Wei. There are also other names
for different amounts of Wei, all named after
famous cryptographers, as shown in this table. In Bitcoin, to send a transaction
we need to add a miner's fee to it. This way, we incentivize the miners to include it in a block. In Ethereum, we must keep miners incentivized as well, for their contribution of computing power
to the Ethereum supercomputer. Just like a car, the Ethereum network runs on Gas.

Each line of code that
needs to be executed by the network will take up a certain amount of gas. Run out of Gas
and the code stops running. You specify how much Gas
you’re going to use upfront, and you can’t refuel on the way. If your contract runs out of Gas
because it’s written inefficiently or you miscalculated, it will just stop
in the middle of the road. This system motivates
Smart contract programmers to keep their code
lean and optimized, since Gas costs money
as we will soon learn. The Gas you pay goes to the miners, as they are the ones
investing computing power in order to update
the ledger of Ethereum transactions, similar to what goes on in Bitcoin. Keep in mind that
Gas isn’t something you can own, it’s just a unit of account to measure how much work
is needed to run a line of code.

Think of it as
the equivalent of hours of labour. Gas is paid in Ether, Now I know what you’re thinking – why not just price
execution of smart contracts in Ether, why do we need
another virtual currency? Well, Ether’s price
is constantly changing, and if we priced contracts in Ether the price would be different
each time we calculated it due to the fluctuating exchange rate. Imagine we’d price
painting our house at 2 Ether, sometimes it would cost us $1000
and other times $2000. With Gas, running the same contract
several times will always bring back
a fixed amount of Gas to be paid just like painting the same house takes the same
amount of hours every time. So how much gas do you need
to run a line of code? Easy… there are predefined amounts for each action
you want to run in your code.

For example, sending Ether from
one address to the other requires 21,000 gas units. Now comes the tricky part. How much do you actually pay for a unit of gas? The price of 1 gas unit
changes all the time depending on how crowded
the network is. The same way an hour of labor
would cost more if many people are
looking for employees the Gas price rises
when the network is crowded. The “standard” gas price
is around 20 GiGa wei. You can consider this
the average salary on the market for an hour of labor. If the Ethereum network is very busy and you want your contract
to get priority in execution over other contracts you may over bid the gas price so that miners will have
an incentive to include your contract in the next block. You’re basically saying I’m willing to increase your pay
per unit of labor so you’ll give my work priority.

This is similar to
how Bitcoin transaction fees rise when the network is crowded. When you send a transactions in Ether you also need to specify a gas limit – meaning how much gas
are you willing to use at maximum for running your lines of code. This is done in order to protect you
from depleting your funds in case your code has an error
and runs endlessly or inefficiently.

You pay the full amount
for your gas limit upfront and there’s no option for “refueling”. This can cause certain things
to go wrong, for example: If you overpaid and your contract
ended up using less gas – you’ll get refunded for the gas not used. However, if an operation
ran out of gas mid way it will halt, just like your car, and no Ether will be returned to you just like a gas station
doesn’t refund you even if you didn’t have enough gas
to get where you want to go. This can happen if, for example, your contract needs to do
some recurring function that keeps on consuming gas
and finally runs out.

If you don’t include enough
gas units for running your code no miner will pick up your transaction since it doesn't have
enough gas from the get go. And finally – If you choose
enough units of gas but pay very little for each unit it may take a lot of time
for your transaction to go through since miners will prioritize
higher paying transactions. To conclude, in Ethereum fees are
a general term that refers to the gas used multiplied by
the gas price you were willing to pay. In other words – the hours of labor worked
times the wage per hour.

The higher you’re
willing to pay per gas unit the more miners will compete
for running your code, and the faster your transaction
will be included in the blockchain. That’s it for today’s video. Hopefully by now you have a better understanding
of Ethereum's wallets, Ethereum accounts,
gas, transaction fees and also the various wallets
you can choose from. As you probably noticed Ethereum is a lot
more complicated than Bitcoin mainly because it’s intended on executing much more complex functions than just sending money
from A to B. Don’t worry, it gets worse, but we’ll walk you through it as always in our upcoming videos. You may still have some questions. If so, just leave them
in the comment section below.

And if you’re watching
this video on YouTube, and enjoy what you’ve seen, don’t forget to hit the like button. Then make sure to
subscribe to the channel and click that bell so that you’ll be notified
as soon as we post new episodes. Thanks for joining me
here at the Whiteboard. For,
I’m Nate Martin, and I’ll see you… in a bit..

You May Also Like