# Fabric System Chaincode | System Chaincode | Application Chaincode | |:-----------------------------------:|:-----------------------------------------:| | Implemented within Peer | Instantiated in Docker container | | Governs the System behavior | Defines the Apllicaiton behavior | | Must be consistent across All Peers | Must be consistent across Endorsing Peers | | NOT bound to the channel | Bound to a channel | ![](https://i.imgur.com/zloNiSS.png) - 6-Default System Chaincodes - LSCC Lifecycle **for 1.x** - CSCC Configuration - QSCC Querying - ESCC Endorsement - VSCC Validation - _lifecycle _lifecycle **for 2.x** :::success Fabric 2.x supports both LSCC and _lifecycle ::: - setup `core.yaml` > `chaincode:` > `system:` ![](https://i.imgur.com/7skz6Rl.png) - Interators can create custom system chaincode ![](https://i.imgur.com/hnjzMgw.png) - system chaincode Plugins need to be configured in the `core.yaml` - Implemented as Golang plugins - Setup under `systemPlugins:` - Whitelisted under `systems:` :::warning That are discussed in this lecture are highly simplified! ::: ## ESCC Endorsement system chaincode The Endorsement system chaincode defines the requirements for the endorsement of transaction proposal by the peers ![](https://i.imgur.com/DtHpOme.png) ## VSCC Validation system chaincode The validation system chaincode defines the requirements for the validation of the transactions/blocks by the Peers ![](https://i.imgur.com/mNGQ6hd.png) :::warning LSCC, ESCC & VSCC are Transaction execution path When system integrators write custom system chaincode, make sure LSCC ESCC VSCC be consistent across the network ::: ## CSCC Configuration system chaincode Configuration system chaincode along with LSCC defines the rules for the channel - `peer channel create --flegs` - `peer channel update --flegs` ![](https://i.imgur.com/P8s5wAY.png) - `peer channel join --flegs` ![](https://i.imgur.com/5e7GW1c.png) ## QSCC Querying system chaincode Querying system chaincode provides the querying functionality for the transactions, blocks, config transaction ![](https://i.imgur.com/O5NNOxY.png) --- :::info - **Channel Configuration** decide whether the LSCC will be used for chain code or rather the _lifecycle - You may have MULTIPLE channels to which the peer may join, and each of these channels independently decide which lifecycle management system chain code will be used ::: ## LSCC Lifecycle system chaincode for 1.x - `peer chaincode -h` :::warning New to Fabric don't need to spend time of this ::: ## _lifecycle Lifecycle system chaincode for 2.x - `peer lifecycle chaincode -h` ![](https://i.imgur.com/Q6PW66J.png)