Is it possible to make orderer node validate the block and the peer node only accepts block created by orderer node? - hyperledger-fabric

I'm trying to apply Proof of Authority concept on Hyperledger Fabric. The idea is to make the orderer node validate the transactions signed by peer node, pack it into block and then distribute it to other orderer node(i.e. orderer2, orderer3, etc)for validation of the block and once the block has been finalized, distribute it to the rest of the network.
What I plan to do is I want to make the validate step which is done by peer0.org1 and peer0.org2 as above picture to be done by orderer.example, orderer2.example and orderer3.example. And peer0.org1 and peer0.org2 only storeBlock and commit the block.
My questions are as below.
Can my idea be realized on Hyperledger Fabric? (I tried to find the code for this [propose -> writeBlock -> storeBlock -> Validate -> commit] but I couldn't find it ...)
I'm wondering if this thing can be realized by just modifying the core.yaml or configtx.yaml or it's more than just modifying these two files? If it's more than modifying these files, which files should I modify?
Any reference regarding this will help me greatly.

Related

Can anyone tell me the what 「propose」,「writeBlock」,「StoreBlock」,「Validate」「commit」stage means in Hyperledger Fabric?

Here is the log of Hyperledger Fabric test network. There are 2 peer node(peer0.org1.example.com & peer0.org2.example.com) and 2 orderer node(orderer.example.com & orderer2.example.com).
My question is what 「writeBlock」,「StoreBlock」,「Validate」「commit」stage actually does? I know that at 「propose」stage, a chosen orderer(in this case, orderer.example.com) will create a block and then send the created block to other orderer such as orderer2.example.com. However, I don't understand what orderers does at「writeBlock」stage. Do they sign the created block at 「writeBlock」stage? Next, peer nodes received the block from who? orderer.example.com or orderer2.example.com? In my guess, I think it's from orderer.example.com but I'm not sure.
I don't understand what orderers does at「writeBlock」stage.
I'm not sure about those stages (writeBlock looks self-explanatory). I don't know about "StoreBlock", it isn't mentioned in the official docs. I'm wondering which Fabric version you are using.
Next, peer nodes received the block from who?
In a RAFT network you have a leader/follower model. You can think of a leader peer as an entry point/doorman for all communication coming from the ordering nodes. An ordering node sends blocks to the leading peer(s) of each organization; the leading peer is then responsible for distributing those blocks to other peers belonging to the same organization. Distribution is done using gossip protocol.
Hyperledger Fabric is a complex system, with many components and a lot of moving parts.
The log that you are referring to is the log of the orderer node - orderer.example.com. It's a part of the Fabric test network. You can see what's happening in detail by looking at the logs of other Fabric components, such as peer node logs.
The Fabric network has a set of orderer nodes, which are responsible for ordering the transactions and creating blocks in the blockchain.
The orderer nodes are configured to use a consensus algorithm (such as Solo or Kafka) to achieve a consensus about the order of the transactions.
A Fabric network has a set of peer nodes, which are responsible for executing the chaincode (smart contracts) and catching and validating the transactions.
The Fabric test network consists of one orderer node, which is configured to use Solo consensus algorithm. This orderer node is orderer.example.com.
The Fabric test network consists of two peer nodes, which are peer0.org1.example.com and peer0.org2.example.com.
The log that you are referring to is the log of the orderer node - ord

Does committing peer sign the new block using private key to produce new block in Hyperledger Fabric?

I tried to find about how committing peer works in hyperledger fabric technically in producing new block but I couldn't seem to find resources that explain to me in a very detail manner(such as sign using private key, how transaction is validated technically, etc). My question is after committing peer validate the transaction which they got from ordering service node, who will create the new block exactly? If it's the committing peer, committing peer is not one node but usually it has multiple committing peer node(which represents number of company participating in the network), so how do the system decide which committing peer will produce the new block?
Any reference link about this will be highly appreciated.
Please refer to the Transaction Flow in the documentation. Furthermore, Please check out the Key Concept Section too (Both Ledger and Ordering Service for you to understand the flow and also what is inside a block).
Committing peers do not create new blocks, they execute, validate and commit the block created by orderer to their ledger. The signing is done by Endorsing Peers using private key with ECDSA-SHA256 signing. Then of course, verification uses ECDSA-SHA256 too.
Validation is basically executing the read write set and check if the output is deterministic (and thus the result should be same with all other nodes).
I am over simplifying here tho.

hyperledger fabric mychannel block in peer get deleted once the container is down

I have hyper-ledger fabric setup with 2 organisation which works well.I am keeping the separate storage for the blocks state in file system. Now i turn down the all organisation container, all the states inside the container is deleted, but i am keeping states which are stored the my file path. Next, when i use the existing file storage, and turn up the docker, all the peers and ordered load well from the state which i was stop. The problem here is, I am unable to reinitiate the channel transaction and i am unable to join the same channel from the peer. where does the mychannel.block get stored. when i try to join the channel i get error
2019-11-27 03:49:01.631 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialised
Error: genesis block file not found open mychannel.block: no such file or directory
You should know what volumes are you using to persist that file.
You should persist:
/var/hyperledger/production in your orderers and peers.
/opt/couchdb/data in your CouchDB containers.
Wherever you store your MSP, TLS files and other configuration files (genesis block, etc.). Only you know about your configuration.
/var/lib/postgresql/data in your CA's PostgreSQL container.
Whatever other file/folder you want to persist.
Anyway, I don't know if I have understood you, but if you persist all these, you don't need to join a channel again, the peers remain joined after restarting the network.

What is an Artifact in Hyperledger?

I see the word everywhere in building a Hyperledger network, but I don't exactly know what it is and the Hyperledger docs don't return a definition when I query them.
Maybe it's a dumb question because the docs don't define it and assume you should know, but I don't and can't find a precise answer to it.
Artifacts in Hyperledger are channel configuration files which are required for the Hyperledger Fabric network. They are generated at the time of network creation.
These include:
Genesis.block: First block of a chain, that initializes a block chain
Channel.tx: Channel configuration transaction
Org1MSPanchors.tx: Anchor Peer update (Defining a peer from Org1 as an anchor peer)
configtxgen command is used to create the above channel config artifacts.

Does Orderer have Block(Ledger) data?

I built hyperledger fabric network using Kafka-based Ordering Service.
I thought that Orderer doesn't have Block data.
But, when I checked /var/hyperledger/production/orderer/chains/mychannel in Orderer server, I found blockfile_000000 file.
I checked this file using "less" command.
Then, I found key-value data which I registered by invoking chaincode.
What is this file?
This means that Orderer also maintain Block data(i.e. Ledger)?
The orderer has the blockchain of all channels it is part of.
However, it doesn't have the world state and it doesn't inspect the content of the transactions.
It just writes the blocks into the disk, to serve peers that pull the blocks from it.

Resources