Ethereum Wallet
Ethereum Wallet
2 Ethereum Wallet
•State Variables: These are the variables that are used to store the state of the
contract.
• 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.