HFCP Sample Questions

HFCP Sample Questions & Answers

Network architecture, the ordering service and channels carry the most weight, alongside building client applications with the gateway programming model, writing chaincode and ledger operations, and deploying to production with security and performance in mind.

Launch the full HFCP simulator →

Showing 10 of 20 free samples.

  1. Question 1AdvancedSelect 2

    Smart Contracts and Chaincode · Chaincode Lifecycle

    During a chaincode upgrade using the new lifecycle, an administrator successfully packages and installs the new version. However, when trying to commit the new chaincode definition to the channel, the transaction fails. Which of the following are potential reasons for this commit failure? (Select TWO)

    Show answer & explanation

    Correct answers: C, D

    Committing a chaincode definition requires satisfying the channel's LifecycleEndorsement policy (typically a majority of organizations). If not enough organizations have submitted an 'approveformyorg' transaction for the new definition, the 'commit' transaction will fail validation.

    The chaincode lifecycle requires that each new definition committed to a channel must have a sequence number that is exactly one greater than the previously committed sequence number. Failing to increment the sequence number is a common reason for commit failure.

  2. Question 2Intermediate

    Network Structure and Components · Channel Management

    A supply chain network uses anchor peers to facilitate cross-organization communication. Org1 has two peers, peer0.org1 and peer1.org1. Initially, only peer0.org1 was defined as an anchor peer. The administrator now wants to add peer1.org1 as a second anchor peer for redundancy. Which tool and process should be used to perform this update on a running network?

    Show answer & explanation

    Correct answer: D

    Anchor peers are defined in the channel configuration. To update them on a live network, an administrator must create a channel configuration update transaction. This involves fetching the latest config block, using configtxlator to convert it to JSON, modifying the anchor peer definition, converting it back to a protobuf, and submitting the signed update transaction to the channel.

  3. Question 3Intermediate

    Smart Contracts and Chaincode · Executing Queries

    A developer needs to implement a query in chaincode that finds all assets belonging to a specific owner. The assets are stored with keys like ASSET_1, ASSET_2, etc., and the owner is an attribute in the JSON value. To make this query efficient without scanning the entire state database, which feature should be used?

    Show answer & explanation

    Correct answer: D

    CouchDB supports rich queries against the JSON data values stored in the world state. To make these queries performant and avoid full database scans, a corresponding index must be created for the fields being queried (in this case, the 'owner' field). The chaincode can then use a GetQueryResult call with a selector to efficiently find all assets for that owner.

  4. Question 4Advanced

    Client Applications · Chaincode and Block Events

    An event-listening service is designed to monitor a Hyperledger Fabric channel for specific chaincode events. The service crashes and is restarted. To avoid processing duplicate events or missing events that occurred during the downtime, what mechanism should the application implement?

    Show answer & explanation

    Correct answer: B

    This is event checkpointing. The Fabric Gateway client API does not reconnect automatically: after a failure the application must start a new eventing session at the correct start position. A checkpointer (for example checkpointers.file(path)) persists the block number and the last processed transaction ID within that block; passing it as the checkpoint option to getChaincodeEvents() resumes eventing just after the last processed event, with no missed or duplicated events. There is no replay=true option, and neither evaluateTransaction nor a peer buffer setting can recover missed events.

  5. Question 5Intermediate

    Production Deployment and Operations · Monitoring and Troubleshooting

    A DevOps engineer is setting up monitoring for a production Hyperledger Fabric network using Prometheus. To get detailed metrics about transaction validation latency and chaincode execution time, which component's configuration must be updated to enable the operations service?

    Show answer & explanation

    Correct answer: D

    The operations service, which exposes a REST API for health checks and a /metrics endpoint for Prometheus, must be enabled and configured on the components you wish to monitor. This is done within the operations section of the core.yaml file for peers and the orderer.yaml file for orderers.

  6. Question 6Intermediate

    Network Structure and Components · Transaction Flow

    A transaction is successfully endorsed by the required peers but fails during the validation phase on committing peers. The logs indicate an 'MVCC_READ_CONFLICT' error. What does this error signify?

    Show answer & explanation

    Correct answer: A

    MVCC (Multi-Version Concurrency Control) is used by Fabric to detect state conflicts. An MVCC_READ_CONFLICT occurs when the version of a key that a transaction read during endorsement does not match the current version of that key in the ledger at commit time. This means another transaction updated the same key in the time between this transaction's endorsement and its commit.

  7. Question 7Intermediate

    Smart Contracts and Chaincode · Private Data Collections

    What is the primary function of the _implicit_org_ private data collection that is automatically available for every chaincode in Fabric v2.x?

    Show answer & explanation

    Correct answer: C

    Every chaincode has an implicit, organization-specific private data namespace, _implicit_org_ , that needs no collection definition. Its dissemination policy and endorsement policy are the organization itself, so the data is stored only on that organization's peers and any write to it must be endorsed by that organization. This makes it useful for keeping an organization's own private data or recording its agreement or vote (the v2 chaincode lifecycle uses implicit collections to track approvals). Because memberOnlyRead, memberOnlyWrite and blockToLive cannot be set, client access control must be coded in the chaincode and the data is never purged automatically.

  8. Question 8Advanced

    Client Applications · Offline Signing

    A client application uses the Fabric Gateway client API, but the user's private key is held by an external signing service, so the application connects without a signer and uses the off-line signing flow. To submit a transaction and wait for its commit status, which messages must be signed with the user's key?

    Show answer & explanation

    Correct answer: C

    In the Fabric Gateway client API, proposal, transaction and commit-status messages are normally signed with the signing implementation supplied when connecting. When an external party holds the credentials, the signer can be omitted and each message is signed off-line: the application gets the serialized message and its digest (getBytes()/getDigest()), the key holder signs the digest, and the application creates the signed object with gateway.newSignedProposal(), gateway.newSignedTransaction() or gateway.newSignedCommit(). All three are signed by the same client identity. Off-line signing changes where the signature is produced; it is not a way to collect signatures from several approvers. Endorsing peers add their own endorsements, but these never replace the client's signature.

  9. Question 9Advanced

    Production Deployment and Operations · Network Security

    To enhance security, an organization decides to integrate its Fabric peers with a Hardware Security Module (HSM) to protect the peers' private keys. Which configuration file and section must be modified to instruct the peer to use the HSM via a PKCS#11 library?

    Show answer & explanation

    Correct answer: B

    The Blockchain Cryptographic Service Provider (BCCSP) is the component responsible for all cryptographic operations. To configure an HSM, you must modify the peer.BCCSP section in the peer's core.yaml file. You would set the provider to PKCS11 and provide the path to the PKCS#11 library, the label, and the PIN for the HSM slot.

  10. Question 10Advanced

    Smart Contracts and Chaincode · Private Data Collections

    Case Study: A consortium of three organizations (OrgA, OrgB, OrgC) is setting up a Hyperledger Fabric network for tracking sensitive assets. OrgA and OrgB need to transact privately with each other without OrgC seeing the asset details. However, OrgC, acting as a regulator, must be able to see a record that a transaction occurred and verify its integrity without seeing the content. Additionally, any asset transfer between OrgA and OrgB requires endorsement from both organizations.

    The network architect has proposed a solution using a single channel for all three organizations. The chaincode will use Private Data Collections (PDCs) to segregate the sensitive data.

    Which PDC configuration and endorsement policy would best meet these requirements?

    Show answer & explanation

    Correct answer: D

    This solution correctly uses a Private Data Collection to ensure only OrgA and OrgB have access to the asset details. The AND('OrgA.member', 'OrgB.member') endorsement policy ensures that any change requires approval from both parties. OrgC, being on the channel but not in the PDC, will see the public transaction with the hash of the private data, allowing it to verify integrity without seeing the private content, thus fulfilling all requirements.

Ready for the real thing?

The full HFCP simulator has every exam-style question, timed mode, and instant scoring.

Go to the HFCP simulator →