0% found this document useful (0 votes)
13 views17 pages

Ethereum Wallet

An Ethereum Wallet is a software application that allows users to manage their Ethereum accounts, utilizing private keys for security and transaction management. Smart contracts, written in Solidity, enable automated transactions on the Ethereum blockchain without third-party interference, ensuring transparency and trust. However, vulnerabilities such as integer overflow and underflow can pose risks to smart contracts, necessitating careful coding practices.

Uploaded by

lokeshkonatala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views17 pages

Ethereum Wallet

An Ethereum Wallet is a software application that allows users to manage their Ethereum accounts, utilizing private keys for security and transaction management. Smart contracts, written in Solidity, enable automated transactions on the Ethereum blockchain without third-party interference, ensuring transparency and trust. However, vulnerabilities such as integer overflow and underflow can pose risks to smart contracts, necessitating careful coding practices.

Uploaded by

lokeshkonatala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

4.

2 Ethereum Wallet

An Ethereum Wallet is a type of software application that allows users


to interact with their Ethereum Account on the Ethereum Network or
the Ethereum Blockchain. Ethereum Wallets are controlled through a
password or a private key that allows users to send or receive funds or
transactions within the wallet. These private keys are only available to
the owner of the wallet due to privacy as anyone who knows the private
key can access the wallet and hence also access their funds. Ethereum
Accounts are used to create smart contracts, interact with decentralized
applications, and are used to run applications smoothly without any
fraud, downtime, or third-party interference.
What is the Ethereum Wallet
Address?
• Ethereum Wallet Address is a distinct alphanumeric crypto identifier that
contains 42 hexadecimal characters that start with 0x and is followed by
a series of 40 random characters which can send transactions and has a
balance in it.
• For example, 0xdB055877e6c13b6A6B25aBcAA29B393777dD0a73 is a
type of Ethereum address.
• The unique address is required to receive funds from another
cryptocurrency network and to access it, you should have your own
private key.
• In order to access your private key, you must have your own wallet such
as MetaMask, CoinBase, or TrezorOne to name a few.
What is a Private Key?
• A private key is a secure and secret number that helps users to secure their digital
money and also allows them to make transactions and generate the receiving
addresses.
• It is an integral part of the Ethereum Network as this secret number acts as a
secure password that protects the user from unauthorized access to their funds.
• A private key provides a very high level of security as it can take years and years to
crack a private key.
• The private key is only known to the user and is used to carry out any
cryptocurrency transaction from their account.
• Private keys can derive public keys and hence public keys can derive Ethereum
addresses but the same cannot be said for vice-versa as it is not possible to derive
public keys from Ethereum addresses and private keys from public keys.
Why do we Need a Private Key?
• There are several reasons why a private key is required:
• Private keys are secure codes and are not meant to be given to
anyone but users need a method by which they can allow other users
to find their assets and vice-versa.
• As a result, we use Ethereum addresses that are derived from private
keys which we can share with other users to know our cryptocurrency
assets and balance.
• To create an Ethereum address, we need a public key which is derived
from a private key.
Introduction to Solidity
• Solidity is a brand-new programming language created by Ethereum which is the
second-largest market of cryptocurrency by capitalization, released in the year 2015
and led by Christian Reitwiessner. Some key features of solidity are listed below:
• Solidity is a high-level programming language designed for implementing smart
contracts.
• It is a statically typed object-oriented(contract-oriented) language.
• Solidity is highly influenced by Python, c++, and JavaScript which run on the Ethereum
Virtual Machine(EVM).
• Solidity supports complex user-defined programming, libraries, and inheritance.
• Solidity is the primary language for blockchains running platforms.
• Solidity can be used to create contracts like voting, blind auctions, crowdfunding,
multi-signature wallets, etc.
Smart Contract
• Smart contracts are high-level program codes that are compiled to
EVM byte code and deployed to the ethereum blockchain for further
execution. It allows us to perform credible transactions without any
interference of the third party, these transactions are trackable and
irreversible. Languages used to write smart contracts are Solidity (a
language library with similarities to C and JavaScript), Serpent (similar
to Python, but deprecated), LLL (a low-level Lisp-like language), and
Mutan (Go-based, but deprecated).
• Example: In the below example, we have discussed a sample solidity
program to demonstrate how to write a smart contract in Solidity.
Solidity
Solidity Contracts Contracts
are like a class in any other object-oriented programming
language.
They firmly contain data as state variables and functions which can modify these
variables.
When a function is called on a different instance (contract), the EVM function call
happens and the context is switched in such a way that the state variables are
inaccessible.
A contract or its function needs to be called for anything to happen.

Some basic properties of contracts are as follows :


•Constructor: Special method created using the constructor keyword, which is
invoked only once when the contract is created.

