Blockchain
Blockchain
Objectives
1. The sender, after sending a message, cannot deny later that they sent the message: - Non-
repudiation
2. Size of Block Header : - 80 Bytes
3. An offline wallet or cold wallet that is not connected to the network provides the highest
level of security for savings.
4. When the transactions are validated, new Bitcoins get mined and a maximum of 21
million Bitcoins can ever be produced.
5. Stream ciphers convert one symbol of plaintext into one symbol of ciphertext.
6. RC4 is not used in IP.
7. In DES, Size of the key is 56 bits.
8. If the output is a 256-bit hash value, then the output space can have a maximum of 2^256
values.
9. Blockchain was invented in which year? – 2009
10. Real world applications of blockchain: - Healthcare, Banking, Distributed clod storage.
11. Bitcoin is created by: - Satoshi Nakamoto.
12. Wallets is used for storing Bitcoin.
13. What is private key: - A key not to be given to public.
14. How blocks are linked in Blockchain: - Backword to Previous block.
15. ./network.sh down command to remove any containers or artifacts in blockchain.
16. Members of a Hyperledger fabric network enrol through a trusted MSP (Membership
Service Provider).
17. revert(): abort execution and revert state changes.
18. Smart contract automate a workflow, triggering the next action when conditions are met.
19. Distributed application, or dapp, typically describes a web- or smartphone-accessible
front end which GUI application that uses the EVM as its back end.
20. HyperLedger is a project of open source blockchain and its related application started in
December 2015.
21. Custom Token are similar to credit card rewards points today.
22. Gas cost of Operation name call is 20.
23. Ethereum does make provisions for one common use-case of smart contracts, which is a
subcurrency, a.k.a. token.
24. Ethereum and Bitcoin, the Merkle tree structure is used to record the transaction ledger in
each block.
25. Mining data can be stored in multiple formats
26. The price of ether is whatever the market dictates, and is predicated mostly on demand of
time on the EVM.
27. 60 million ETH were sold at prices varying from 1,000 to 2,000 ETH per bitcoin.
28. Mining can be defined as dedicating computational effort of a given version of history as
a correct one.
29. Solidity adheres to all the same syntactical regularities as JavaScript and C when it comes
to loops.
30. ecrecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) returns (address): Recovers address
associated with the public key from elliptic curve signature, returns 0 on error
1
Unit 2
1. Explain the concept What Ethereum Does?
In the abstract, open source blockchain networks such as Ethereum and Bitcoin are kits
that allow you to pop up an economic system in software, complete with account
management and a native unit of exchange to pass between accounts. Kind of like the
game Monopoly.
People call these native units of exchange coins, tokens, or cryptocurrencies, but
they’re no different from tokens in any other system: they’re a form of money (or scrip)
that is usable only within that system.
Blockchains work something like mesh networks or local area networks (LANs); they
are merely connected to other “peer” computers running the same software.
When you want to make one of these peer-to-peer (P2P) networks accessible through
a web browser, you need to use special software libraries such as Web3.js to connect
an application’s front end (the GUI you see in a browser), via JavaScript APIs, to its
back end (the blockchain).
In Ethereum, you can take this concept one step further by easily writing financial
contracts with other users inside the system. As you’ll see, these financial contracts are
called smart contracts.
2
3. What Smart Contracts (Really) Do?
There’s one term which will continue to pop up in Ethereum, and that is the notion of
a smart contract: some business logic that runs on the network, semi-autonomously
moving value and enforcing payment agreements between parties.
Smart contracts are often equated to software applications, but this a reductive analogy;
they’re more like the concept of classes in conventional object-oriented programming
When developers speak of “writing smart contracts,” they are typically referring to the
practice of writing code in the Solidity language to be executed on the Ethereum
network.
When the code is executed, units of value may be transferred as easily as data. As stated
in this chapter already, the promise of digital money is immense.
4. What are Virtual Machines, Exactly? Explain The Role of the Ethereum Protocol in
Banking.
A virtual machine (VM), in the Ethereum context, is one giant global computer
composed of constituent nodes, which are themselves computers too.
A virtual machine is an emulation of a computer system by another computer system.
Virtual machines can be created with hardware, software, or both. In the case of
Ethereum, it’s both. Rather than securely network thousands of discrete machines, as
with Fedwire, Ethereum takes the approach of securely operating one very large
machine that can encompass the whole Earth.
The Fedwire system is a settlement system with a user experience tailored to state-
chartered banks and their operators.
It makes little or no concern for the end user of a retail bank, for example; that’s the job
of the retail bank.
Software developers will recognize Fedwire as a “platform for banks.” What the bank
chooses to build on top of Fedwire (the customer experience, the online banking tools,
the brick-and-mortar branches, the financial products, and the cross-selling) is what
distinguishes it from other banks on the Fedwire system.
3
6. Explain Anonymity in Cryptocurrency.
Bitcoins and ether are not anonymous payment instruments. Anyone who knows your
public key can look on the blockchain and see the dates and amounts of transactions
coming in and out of your account.
From this data, they might be able to put together a pattern of transactions from which
they could deduce your activities.
Federal authorities are already using machine-learning transactions to decode spending
patterns on dark-market sites such as AlphaBay.
Anonymity, secrecy, and privacy in cryptocurrency are generally conflated by
newbies, sometimes with disastrous ends.
Bitcoin and Ethereum addresses are pseudonymous by nature; they’re not linked to
your real name or information.
But every transaction you send is public, in the sense that anyone can see the
transaction on the blockchain. This is why public blockchains are touted for their
transparency; if you know someone’s public key, you can look up all their transactions.
Data within smart contracts themselves are encoded but not encrypted. Encryption is
used only to hash large datasets and verify transaction senders and recipients.
However, you can encrypt data yourself before putting it into an Ethereum smart
contract, if you’d like to use the public Ethereum chains in a private manner.
4
Unit 3
5
3. Write note on Business Network Archive.
The business network model includes assets and the transactions related to these assets.
Hyperledger Composer needs the following to be packaged together: a network model
file, a JavaScript file (.js), an access control file (.acl), and a query file (.qry).
These files are definition files that generate your network. –
Network model (.cto): - This is the file that defines the assets, transactions, and
participants who can interact with these assets.
JavaScript file (.js): - This is the file that defines the transaction processor
functions. It is the chaincode.
Access control (ACL) (.acl): - This is the file that contains the access control
rules that define the rights of the different participants.
Query (.qry): - This is the file that defines the queries that can run in a network.
Hyperledger Composer takes these four files and creates a business network definition
that is packaged as an archive (.bna) file. The .bna files can be deployed on the
Hyperledger Fabric network.
6
5. Explain the concept EVM as Back End.
Software apps are typically discussed in two halves: the front end and the back end.
The back end usually refers to the database and the logic, the front end usually refers to
the part of the application the user sees.
In software interface design, controls is the general term for the little buttons, sliders,
dials, hearts, stars, thumbs-up icons, and any other little thing you can click to make
something happen.
Neither EVM nor the Bitcoin virtual machine are powerful today. The EVM will
continue to get faster as the core developers iterate toward a faster block time.
Although the EVM itself is a fully fledged computer, it is not yet a complete end-to-
end platform capable of hosting HTML/CSS interfaces; the most useful role it can play
is as the back end to a distributed application.
7
Unit 4
1. Why Is Cryptoeconomics Useful?
First and foremost, cryptoeconomics is about engineering a layer of defense between
public networks and attackers of all sizes.
It combines game theoretical system design, encryption, and cryptographic hashing to
protect a commonly used, commonly operated resource—in this case, a global
transaction state machine.
Because public chains are public, they need to be resilient against attackers with large
amounts of computing power.
Hence, networks with more nodes, and more geographically distributed nodes, owned
by discrete unlinked owners, are considered more secure.
Mining pools contribute to centralization, which is why any pool with larger than 25
percent hashpower is approaching the threshold of network threat.
Should two such pools emerge, they might quickly get control of a network. By using
the custom, ASIC-resistant Ethash algorithm and designing the network to quickly
increase in difficulty, the protocol designers ensured there would be little incentive for
miners to professionalize and consolidate.
8
3. Explain Difficulty in Bitcoin and Factors Required for Block Validation.
Ethereum and Bitcoin are self-regulating networks. As a network gets more popular,
more mining hashpower joins in search of profits, and blocks might be found too
quickly.
If blocks are found too quickly or slowly, the system changes the difficulty to get within
range of its ideal block time.
Network difficulty may decrease or go flat if miners begin to drop off the network or if
overall hashpower decreases.
After the Ethereum network experienced attacks in October and November 2016, the
market price of ether dropped, and hashrate was reduced as miners who couldn’t make
a profit turned off their machines.
Factors Required for Block Validation: -
Every candidate block that each individual miner constructs and seeks to
validate contains four pieces of data:
Hash of the transaction ledger for this block (as this machine heard about
it).
Root hash of the entire blockchain.
Block number since the chain started.
Difficulty of this block.
9
Thus, ether’s issuance scheme is inflationary (in terms of quantity, not price) until
approximately 2025, and deflationary in quantity thereafter. The price of ether is
whatever the market dictates, and is predicated mostly on demand of time on the EVM.
10
Unit 5
1. Write note on Seven Ways to Think about Smart Contracts and Dapp Contract Data
Models.
Behind every dapp is a series of smart contracts. Smart contracts are useful in these
scenarios, which may make fun problem areas for prototyping:
Maintain an accounting system for something in the real world, or for other
contracts
Create forwarding contracts, such as a savings account that resends income to a
separate bucket automatically
Manage a relationship between several parties, such as a freelancer agreement
or payroll
Act as a software library for other contracts
Act as controllers for other systems or sets of contracts
Serve as application-specific logic for a communal web service
Serve as a utility that developers can use on a single-serving basis, such as a
random number generator.
Public node: - The application talks to a public node hosted by a third party.
This way our users don’t have to host a local node. There are several advantages
and disadvantages of this approach. While the users don’t have to pay for power
and storage for running a local node, they need to trust a third party to broadcast
11
their transactions to the blockchain. The Ethereum browser plugin metamask
uses this model and connects with public hosted Ethereum nodes.
12