Docsity

[CHFD] Certified Hyperledger Fabric Developer CHFD Certification Exam Guide, Exams of Technology

Toggle sidebar
bg1
[CHFD] Certified Hyperledger Fabric
Developer CHFD Certification Exam
Guide
**Question 1.** Which method in the Fabric Contract API is used to define the initial
state of a smart contract when it is instantiated?
A) InitLedger()
B) Init()
C) Instantiate()
D) InitContract()
Answer: A
Explanation: The InitLedger() function is a user-defined transaction that is typically
invoked after deployment to populate the ledger with initial data.
**Question 2.** In chaincode, which of the following statements best describes a
deterministic transaction function?
A) It uses the current timestamp to calculate a value.
B) It generates a random UUID for each asset.
C) It produces the same world-state changes for identical inputs on every peer.
D) It reads the host machine’s environment variables.
Answer: C
Explanation: Determinism means that given the same input, all endorsing peers
must arrive at identical read/write sets; using time or randomness breaks this
guarantee.
**Question 3.** What is the primary purpose of input validation in a chaincode
transaction function?
A) To improve transaction throughput.
B) To ensure the ledger remains consistent and prevent malformed data.
C) To encrypt the arguments before processing.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download [CHFD] Certified Hyperledger Fabric Developer CHFD Certification Exam Guide and more Exams Technology in PDF only on Docsity!

Developer CHFD Certification Exam

Guide

Question 1. Which method in the Fabric Contract API is used to define the initial state of a smart contract when it is instantiated? A) InitLedger() B) Init() C) Instantiate() D) InitContract() Answer: A Explanation: The InitLedger() function is a user-defined transaction that is typically invoked after deployment to populate the ledger with initial data. Question 2. In chaincode, which of the following statements best describes a deterministic transaction function? A) It uses the current timestamp to calculate a value. B) It generates a random UUID for each asset. C) It produces the same world-state changes for identical inputs on every peer. D) It reads the host machine’s environment variables. Answer: C Explanation: Determinism means that given the same input, all endorsing peers must arrive at identical read/write sets; using time or randomness breaks this guarantee. Question 3. What is the primary purpose of input validation in a chaincode transaction function? A) To improve transaction throughput. B) To ensure the ledger remains consistent and prevent malformed data. C) To encrypt the arguments before processing.

Developer CHFD Certification Exam

Guide

D) To automatically sign the transaction. Answer: B Explanation: Validating and sanitizing arguments prevents invalid or malicious data from being written to the ledger, preserving data integrity. Question 4. Which JSON structure best represents an asset with a composite key consisting of “owner” and “assetID”? A) { "key": "owner:assetID", "value": { ... } } B) { "owner": "owner", "assetID": "assetID", "details": { ... } } C) { "docType": "asset", "owner": "owner", "assetID": "assetID" } D) { "compositeKey": ["owner","assetID"], "payload": { ... } } Answer: C Explanation: Fabric recommends storing a “docType” field to identify the asset type; the composite key is derived from the owner and assetID fields when using PutState with a composite key. Question 5. Which stub method writes a key-value pair to the world state? A) GetState() B) PutState() C) DelState() D) SetState() Answer: B Explanation: PutState() stores the supplied value under the given key in the ledger’s world state.

Developer CHFD Certification Exam

Guide

Answer: B Explanation: GetHistoryForKey() returns an iterator over all historical values and transaction IDs for the specified key. Question 9. Private Data Collections (PDC) are primarily used to: A) Increase transaction throughput. B) Store large binary files on the ledger. C) Keep sensitive data off the public world state while still allowing endorsement. D) Replace the need for channels. Answer: C Explanation: PDCs store data on a subset of peers, keeping it private from other orgs while still participating in endorsement and validation. Question 10. In attribute-based access control (ABAC), which library provides functions to retrieve client attributes from their X.509 certificate? A) crypto-suite B) fabric-ca-client C) client-identity (cid) D) msp-client Answer: C Explanation: The cid library allows chaincode to access attributes (e.g., role, department) embedded in the client’s certificate. Question 11. Which of the following is a non-deterministic operation that must be avoided in chaincode?

Developer CHFD Certification Exam

Guide

A) Reading a value from the ledger. B) Generating a UUID using a cryptographic library. C) Performing a deterministic hash of an input string. D) Serializing JSON consistently. Answer: B Explanation: Generating a UUID (or any random value) yields different results on each peer, breaking endorsement consistency. Question 12. The Fabric Gateway SDK simplifies application development by: A) Removing the need for TLS certificates. B) Providing a high-level API that abstracts endorsement, ordering, and commit handling. C) Automatically generating chaincode packages. D) Replacing the need for a connection profile. Answer: B Explanation: The Gateway SDK offers a unified interface for submitting/evaluating transactions, handling endorsements, ordering, and event listening. Question 13. In a connection profile (CCP), which top-level key defines the network’s ordering service nodes? A) peers B) orderers C) certificateAuthorities D) client Answer: B

