Skip to content

paralect/blockchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blockchain Research & Dev. Project

New [2023]:

For people who prefers blog posts:
https://blog.paralect.com/post/its-blockchain-101
https://blog.paralect.com/post/how-smart-contracts-streamline-payment-processes
[To-be-published] Introducing Parachain - Paralect's first private blockchain


Welcome to the blockchain wiki!

Table of Contents:

  1. References & Good Reads
  2. Blockchain
    a. What is Blockchain?
    b. Block Structure
    c. How Blockchain works
    d. Public (Permissionless) Blockchains
    e. Private (Permissioned) Blockchains
        i. Hyperledger Fabric
        ii. Quorum
        ii. MultiChain
        iv. Corda
  3. Comparison of smart-contract platforms
  4. Selected smart-contract platform
  5. Ideas for smart contacts
    a. Simple Voting DApp with Ethereum and React (Updated)
    b. Token Sale (ICO) Website
    c. Crowdsale (ICO) DApp (New)
    d. EOS Wallet or Explorer/IDE (New)
  6. To Discuss

0. References & Good Reads

Blockchain
Glossary: https://github.com/ethereum/wiki/wiki/Glossary
Blockchain at Berkeley Uni.: https://www.youtube.com/channel/UC5sgoRfoSp3jeX4DEqKLwKg/playlists

Bitcoin
Satoshi Nakamoto's original paper: https://bitcoin.org/bitcoin.pdf

Ethereum
Ethereum Overview : https://blockgeeks.com/guides/ethereum/
Wiki: https://github.com/ethereum/wiki/wiki
White-Paper: https://github.com/ethereum/wiki/wiki/White-Paper
Design-Rationale: https://github.com/ethereum/wiki/wiki/Design-Rationale
Yellow Paper: https://ethereum.github.io/yellowpaper/paper.pdf
Decentralized-apps-(dapps): https://github.com/ethereum/wiki/wiki/Decentralized-apps-(dapps)

EOS
EOS Overview: https://blockgeeks.com/guides/eos-blockchain
Wiki: https://github.com/EOSIO/eos/wiki
White Paper: https://github.com/EOSIO/Documentation/blob/master/TechnicalWhitePaper.md

Smart Contracts
EOS Smart Contracts: https://github.com/EOSIO/eos/wiki/Smart%20Contract
Ethereum Smart Contracts: https://solidity.readthedocs.io/en/develop/introduction-to-smart-contracts.html#
Video: Ethereum - How to Create and Publish a Smart Contract

1. What is Blockchain?

a) What is Blockchain:

(short)
A blockchain is a continuously growing list of records, called blocks, which are linked and secured using cryptography.

(longer)
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 validating new blocks. Once recorded, the data in any given block cannot be altered retroactively without the alteration of all subsequent blocks, which requires collusion of the network majority.

Source: https://en.wikipedia.org/wiki/Blockchain

b) Block structure:

i. Basic block structure

Source: https://medium.com/@lhartikk/a-blockchain-in-200-lines-of-code-963cc1cc0e54

ii. Block structure in Bitcoin blockchain

Source: http://computersecuritypgp.blogspot.com/2016/05/what-is-blockchain.html

c) How Blockchain works:

Simple

Source: https://bitsapphire.com/wp-content/uploads/2017/01/Blockchain-industry-innovation-or-overhyped.png

In Detail:

Source: http://www.relativelyinteresting.com/wp-content/uploads/2016/06/how-a-bitcoin-transaction-works.jpg

d) Public (Permissionless)

On public blockchains, there are no restrictions that prevent participants from accessing the blockchain. Any individual or group can set up a node and participate in the consensus mechanism of a public blockchain.

Ethereum, Bitcoin etc...

e) Private (Permissioned) Blockchains:

The primary difference between permissioned blockchains and public (permissionless) blockchains is the ability for members to restrict access.


i) Hyperledger Fabric

Hyperledger Fabric is an open source enterprise-grade permissioned distributed ledger technology (DLT) platform, designed for use in enterprise contexts.

Hyperledger project is an umbrella project of open source blockchains and related tools, started in December 2015 by the Linux Foundation,[1] and supported by big industry players like IBM, Intel and SAP Ariba, to support the collaborative development of blockchain-based distributed ledgers.

