Smart Contract and Chaincode
From a developer’s perspective, a smart contract, together with a ledger, form the heart of the Hyperledger Fabric blockchain system. Whereas a ledger holds facts about the current and historical state of a set of business objects, a smart contract defines the executable logic that generates new facts that are added to the ledger.
Before businesses can transact with each other, they must define a common set of contracts covering common terms, data, rules, concept definitions, and processes. Taken together, these contracts lay out a business model that governs all of the interactions between transacting parties.
Using a blockchain network, we can turn these contracts into executable programs - known in the industry as smart contracts - to open up a wide variety of new possibilities. That is because a smart contract can implement governance rules for any type of business object, so that they can be automatically enforced when the smart contract is executed. For example, a smart contract might ensure that a new car delivery is made within a specified timeframe, or that funds are released according to prearranged terms, improving the flow of goods or capital respectively. Most importantly, however, the execution of a smart contract is much more efficient than a manual human-led business process.
Hyperledger Fabric users often refer to the “smart contract” and “chaincode” terms interchangeably. In general, a smart contract defines the transaction logic that controls the life cycle of a business object contained in a world state. It is then packaged into a chaincode, which is then deployed to a blockchain network. A chaincode runs in a secured Docker container isolated from the endorsing peer process. A state created by a chaincode is scoped exclusively to that chaincode and cannot be accessed directly by another chaincode.
Last updated
Was this helpful?