Developer CHFD Certification Exam

Guide

B) The transaction receipt from the orderer only. C) The transaction’s validation code in the block committed to the ledger. D) The chaincode’s return value. Answer: C Explanation: The commit listener monitors the block events until the transaction is validated and written to the ledger, ensuring finality. Question 17. To listen for contract events emitted by chaincode, which SDK function is typically used? A) addContractListener() B) registerEvent() C) onEvent() D) listenForEvents() Answer: A Explanation: addContractListener() registers a callback for specific contract-level events defined in the chaincode. Question 18. What is the purpose of “start block” checkpoints when implementing replay logic for missed events? A) To store the hash of the last processed transaction. B) To remember the block number from which to resume event subscription after a failure. C) To encrypt event payloads. D) To prune old events from the ledger. Answer: B

Developer CHFD Certification Exam

Guide

Explanation: A start-block checkpoint enables an application to restart listening from a known block height, ensuring no events are lost. Question 19. Which error typically indicates that the proposed transaction’s read-set no longer matches the current world state? A) Endorsement failure B) Timeout error C) MVCC conflict D) Invalid argument error Answer: C Explanation: MVCC (Multi-Version Concurrency Control) conflicts occur when the version of a key read during simulation has been changed before commit. Question 20. When packaging chaincode with the Peer CLI, which command creates the .tar.gz archive? A) peer lifecycle chaincode package B) peer chaincode install C) peer lifecycle chaincode install D) peer chaincode package Answer: A Explanation: The “peer lifecycle chaincode package” command bundles the source code and metadata into a .tar.gz file for installation. Question 21. After installing a chaincode package on a peer, which identifier uniquely references that package for subsequent approval? A) Chaincode name

Developer CHFD Certification Exam

Guide

Question 24. When upgrading chaincode, which parameter must be incremented to allow the new definition to be committed? A) Version B) Sequence C) Endorsement policy D) Package ID Answer: B Explanation: The sequence number must increase with each definition change; the version string may also change but is not mandatory for the lifecycle. Question 25. Which component issues X.509 certificates to users, peers, and orderers in a Fabric network? A) MSP B) CA (Certificate Authority) C) TLS server D) Ledger Answer: B Explanation: The Fabric CA (or an external CA) generates and signs the X. identities used throughout the network. Question 26. In MSP configuration, the “admincerts” folder typically contains: A) The private keys of the organization’s administrators. B) The TLS certificates for the orderer nodes. C) The X.509 certificates of the organization’s admin identities.

Developer CHFD Certification Exam

Guide

D) The root CA certificates. Answer: C Explanation: “admincerts” holds the public certificates that identify the admin users for the organization’s MSP. Question 27. Channels in Hyperledger Fabric provide: A) Consensus across the entire network. B) Data isolation so that only members of a channel can see its transactions. C) Automatic smart contract upgrades. D) Public ledger visibility. Answer: B Explanation: Channels create separate ledgers, ensuring that only organizations that have joined a channel can access its data. Question 28. What is the role of an anchor peer in a Fabric channel? A) To generate blocks for the orderer. B) To serve as a discovery point for other organizations’ peers. C) To hold private data collections. D) To encrypt channel traffic. Answer: B Explanation: Anchor peers are designated peers that other orgs use to discover and communicate across the channel. Question 29. Which consensus mechanism is the default for the Fabric ordering service in recent releases?

Developer CHFD Certification Exam

Guide

Explanation: The “test-network” example ships with the Fabric samples and can be launched via Docker-compose for functional tests. Question 32. To view chaincode logs when running in a Docker container, which command is appropriate? A) docker logs B) peer chaincode logs C) kubectl logs D) fabricctl logs --chaincode Answer: A Explanation: Chaincode runs in its own Docker container; “docker logs” fetches its stdout/stderr. Question 33. An MVCC conflict most commonly occurs when: A) Two transactions try to write to the same key in the same block. B) A transaction reads a key, and another transaction updates that key before the first commits. C) The endorsement policy is not satisfied. D) The orderer fails to deliver the block. Answer: B Explanation: The conflict arises because the version read during simulation no longer matches the ledger’s current version at commit time. Question 34. Hyperledger Caliper is primarily used for: A) Deploying chaincode to the network. B) Measuring performance metrics such as throughput and latency of Fabric.