/// Features of Fabric

  • Smart contracts authored in general-purpose programming languages such as:
    . Javascript, Java, Go
  • Smart contracts (“chaincode”) run within a container environment (e.g. Docker) for isolation.
  • Fabric has pluggable consensus protocols
  • Fabric can leverage consensus protocols that do not require a native cryptocurrency
    . Details: To incent costly mining or to fuel smart contract execution. Avoidance of a cryptocurrency reduces some significant risk/attack vectors, and absence of cryptographic mining operations means that the platform can be deployed with roughly the same operational cost as any other distributed system.
  • For enterprise use, we need to consider the following requirements:
    Participants must be identified/identifiable
    Networks need to be permissioned
    High transaction throughput performance
    Low latency of transaction confirmation
    Privacy and confidentiality of transactions and data pertaining to business transactions

Ref: https://www.theblockcrypto.com/2018/12/10/crypto-simplified-explaining-permissioned-blockchains/


ii) Quorum

A permissioned implementation of Ethereum supporting data privacy (https://github.com/jpmorganchase/quorum)

Quorum is an Ethereum based DLT. The objective behind this to provide a permissioned implementation of Ethereum which supports transactions and contract privacy.

The functioning of Quorum is similar to Ethereum but with a few differences. Here is how Quorum is different from Ethereum blockchain:

  • Network and peer permissions management
  • Enhanced transaction and contract privacy
  • Voting-based consensus mechanisms
  • Better performance

Microsoft Makes JPMorgan’s Quorum the Preferred Blockchain for Azure Cloud
https://www.coindesk.com/microsoft-makes-jpmorgans-quorum-the-preferred-blockchain-for-azure-cloud


iii) MultiChain

MultiChain is a platform where users can establish and deploy private blockchains within an organization or between organizations. It is an open source platform based on Bitcoin’s Blockchain, except in MultiChain you must configure the multichain at every node as opposed to the Bitcoin Blockchain where anyone can connect and transfer assets on the chain.

/// Key features:

  • Native multi-currency support
  • Expected to be faster than Bitcoin
  • Permissioned management
  • Quick deployments
  • Supported languages: Python, C#, JavaScript, PHP, Ruby
  • MultiChain forked from the Bitcoin Blockchain allowing users to control whether the chain is private or public, permissions to connect to the network, target time for blocks, and maximum block size and metadata.

Ref: https://medium.com/coinmonks/a-step-by-step-guide-to-building-and-deploying-multichain-private-blockchains-d3b27b5cf2b2


iv) Corda

https://github.com/corda/corda


2. Comparison of smart-contract platforms (Draft)

EOS Ethereum
Short Definition Decentralized operating system Decentralized operating system
Long Definition Decentralized OS with cryptoeconomic incentive which can support industrial-scale decentralized applications [1] Open software platform enables developers to build and deploy decentralized applications
[2] Ethereum is an open-source, public, blockchain-based distributed computing platform and operating system with smart contract functionality
Key Features - Completely remove transaction fees
- Conduct millions of transactions per second

- Designed to enable vertical and horizontal scaling of decentralized applications. (which is achieved by software providing accounts, authentication, databases, asynchronous communication and the scheduling of applications across hundreds of CPU cores or clusters.)
- Enterprise Ethereum Alliance (EEA)July 2017, there were over 150 members in the alliance