•State Variables: These are the variables that are used to store the state of the
contract.

•Functions: Functions are used to manipulate the state of the contracts by


modifying the state variables.
Creating a Contract
Creating contracts programmatically is generally done by using
JavaScript API web3.js,
which has a built-in function web3.eth.Contract to create the
contracts.

When a contract is created its constructor is executed, a constructor


is an optional special method defined by using the constructor
keyword which executes one per contract. Once the constructor is
called the final code of the contract is added to the blockchain.
Syntax:
contract <contract_name>{ constructor()
<visibility>{ ....... } // rest code }
Smart Contract
• Smart Contract (or cryptocontract) is a computer program that
directly and automatically controls the transfer of digital assets
between the parties under certain conditions. A smart contract works
in the same way as a traditional contract while also automatically
enforcing the contract. Smart contracts are programs that execute
exactly as they are set up(coded, programmed) by their creators. Just
like a traditional contract is enforceable by law, smart contracts are
enforceable by code.
Features of Smart Contracts

• Distributed: Everyone on the network is guaranteed to have a copy of all the conditions
of the smart contract and they cannot be changed by one of the parties. A smart
contract is replicated and distributed by all the nodes connected to the network.
• Deterministic: Smart contracts can only perform functions for which they are designed
only when the required conditions are met. The final outcome will not vary, no matter
who executes the smart contract.
• Immutable: Once deployed smart contract cannot be changed, it can only be removed
as long as the functionality is implemented previously.
• Autonomy: There is no third party involved. The contract is made by you and shared
between the parties. No intermediaries are involved which minimizes bullying and
grants full authority to the dealing parties. Also, the smart contract is maintained and
executed by all the nodes on the network, thus removing all the controlling power from
any one party’s hand.
Features of Smart Contracts
• Customizable: Smart contracts have the ability for modification or we can
say customization before being launched to do what the user wants it to
do.
• Transparent: Smart contracts are always stored on a public distributed
ledger called blockchain due to which the code is visible to everyone,
whether or not they are participants in the smart contract.
• Trustless: These are not required by third parties to verify the integrity of
the process or to check whether the required conditions are met.
• Self-verifying: These are self-verifying due to automated possibilities.
• Self-enforcing: These are self-enforcing when the conditions and rules are
met at all stages.
How Do Smart Contracts Work?
• A smart contract is just a digital contract with the security coding of the
blockchain.
• It has details and permissions written in code that require an exact sequence of
events to take place to trigger the agreement of the terms mentioned in the
smart contract.
• It can also include the time constraints that can introduce deadlines in the
contract.
• Every smart contract has its address in the blockchain. The contract can be
interacted with by using its address presuming the contract has been broadcasted
on the network.
• The idea behind smart contracts is pretty simple. They are executed on a basis of
simple logic
How Smart Contracts Work?
Advantages of Smart Contracts

• Recordkeeping
• Autonomy
• Reduce fraud
• Fault-tolerance
• Enhanced trust
• Cost-efficiency
Some Attacks on Smart
contracts
Some Attacks on Smart contracts are programs running on top of blockchain platforms. They
interact with each other through well-defined interfaces to perform financial transactions
in a distributed system with no trusted third parties. But these interfaces also provide a
favorable setting for attackers, who can exploit security vulnerabilities in smart contracts to
achieve financial gain.
• A smart contract is basically a piece of code where the written code is publicly visible in the
blockchain, and transparent to anyone who is connected to the network.
• Upon fulfilling the conditions by the desired time, the contract gets triggered to execute
the digital transaction.
• Since the conditions are encrypted cryptographically, no party is able to alter the contents
of a contract.
• The immutable nature of blockchain also ensures that every single device connected to the
network contains a copy of the contract, thus securing a backup version of the contract.
The overflow and underflow attacks are classified as Integer overflows.
• What is Integer Overflow?
• In Solidity, there are 2 types of integers:
• unsigned integers (uint): These are the positive numbers ranging from 0 to (2256 – 1).
• signed integers (int): This includes both positive and negative numbers ranging from -
2255 to (2255 – 1).
• An overflow/ underflow occurs when an operation is performed that requires a fixed-
size variable to store the result of the operation.
• Overflow Situation:
• Consider an unsigned 8-bit integer variable uint8 a. This variable has a range from 0 to
255:
• uint8 a = 255;
a++;
• This results in an overflow error as the variable a can take values in the interval 0-255
then incrementing the value of a by 1 would result in an overflow situation.
• Underflow Situation:
• Consider an unsigned 8-bit integer variable uint8 a. This variable has a
range from 0 to 255:
• uint8 a = 0;
a–;
• This results in an underflow error as the variable a can take a value in
the range of 0-255 and decrementing the value by 1 would result in
code collapse.

You might also like