Developer CHFD Certification Exam

Guide

C) Generating connection profiles automatically. D) Managing MSP certificates. Answer: B Explanation: Caliper is a benchmark framework that runs workloads against Fabric and reports performance statistics. Question 35. Which of the following is NOT a valid reason to use a Private Data Collection? A) To keep personal data compliant with GDPR. B) To reduce the size of the public world state. C) To enable faster transaction endorsement. D) To share data only with a subset of organizations. Answer: C Explanation: Private data does not inherently speed up endorsement; it mainly provides confidentiality and can reduce public state size. Question 36. In chaincode, which function retrieves the client’s MSP ID? A) GetMSPID() B) GetClientIdentity() C) GetCreator() D) GetMSPID() from client identity library Answer: D Explanation: Using the cid library, the function cid.GetMSPID(stub) returns the MSP ID of the invoking client.

Developer CHFD Certification Exam

Guide

Answer: B Explanation: “tlsCACerts” points to the PEM-encoded root CA that signed the peer’s TLS certificate, enabling secure TLS handshake. Question 40. Which wallet implementation is best suited for production environments requiring persistence across restarts? A) InMemoryWallet B) FileSystemWallet C) NullWallet D) TemporaryWallet Answer: B Explanation: FileSystemWallet stores identities on disk, ensuring they survive application restarts. Question 41. What does the “submitTransaction” method return after a successful transaction commit? A) The transaction ID only. B) The raw block data. C) The response payload returned by the chaincode function. D) A boolean indicating success. Answer: C Explanation: submitTransaction resolves with the byte array that the chaincode’s transaction function returned. Question 42. Which event type provides information about every new block added to the ledger?

Developer CHFD Certification Exam

Guide

A) ContractEvent B) BlockEvent C) TransactionEvent D) ChaincodeEvent Answer: B Explanation: BlockEvent listeners receive notifications for each newly committed block. Question 43. In the Fabric lifecycle, what does the “sequence” number represent? A) The order in which peers endorse a transaction. B) A monotonically increasing counter for chaincode definition updates. C) The version string of the chaincode. D) The number of organizations that have approved the definition. Answer: B Explanation: Sequence is incremented each time a chaincode definition is changed, ensuring the network can detect newer definitions. Question 44. Which of the following is a valid reason for a transaction to be marked as “ENDORSEMENT_POLICY_FAILURE” during validation? A) The transaction’s read-set version is stale. B) The transaction’s proposer is not a member of the channel. C) The endorsements collected do not satisfy the defined endorsement policy. D) The orderer could not deliver the block. Answer: C

Developer CHFD Certification Exam

Guide

C) It is ignored; only successful returns are sent. D) As a block event with an error flag. Answer: B Explanation: Errors thrown during proposal simulation are returned in the proposal response; the SDK surfaces them immediately. Question 48. Which of the following best describes the purpose of the “transient map” in a transaction proposal? A) To store permanent key-value pairs in the ledger. B) To provide temporary data that is not written to the ledger but can be used by chaincode. C) To configure TLS settings for the peer. D) To specify endorsement policies. Answer: B Explanation: The transient map carries sensitive data that chaincode can read but is omitted from the transaction’s read/write sets. Question 49. In the context of chaincode, what is a “composite key”? A) A key that combines multiple attributes to enable range queries. B) A key that is encrypted with a composite cipher. C) A key that references another key in the ledger. D) A key that is automatically generated by the Fabric runtime. Answer: A Explanation: Composite keys are created from multiple attribute values, allowing efficient queries and organization of related assets.

Developer CHFD Certification Exam

Guide

Question 50. Which of the following is a correct way to create a composite key in Go chaincode? A) stub.CreateCompositeKey("asset", []string{owner, assetID}) B) stub.NewCompositeKey("asset", owner, assetID) C) stub.GetCompositeKey("asset", owner, assetID) D) stub.SetCompositeKey("asset", []string{owner, assetID}) Answer: A Explanation: CreateCompositeKey(objectType, attributes) returns the composite key string. Question 51. What does the “queryResult” iterator returned by GetQueryResult() provide? A) Only the keys that match the query. B) The full key-value pairs of documents matching the CouchDB selector. C) The transaction IDs of matching writes. D) The history of each matching key. Answer: B Explanation: GetQueryResult returns an iterator over the full key-value records that satisfy the rich query. Question 52. Which of the following is NOT a valid endorsement policy syntax element? A) ‘AND’ B) ‘OR’ C) ‘NOT’