August 28, 2018

Python

Below links are useful to learn python

https://www.w3schools.com/python/python_classes.asp
https://www.pythonforbeginners.com/basics/python-quick-guide
http://ibiblio.org/g2swap/byteofpython/read/index.html

Python code sample
https://www.programiz.com/python-programming/examples
https://www.sanfoundry.com/python-problems-solutions/

Python is an interpreted, interactive, object-oriented, and high-level programming language.
Python 3.0 was released in 2008
Module - a module is a file consisting of Python code.
Module can define functions, classes and variables. A module can also include runnable code
Most operating systems other than Windows already have Python installed by default

Python Glossary
argument
Extra information which the computer uses to perform commands.

argparse
Argparse is a parser for command-line options, arguments and subcommands.

assert
Used during debugging to check for conditions that ought to apply

assignment
Giving a value to a variable.

block
Section of code which is grouped together

break
Used to exit a for loop or a while loop.

class
A template for creating user-defined objects.

compiler
Translates a program written in a high-level language into a low-level language.

continue
Used to skip the current block, and return to the "for" or "while" statement

conditional statement
Statement that contains an "if" or "if/else".

debugging
The process of finding and removing programming errors.

def
Defines a function or method

dictionary
A mutable associative array (or dictionary) of key and value pairs.

Can contain mixed types (keys and values). Keys must be a hashable type.

distutils
Package included in the Python Standard Library for installing, building and
distributing Python code.

docstring
A docstring is a string literal that occurs as the first statement in a module,
function, class, or method definition.

__future__
A pseudo-module which programmers can use to enable new language features which
are not compatible with the current interpreter.

easy_install
Easy Install is a python module (easy_install) bundled with setuptools that lets
you automatically download, build, install, and manage Python packages.

evaluation order
Python evaluates expressions from left to right. Notice that while evaluating
an assignment, the right-hand side is evaluated before the left-hand side.

exceptions
Means of breaking out of the normal flow of control of a code block in order to
handle errors or other exceptional conditions

expression
Python code that produces a value.

filter
filter(function, sequence) returns a sequence consisting of those items from the
sequence for which function(item) is true

float
An immutable floating point number.

for
Iterates over an iterable object, capturing each element to a local variable for
use by the attached block

function
A parameterized sequence of statements.

function call
An invocation of the function with arguments.

garbage collection
The process of freeing memory when it is not used anymore.

generators
A function which returns an iterator.

high level language
Designed to be easy for humans to read and write.

if statement
Conditionally executes a block of code, along with else and elif
(a contraction of else-if).

immutable
Cannot be changed after its created.

import
Used to import modules whose functions or variables can be used in the current
program.

indentation
Python uses white-space indentation, rather than curly braces or keywords,
to delimit blocks.

int
An immutable integer of unlimited magnitude.

interactive mode
When commands are read from a tty, the interpreter is said to be in interactive
mode.

interpret
Execute a program by translating it one line at a time.

IPython
Interactive shell for interactive computing.

iterable
An object capable of returning its members one at a time.

lambda
They are a shorthand to create anonymous functions.

list
Mutable list, can contain mixed types.

list comprehension
A compact way to process all or part of the elements in a sequence and return
a list with the results.

literals
Literals are notations for constant values of some built-in types.

map
map(function, iterable, ...) Apply function to every item of iterable and return
a list of the results.

methods
A method is like a function, but it runs "on" an object.

module
The basic unit of code re usability in Python. A block of code imported by some
other code.

object
Any data with state (attributes or value) and defined behavior (methods).

object-oriented
allows users to manipulate data structures called objects in order to build and
execute programs.

pass
Needed to create an empty code block

PEP 8
A set of recommendations how to write Python code.

Python Package Index
Official repository of third-party software for Python

Pythonic
An idea or piece of code which closely follows the most common idioms of the
Python language, rather than implementing code using concepts common to other
languages.

reduce
reduce(function, sequence) returns a single value constructed by calling the
(binary) function on the first two items of the sequence,
then on the result and the next item, and so on.

set - Unordered set, contains no duplicates

setuptools
Collection of enhancements to the Python distutils that allow you to more easily
build and distribute Python packages

slice
Sub parts of sequences

str
A character string: an immutable sequence of Unicode codepoints.

strings
Can include numbers, letters, and various symbols and be enclosed by either
double or single quotes, although single quotes are more commonly used.

statement
A statement is part of a suite (a "block" of code).

try
Allows exceptions raised in its attached code block to be caught and handled by
except clauses.

tuple
Immutable, can contain mixed types.

variables
Placeholder for texts and numbers.

while
Executes a block of code as long as its condition is true.

with
Encloses a code block within a context manager.

yield
Returns a value from a generator function.

August 7, 2018

Blockchain

Bitcoin is first implementation of Blockchain technology.

A blockchain,originally block chain, is a growing list of records, called blocks, which are linked using cryptography. Blockchains which are readable by the public are widely used by cryptocurrencies.

Each block contains a cryptographic hash of the previous block,a timestamp, and transaction data.
By design, a blockchain is resistant to modification of the data.

It is "an open, distributed ledger that can record transactions between two parties efficiently and in a verifiable and permanent way".

For use as a distributed ledger, a blockchain is typically managed by a peer-to-peer network collectively adhering to a protocol for inter-node communication and validating new blocks.
Once recorded, the data in any given block cannot be altered retroactively without alteration of all subsequent blocks, which requires consensus of the network majority.

Though blockchain records are not unalterable, blockchains may be considered secure by design and exemplify a distributed computing system with high Byzantine fault
tolerance. Decentralized consensus has therefore been claimed with a blockchain.

Blockchain was invented by Satoshi Nakamoto in 2008 to serve as the public transaction ledger of the cryptocurrency bitcoin.

The invention of the blockchain for bitcoin made it the first digital currency to solve the double-spending problem without the need of a trusted authority or
central server.

Blocks : Blocks hold batches of valid transactions that are hashed and encoded into a Merkle tree.
Each block includes the cryptographic hash of the prior block in the blockchain, linking the two. The linked blocks form a chain.
This iterative process confirms the integrity of the previous block, all the way back to the original genesis block.

Block time
The block time is the average time it takes for the network to generate one extra block in the blockchain.Some blockchains create a new block as frequently as every five seconds.
By the time of block completion, the included data becomes verifiable.In cryptocurrency, this is practically when the transaction takes place, so a shorter block time means faster transactions.
The block time for Ethereum is set to between 14 and 15 seconds, while for bitcoin it is 10 minutes.

Decentralization
By storing data across its peer-to-peer network, the blockchain eliminates a number of risks that come with data being held centrally.
The decentralized blockchain may use ad-hoc message passing and distributed networking.

Types of blockchains

Public blockchains
A public blockchain has absolutely no access restrictions. Anyone with an internet connection can send transactions to it as well as become a validator

Private blockchains
A private blockchain is permissioned.