(including ConsenSys, CME Group, Cornell University's research group, Toyota Research Institute, Samsung SDS, Microsoft, Intel, J.P. Morgan, Cooley LLP, Merck KGaA, DTCC, Deloitte, Accenture, Banco Santander, BNY Mellon, ING, and National Bank of Canada, MasterCard, Cisco Systems, and Scotiabank)
Blockchain Network - EOS creators block.one will not be launching a public eos blockchain.
- Instead leave it up to the community to do what they will with the EOS.io software.
Ethereum is a distributed public blockchain network
Smart Contract A contract in the sense of Solidity is a collection of code (its functions) and data (its state) that resides at a specific address on the Ethereum blockchain
Smart Contract Features Contracts can be updated after published.

(Todo: Sounds good but isn’t contract conceptually an immutable block in blockchain ?)
The only possibility that code is removed from the blockchain is when a contract at that address performs the “selfdestruct” operation.

(The remaining Ether stored at that address is sent to a designated target and then the storage and code is removed from the state)
https://solidity.readthedocs.io/en/develop/introduction-to-smart-contracts.html#
Code Execution EOS.IO based blockchains execute user-generated applications and code using WebAssembly (WASM). (WASM is an emerging web standard with widespread support of Google, Microsoft, Apple, and others. At the moment the most mature toolchain for building applications that compile to WASM is clang/llvm with their C/C++ compiler.) The code in Ethereum contracts is written in a low-level, stack-based bytecode language, referred to as "Ethereum virtual machine code" or "EVM code".
https://github.com/ethereum/wiki/wiki/White-Paper#code-execution
Token/ Currency EOS:
- Having EOS token gives the developer the right to use the some percentage of the whole systems resources. EOS token is never consumed.
- EOS token holders will be able to rent / delegate their their share of resources to other developers
Ether:
- Ethereum rents out their computational power to the developers.
- Miners work to earn Ether, a type of crypto token that fuels the network.
Who is behind? The core team behind EOS is “Block.one”, which is based in the Cayman Islands.
Dan Larimer, is the CTO. He is the creator of delegated proof-of-stake and decentralized autonomous organizations aka DAOs. He is the also the man behind BitShares and Steem.
Ethereum was proposed in late 2013 by Vitalik Buterin, a cryptocurrency researcher and programmer. Development was funded by an online crowdsale that took place between July and August 2014.[6] The system went live on 30 July 2015, with 11.9 million coins "premined" for the crowdsale.
The core Ethereum team was Vitalik Buterin, Mihai Alisie, Anthony Di Iorio, and Charles Hoskinson
Transaction Speeds Designed to perform millions of transactions per sec.

Note:
Visa manages 24,000 transactions per second while Paypal manages 193 transactions per second. Compared to that, Bitcoin manages just 3-4 transactions per second while Ethereum fairs slightly better at.
https://howmuch.net/articles/crypto-transaction-speeds-compared
http://www.blocktivity.info/
20 transactions per sec
Consensus Algorithm DPOS aka the Delegated Proof of Stake consensus mechanism, they can easily compute millions of transactions per second. Proof of Work (PoW)
(Plans to move to Proof of Stake (PoS) a new design called Casper)
Admin Tools Mist:
UI digital wallet to trade & store Ether. And to write, manage, deploy and use smart contracts
Block Time 3 seconds 13 seconds (for comparison, Bitcoin 10 mins)
https://etherscan.io/chart/blocktime
Gas "Gas", an internal transaction pricing mechanism, is used to mitigate spam and allocate resources on the network

3. Selected smart-contract platform

Assuming (!) EOS will implement all the features they claim (ETA: June, 2018), EOS almost certainly seems to be right platform.

However, since EOS is still under development, and although Ethereum has some unacceptible limitations, currently Ethereum can be a starting point for smart contract development since they are the only live blockchain network with working smart contracts.

4. Ideas for smart contacts

4.a. Simple Voting DApp with Ethereum and React

Conceptually, subject of voting seems to be a perfect fit for blockchain.

More: https://github.com/simsekgokhan/Voting-DApp-Ethereum

4.b. Token Sale (ICO) Website

Raw information from emails:

""
Dmitry Schetnikovich:
I had a talk with Alex Shkor recently and he proposed an additional idea to consider: Token Sale (or ICO) website in Etherium or EOS networks. There are a lot of examples and materials about this process. For instance: Token Sale Smart Contracts (GitHub), EOS ICO Step by Step guide etc.

People initiate ICO (Token Sale) even before they complete implementation of their application (or "protocol"). This is a kind of a service that Paralect can provide. According to Alex, process of implementation of Token Sale Website is straightforward, after you did it for the first time.

Token Sale / ICO Website (simplified):

  1. Presents an idea how we are going to change the world (we skip this step, because this content will be provided by the client)
  2. Explains how this ICO is going to work and what are the rules (together with client we need to find this rules)
  3. Has a button "Buy this tokens".
  4. Allows you to exchange your current digital cons or tokens (ETH, BTC, etc.) for the new one.

It makes sense to implement it in both networks: for Etherium and EOS. Although Alex thinks, that in a couple of months EOS will go public and there will be a lot of demand for "EOS Token Sale / ICO" website.

""

4.c. Simple Crowdsale (ICO) Dapp (Crowdsale and Custom Token contracts)

This Crowdsale dapp consists of two contracts: Crowdsale (ICO) and Token contracts.

For more advanced version of this dapp, see below:

Note: For this dapp, modified versions of official Ethereum Crowdsale and Token templates in the links below are used.

How this Dapp works:

   

4.d. EOS Wallet or Explorer/IDE

Ethereum Wallet or Bitcoin Core like desktop app for EOS blockchain.

Possible Features:

  • Account explorer / management
  • Contract method executions
  • Contract IDE/compilation (using eosio executables)
  • Contract deployment
  • Block explorer
  • Transaction explorer

E.g.: Screenshot from Ethereum Wallet: Contract deployment

   

5. To Discuss:

// eth and btc scalability problem
https://github.com/ethereum/wiki/wiki/White-Paper#scalability

The problem with such a large blockchain size is centralization risk. If the blockchain size increases to, say, 100 TB, then the likely scenario would be that only a very small number of large businesses would run full nodes, with all regular users using light SPV nodes. In such a situation, there arises the potential concern that the full nodes could band together and all agree to cheat in some profitable fashion (eg. change the block reward, give themselves BTC).

// problems of decentralized applications
Despite bringing a number of benefits, decentralized applications aren't faultless. Because smart contract code is written by humans, smart contracts are only as good as the people who write them. Code bugs or oversights can lead to unintended adverse actions being taken. If a mistake in the code gets exploited, there is no efficient way in which an attack or exploitation can be stopped other than obtaining a network consensus and rewriting the underlying code. This goes against the essence of the blockchain which is meant to be immutable. Also, any action taken by a central party raises serious questions about the decentralized nature of an application.

// dapps projects currently in development on Ethereum
https://www.stateofthedapps.com/

// Decentralized Autonomous Organizations (DAO)

Ethereum can also be used to build Decentralized Autonomous Organizations (DAO). A DAO is fully autonomous, decentralized organization with no single leader. DAO’s are run by programming code, on a collection of smart contracts written on the Ethereum blockchain.

The code is designed to replace the rules and structure of a traditional organization, eliminating the need for people and centralized control. A DAO is owned by everyone who purchases tokens, but instead of each token equating to equity shares & ownership, tokens act as contributions that give people voting rights.

// btc Mining Centralization problem
https://github.com/ethereum/wiki/wiki/White-Paper#mining-centralization

Mining algorithm is vulnerable to two forms of centralization.

First, the mining ecosystem has come to be dominated by ASICs (application-specific integrated circuits), computer chips designed for, and therefore thousands of times more efficient at, the specific task of Bitcoin mining. This means that Bitcoin mining is no longer a highly decentralized and egalitarian pursuit, requiring millions of dollars of capital to effectively participate in.

Second, most Bitcoin miners do not actually perform block validation locally; instead, they rely on a centralized mining pool to provide the block headers. This problem is arguably worse: as of the time of this writing, the top three mining pools indirectly control roughly 50% of processing power in the Bitcoin network, although this is mitigated by the fact that miners can switch to other mining pools if a pool or coalition attempts a 51% attack.

// eth DAO (Decentralized Autonomous Organizations)
https://github.com/ethereum/wiki/wiki/White-Paper#decentralized-autonomous-organizations

The general concept of a "decentralized autonomous organization" is that of a virtual entity that has a certain set of members or shareholders which, perhaps with a 67% majority, have the right to spend the entity's funds and modify its code. The members would collectively decide on how the organization should allocate its funds.

how to code a DAO is as follows. The simplest design is simply a piece of self-modifying code that changes if two thirds of members agree on a change. Although code is theoretically immutable, one can easily get around this and have de-facto mutability by having chunks of the code in separate contracts, and having the address of which contracts to call stored in the modifiable storage.

...

About

A blockchain and smart contracts research project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published