HFCP Hyperledger Fabric Certified Practitioner Practice Questions
Prepare for HFCP with more than an answer.
- Exam fee
- $250 USD
- Level
- Professional
- Valid for
- 3 years
Domains covered on the exam 4
- Network Structure and Components30%
- Smart Contracts and Chaincode25%
- Client Applications20%
- Production Deployment and Operations25%
- 1
What are the key responsibilities of an endorsing peer in the Hyperledger Fabric transaction flow? (Select THREE)
Show answer details
Correct answer: B, C, E
Before processing, the endorsing peer checks that the transaction proposal is well-formed and that the client's signature is valid.
The endorsing peer executes the chaincode specified in the proposal against its local world state to generate a set of keys read (read set) and keys written (write set).
After successful simulation, the endorsing peer signs the proposal response (which includes the read-write set) with its private key, creating an endorsement.
- 2
A developer wants to implement a state-based endorsement policy for a specific asset. The policy should state that only the current owner of the asset can approve changes to it. Which chaincode API function is used to set a key-level endorsement policy?
Show answer details
Correct answer: B
SetStateValidationParameter(key, ep)stores a key-level (state-based) endorsement policy for one specific key as part of the transaction's write set (for private data the equivalent isSetPrivateDataValidationParameter). Once committed, it overrides the chaincode-level or collection-level policy for that key, and committing peers check it whenever a later transaction modifies the key. The Go shim'sstatebasedpackage (NewStateEP,AddOrgs,Policy) helps build the policy bytes.PutState/SetEventwrite values and events, and there is noSetStatefunction in the shim. - 3
True or False: In a Hyperledger Fabric network, a single peer can join multiple channels and will maintain a separate ledger for each channel it joins.
Show answer details
Correct answer: A
This is a fundamental concept of Hyperledger Fabric. Channels provide data isolation. A peer can participate in multiple channels, and for each channel it joins, it creates and maintains a distinct ledger (blockchain and state database). This ensures that transactions and data from one channel are completely segregated from others.
- 4
A client application is attempting to connect to a Fabric network using a connection profile. The connection fails, and a 'discovery service error' is reported. The peer logs show no incoming requests. Which of the following issues in the client's connection profile is the most likely cause?
Show answer details
Correct answer: D
The connection profile contains the necessary information for the client SDK to establish a secure TLS connection with network nodes. If the path to the TLS CA certificate (
tlsCACerts) is wrong, the client cannot validate the identity of the peer it's trying to connect to for service discovery, leading to a connection failure before any application-level requests are made. - 5
A supply chain network is deployed on Kubernetes. To ensure that peer ledger data is not lost if a peer's pod is rescheduled to a new worker node, which Kubernetes object should be used to manage the peer's storage?
graph TD Pod[Peer Pod] -- requests --> PVC(Persistent Volume Claim) PVC -- binds --> PV[(Persistent Volume)] StorageClass[Storage Class] -- provisions --> PVShow answer details
Correct answer: B
Peers are stateful applications. A StatefulSet is the appropriate Kubernetes workload for managing them, as it provides stable network identifiers and storage. A PersistentVolumeClaim (PVC) requests storage from the cluster, which is then bound to a PersistentVolume (PV). This ensures that if the pod fails and is rescheduled, it can re-attach to the same persistent storage, preserving the ledger data.
- 6
A financial consortium is deploying a Hyperledger Fabric network with three ordering service nodes using the Raft consensus protocol. To ensure high availability, the operations team wants to allow for one orderer node to fail without impacting the network's ability to process transactions. What is the minimum number of orderer nodes that must be operational to maintain a quorum?
Show answer details
Correct answer: A
Raft is crash fault tolerant as long as a majority of the consenters (a quorum) is available. The quorum is floor(N/2) + 1, so for N = 3 it is 2: a three-node ordering service can lose one node and keep ordering transactions, but if two nodes fail the remaining node cannot form a majority and the channel stops producing blocks.
- 7
A developer is writing a Go chaincode function to update an asset's state. To ensure data privacy, the asset's price must be passed to the chaincode function but NOT recorded in the transaction's read-write set on the public ledger. Which method should be used to access this private data within the chaincode?
Show answer details
Correct answer: C
The
GetTransient()method on the chaincode stub is used to access the transient data field of a transaction proposal. Data in the transient field is passed to the chaincode but is not included in the final transaction that gets committed to the ledger, making it ideal for passing private or confidential information for processing. - 8
A system administrator is joining a peer of a newly added organization to an existing channel. When the administrator requests the channel's genesis block from the ordering service (
peer channel fetch 0 ...) so that the peer can join, the request is rejected and the ordering node's logs show 'access denied' policy-check failures for the request. The TLS connection to the ordering node is established successfully, and the organization's MSP ID is correct. What is a common cause of this issue?Show answer details
Correct answer: C
The ordering service delivers a channel's blocks only to identities that satisfy the channel's read policy. In the Fabric 'Adding an Org to a Channel' tutorial, the new organization fetches block 0 only after the configuration update that adds its MSP has been committed: if the organization had not been successfully appended to the channel configuration, the ordering service would reject the request. A missing orderer TLS CA certificate (for example, no
--cafileon the CLI call) causes a TLS handshake or certificate-verification failure instead of an access-denied policy error, and the state database, chaincode containers and genesis block content do not decide whether the request is authorized. - 9
A developer is building a client application using the Fabric Gateway SDK. The application needs to query the current world state to display information to a user but should not create a transaction that goes through the ordering service. Which Gateway method is most efficient for this purpose?
Show answer details
Correct answer: D
The
evaluateTransaction()method is specifically designed for read-only operations (queries). It submits a proposal to a single peer, which executes the chaincode and returns the result directly to the client. This avoids the overhead of the full transaction flow involving endorsement from multiple peers and ordering, making it highly efficient for queries. - 10
True or False: When using Private Data Collections (PDCs), the actual private data is sent to the ordering service and included in the block, but it is encrypted so only authorized peers can decrypt it.
Show answer details
Correct answer: B
This statement is false. The core privacy mechanism of PDCs is that the private data itself is NOT sent to the ordering service. Instead, only a hash of the private data is included in the public transaction. The actual private data is transmitted peer-to-peer via the gossip protocol only between the authorized organizations.
