Skip to main content

Posts

Showing posts from February, 2020

Hyperledger Architecture: White Papers

Hyperledger Architecture Working Group(WG) has published the white papers which provides introduction to Hyperledger Business Blockchain Design Philosophy and Consensus. A Volume II of these white papers talks primarily about Smart Contracts. Hyperledger Architecture: Volume I Hyperledger Architecture: Volume II

Hyperledger Fabric! Error: failed to create deliver client for orderer

While creating channel faced following error: Error: failed to create deliver client for orderer: orderer client failed to connect to orderer.openhut.in:7050: failed to create new connection: connection error: desc = "transport: error while dialing: dial tcp: lookup orderer.openhut.in on 127.0.0.11:53: no such host" Solution: $./byfn.sh down $docker volume prune $sudo systemctl daemon-reload $sudo systemctl restart docker $cd <path of download>/fabric-samples/first-network $./byfn.sh generate $./byfn.sh up

Development Hyperledger Fabric Network Setup and Writing Chaincode

Steps to setup Hyperledger Fabric for development Start docker container(s) Validate all the containers are running Fabric services are running All containers should be running for at least 2 minutes Create a new channel Join peers to the channel Update achor peers on the channel created Automating setup Using a bash script to automate the process It makes it easier and faster Writing Chaincode Write Chaincode in Dev Mode Make sure TLS is disabled Example: FABRIC_CA_SERVER_TLS_ENABLED=false Installing chaincode on the peers to make them endorsing peers Instantiate chaincode on the channel This will create a new docker container Test the chaincode written above

Hyperledger Fabric: Developer Mode

- Disble TLS..TLS_ENABLED = false Installing on every peer and instantiating chaincode:  - Takes about a minutes for lets say 6-7 peers - This is not so practical - Sol: - Use DEV MODE that is chaincode runs on the user( like browser accessing the chaincode ) - peer-chaincodedev=true - A chaincode is one or multiple smart contract https://fabric-shim.github.io/release-1.4/index.html

Layout of Solidity Source File

A solidity source file can contain: contract definitions import directives pragma directives Pragmas: used to enable certain compiler features or checks each file should have a pragma while importing a file into another file, pragma does not automatically apply Versioning: The version of pragma is used as follows: pragma solidity ^0.5.2; A source file with the line above does not compile with a compiler earlier than version 0.5.2, and it also does not work on a compiler starting from version 0.6.0 (this second condition is added by using ^). This is because there will be no breaking changes until version 0.6.0, so you can always be sure that your code compiles the way you intended.  Importing Other Source Files In solidity, import is used to create modular structure of the project similar to JavaScript(ES6) but doesn't support the concept of default export. import "filename"; The above mentioned format is not supported as it poll...

Ethereum Accounts

In Ethereum, the state is made up of objects called 'accounts'. An account having: 20 byte address state transitions being direct transfers of value and information between accounts An ethereum account contains four fields: nonce - counter used to make sure each transaction can be processed once ether balance - account's current balance contract code(optional) - account's contact code storage(default - empty) - account's storage Ether , is the main crypto-fuel of Ethereum and is used to pay transaction fees. Generally, there are two types of accounts: Externally Owned Accounts(EOA) controlled by private keys has no code by creating and signing a transaction, one can send messages has following information available to them: Total number of Ethers for the account Functionalities to send and receive transaction Private and Public Keys to manage the account. Contract Accounts(CA) controlled by their contract code every time the ac...

Ethereum FAQ's

What is the difference between cryptocurrency and token? Cryptocurrency - is  a digital currency in which encryption techniques are used to regulate the generation of units of currency and verify the transfer of funds, operating independently of central bank the base currency which is used to establish the common denominator for all the products Tokens  -  represent programmable assets or access rights. are accessible only by the person who has the private key for that address and can only be signed using this private key. are a digital representation of tangible or intangible goods which are specific to a product cannot buy tokens using tokens Example : dollar is your base currency which can be used to buy oranges and cars. Here we can take dollars as cryptocurrency which is used to buy orange tokens and car tokens. These orange tokens or car tokens represent that you own certain quantity of oranges or cars and you paid for these tokens with co...

Ethereum Principles

Certain principles that are followed as the design principles of Ethereum. These are as follows. Simplicity: ethereum protocol should be as simple as possible even at the cost of some data storage and time inefficiency ( note: in case of complex scenarios, documentation should be clear, concise and up-to-date ) the protocol should be easy to implement for an average developer any optimization should be avoided unless it adds substantial benefits Universality: there are no features to ethereum's design it allows an internal scripting language to allow development of any smart contract or transaction type that can be mathematically defined one can invent own financial derivative make own currency Modularity: parts of the ethereum protocol should be as modular as possible any future development causing modification to the protocol, should not impact the application stack example Ethash, modified Patricia Trees, RLP the development should be helpful for entire ec...