Fabric Private Chaincode
Enhancing Chaincode Privacy with Intel® SGX
Marcus Brandenburger (IBM Research - Zurich), Michael Steiner (Intel Labs), Bruno Vavala (Intel Labs)
Hyperledger Fabric Maintainer Meeting�
Outline
Part 1 �Motivation and Overview
Part 3�Recap & Outlook
Part 2�Integration in Hyperledger® Fabric�(build, lifecycle, tx validation, ...)
Blockchains everywhere ...
Impact on privacy-sensitive applications
Sealed Auctions
Genome Analytics
e-Voting
Supply Chain
Need bid secrecy
Need ballot secrecy
Need genome secrecy
Need contract secrecy
Impact on privacy-sensitive applications
Built-in privacy mechanisms�of Hyperledger® Fabric
Sealed Auctions
Genome Analytics
e-Voting
Supply Chain
Need bid secrecy
Need ballot secrecy
Need genome secrecy
Need contract secrecy
Impact on privacy-sensitive applications
Built-in privacy mechanisms�of Hyperledger® Fabric
Sealed Auctions
Genome Analytics
e-Voting
Supply Chain
Need bid secrecy
Need ballot secrecy
Need genome secrecy
Need contract secrecy
Problem: �Data visibility at endorsing peers (and respective organizations)
Fabric Private Chaincode (FPC)
Source code and examples available on Github�github.com/hyperledger-labs/fabric-private-chaincode
Trusted Execution Environment (TEE)
Hardware
VMM
App
OS
SGX Enclave
Hyperledger® Fabric
Peer
chaincode
ledger
Orderer
Orderer
Orderer
validation
Peer
chaincode
ledger
validation
Peer
chaincode
ledger
validation
1. invoke
2. endorsements
3. tx submission
4. ordered tx broadcast
5. commit
Hyperledger® Fabric with SGX
Peer
chaincode
ledger
Orderer
Orderer
Orderer
validation
Peer
chaincode
ledger
validation
Peer
chaincode
ledger
validation
1. invoke
2. endorsements
3. tx submission
4. ordered tx broadcast
5. commit
SGX enclave
SGX enclave
SGX enclave
Enclave code identified by MRENCLAVE
Each enclave has a unique identity
FPC - Endorsement
Orderer
Orderer
Peer
validation
SGX enclave
chaincode
shim
SGX enclave
enclave validation
ledger
Peer
validation
SGX enclave
chaincode
shim
SGX enclave
enclave validation
ledger
Peer
tx validation
SGX enclave
chaincode
(unmodified)
ordered transactions�(with attested endorsements)
(unmodified)
endorsements on attested encrypted data
Orderer
(unmodified)
invoke/response with�encrypted & authenticated�payload
ledger
update�ledger
attestation validation
FPC - Ledger Validation
Orderer
Orderer
Peer
validation
SGX enclave
chaincode
shim
SGX enclave
enclave validation
ledger
Peer
validation
SGX enclave
chaincode
shim
SGX enclave
enclave validation
ledger
Peer
tx validation
SGX enclave
chaincode
attestation validation
Orderer
ledger
Problems with unprotected ledger:
FPC - Ledger Validation
Orderer
Orderer
Peer
validation
SGX enclave
chaincode
shim
SGX enclave
enclave validation
ledger
Peer
validation
SGX enclave
chaincode
shim
SGX enclave
enclave validation
ledger
Peer
tx validation
SGX enclave
chaincode
attestation validation
Orderer
ledger
SGX enclave
trusted ledger
FPC - Programming the Chaincode
SGX enclave
Private Chaincode (e.g., sealed auctions, etc.)
void invoke(...);
shim.h
void get_state(...);
void put_state(...);
void get_state_by_partial_composite_key(...);
void get_creator_name(...);
void log_*(...);
...
Enclave shim library
void de/encrypt_state(...);
void decrypt(...);
void verify_state(...);
void create_attestation(...);
...
attestation, state encryption, ...
“Normal” Fabric Programming Model (prototype in C/C++)
All “Magic” transparent in shim library
FPC Layer
void encrypt_tx_args(...);
void verify_attest(...);
App
Fabric Client SDK
Secure client-enclave channel
What FPC achieves (and what are the cost)
Properties | Cost |
Compatibility with plain Fabric | None |
FPC data confidentiality / isolation chaincode data not visible to endorsing peers | Using enclaves |
FPC execution integrity expected chaincode is executed | Enclave code load, attestation and verification |
FPC processes only committed data | Enclave use + double transaction validation |
Enhanced-security for client-enclave channel args/responses not visible to endorsing peers | Additional protocol layer (client SDK) |
FPC access control / accountability | Additional metadata in definitions |
Risk Management: No need for unlimited trust in enclaves ...
Outline
Part 1 �Motivation and Overview
Part 3�Recap & Outlook
Part 2�Integration in Fabric�(build, lifecycle, tx validation, ...)
Origin of Challenges: 1 Peer for 2 Entities
SGX enclave
chaincode
shim
Peer
tx validation
SGX enclave
chaincode
attestation validation
shim
SGX enclave
ledger
1
Different keys
Origin of Challenges: 1 Peer for 2 Entities
SGX enclave
chaincode
shim
Peer
tx validation
SGX enclave
chaincode
attestation validation
shim
SGX enclave
ledger
1
2
Enclave awareness for clients
Different keys
Origin of Challenges: 1 Peer for 2 Entities
Peer
Peer
SGX enclave
chaincode
shim
Peer
tx validation
SGX enclave
chaincode
attestation validation
shim
SGX enclave
ledger
1
2
3
Enclave awareness for clients
Enclave awareness for peers
Different keys
Origin of Challenges: 1 Peer for 2 Entities
Peer
Peer
SGX enclave
chaincode
shim
Peer
tx validation
SGX enclave
chaincode
attestation validation
shim
SGX enclave
ledger
1
2
3
4
Enclave awareness for clients
Enclave awareness for peers
Mutually untrusted entities
Different keys
Origin of Challenges: 1 Peer for 2 Entities
Peer
Peer
SGX enclave
chaincode
shim
Peer
tx validation
SGX enclave
chaincode
attestation validation
shim
SGX enclave
ledger
1
2
5
3
4
Enclave awareness for clients
Exposed hardware capabilities
Enclave awareness for peers
Mutually untrusted entities
Different keys
Touchpoints with �Fabric Core Architecture
Additional metadata in
New trusted channel components:
Different endorsement (generation &) validation
New Runtime environment
Touchpoints with �Fabric Core Architecture
Additional metadata in
New trusted channel components:
Different endorsement (generation &) validation
New Runtime environment
Touchpoint: Additional Meta-Data
Objective
Initial Approach
25
Limitations
Going Forward ..
Touchpoints with �Fabric Core Architecture
Additional metadata in
New trusted channel components:
Different endorsement (generation &) validation
New Runtime environment
Touchpoint: Runtime ..
Objective
Initial Approach
27
Limitations
Touchpoint: Runtime ..
Going Forward ..
�Need “proper” chaincode type
28
Touchpoints with �Fabric Core Architecture
Additional metadata in
New trusted channel components:
Different endorsement (generation &) validation
New Runtime environment
Touchpoint: Trusted Ledger Validation
Objective
Initial Approach
Limitation
tx validation
attestation validation
Peer
SGX enclave
chaincode
SGX enclave
ledger
shim
tx validation
attestation validation
tx validation
attestation validation
Going Forward
Touchpoints with �Fabric Core Architecture
Additional metadata in
New trusted channel components:
New Runtime environment
Different endorsement (generation &) validation
Touchpoint: Attestation-based Endorsements
Objective
Initial Approach
32
Limitations
Touchpoint: Attestation-based Endorsements
Going Forward:
Leverage MSP
33
Outline
Part 1 �Motivation and Overview
Part 3�Recap & Outlook
Part 2�Integration in Fabric�(build, lifecycle, tx validation, ...)
Takeaways
| |
| |
| |
| |
Limited privacy features prevent several applications
FPC closes the gap, enabling privacy-sensitive apps
Several challenges are being addressed,also engaging with Fabric Maintainers
Hyperledger®�Fabric
Fabric Private Chaincode - Roadmap
36
(June 2019)
Presentation at SGX Community Workshop�Intel/Portland�(July 2019)
Project Meeting
Intel/Portland
(July 2019)
(Oct’ 2019)
(End 2019)
(2020)
M1
M2
M3
TODAY
�Goal:�make FPC ready for Fabric inclusion
Disclaimers
Thanks
https://github.com/hyperledger-labs/fabric-private-chaincode
https://chat.hyperledger.org/channel/private-data-objects
Tuesdays 3pm GMT�https://wiki.hyperledger.org/display/HYP/Calendar+of+Public+Meetings
Happy to have follow-up discussions
backup
Touchpoint: Client-side processing
Task
Initial Approach
40
Challenges
Going Forward ..
removed/skipped
Talk’s Protocol
We
You
give FPC overview
highlight integration challenges with Fabric
provide feedback for improving design & implementation
highlight additional requirements
Privacy in Hyperledger Fabric
Fabric's built-in privacy mechanisms
Problem: �Data visibility at endorsing peers (and respective organizations)
Impact on privacy-sensitive applications
Sealed Auctions
Genome Analytics
e-Voting
Supply Chain
Need bid secrecy
Need ballot secrecy
Need genome secrecy
Need contract secrecy
Fabric does not meet�the app requirements
Requirements | Supported by Peers |
Store secret data | Yes (encrypted by sender) |
Process secret data | No |
Impact on privacy-sensitive applications
Sealed Auctions
Genome Analytics
e-Voting
Supply Chain
Need bid secrecy
Need ballot secrecy
Need genome secrecy
Need contract secrecy
Requirements | Supported by Peers | Supported by FPC-enabled Peers |
Store secret data | Yes (encrypted by sender) | Yes |
Process secret data | No | Yes (using TEEs) |
Fabric does not meet�the app requirements
FPC-enabled Fabric�does!
FPC - Overview
Orderer
Orderer
Orderer
1. invoke
3. tx submission
4. ordered tx broadcast
5. commit
Peer
tx validation
SGX enclave
chaincode
shim
SGX enclave
enclave-tx validation
ledger
2. attested� endorsements
Peer
tx validation
SGX enclave
chaincode
shim
SGX enclave
enclave-tx validation
ledger
Peer
tx validation
SGX enclave
chaincode
shim
SGX enclave
enclave-tx validation
ledger
FPC - Ledger Validation
Orderer
Orderer
Peer
validation
SGX enclave
chaincode
shim
SGX enclave
enclave validation
ledger
Peer
validation
SGX enclave
chaincode
shim
SGX enclave
enclave validation
ledger
read committed� (encrypted) ledger data
Orderer
tx validation
attestation validation
Peer
SGX enclave
chaincode
SGX enclave
ledger
tx validation
attestation validation
FPC - Programming
Orderer
Orderer
Peer
validation
SGX enclave
chaincode
shim
SGX enclave
enclave validation
ledger
Peer
validation
SGX enclave
chaincode
shim
SGX enclave
enclave validation
ledger
Orderer
tx validation
attestation validation
piece of code that
Peer
SGX enclave
chaincode
SGX enclave
ledger
shim
tx validation
attestation validation
Risk Management
What FPC achieves (and what’s the cost)
Properties | Cost |
Compatibility with plain Fabric | None |
Privacy-sensitive data not visible to orderers and (untrusted) peers | Using a TEE |
Secure client-enclave channel, which bypasses (untrusted) peer | Additional protocol layer, in invoke args & response |
FPC chaincode processes only committed data | Enclave use + double transaction validation |
Private chaincode and trusted ledger enclave identification | Enclave code load, attestation and verification |
Channel organizations define the enclave identities allowed on the channel | Additional (but minimal) metadata in definitions (or on ledger) |
FPC - Threat Model
Trusted
Untrusted
Crucial:�
FPC - Threat Model
Peer
validation
SGX enclave
chaincode
shim
SGX enclave
enclave validation
ledger
Peer
validation
SGX enclave
chaincode
shim
SGX enclave
enclave validation
ledger
Interestingly:�FPC enhances privacy even with a single-endorsement policy
Touchpoint: Additional Meta-Data
Objective
Initial Approach
53
Challenges
Going Forward ..
Endorsement and validation
Initial Approach
Custom VSCC
Takeaways
| |
| |
| |
| |
Limited privacy features prevent several applications
Several challenges (integration, risk management) are being addressed,also engaging with Fabric Maintainers
FPC closes the gap, enabling privacy-sensitive apps
SGX-enable container
trusted ledger
E2E secure implementation
new channel definition
Fabric 2.0
certified enclaves