Quick Start for Contract Devs
Install the Bubble Solidity library and write your first smart contract with secure operations, step by step.
This guide will help a developer to develop a smart contract that contains secure operations using the Bubble network.
Installation
- Clone the Bubble solidity library from https://github.com/soda-mpc/bubble-core-contracts/tree/master/contracts/bubble
Writing a Private Smart Contract
To begin utilizing the privacy features of our blockchain platform effectively, follow these instructions as a contract writer:
-
Understand Privacy Features: Familiarize yourself with the privacy features offered by our Bubble network. Explore how secret data types operate to ensure confidentiality.
-
Define Contract Requirements: Clearly outline the requirements and functionality of your smart contract. Identify the specific use case and consider how privacy features can enhance security and confidentiality.
-
Import and use
MpcCore.sollibrary: ImportMpcCore.solinto every contract that handles encrypted values. It provides the MPC operations used for private computation. The library routes each operation to the host contracts configured for your chain.Encrypted values are opaque handles. Store and pass these handles between operations. Do not try to read or convert their plaintext value in Solidity.
See operations on encrypted types for supported types and operation signatures. See decryption for the controlled decryption flow.
-
Implement Secret Data Types: Utilize the provided secret data types defined in the library (
MpcCore.sol) to protect sensitive information within your smart contract.
- Develop Scripts or DApp Frontend: Begin by developing scripts or a decentralized application (DApp) frontend using languages like Python, JavaScript, or relevant frameworks using the provided privacy specific
sdk. These scripts or frontend interfaces will facilitate the execution of your smart contract's functionality while ensuring privacy and confidentiality are maintained.
- Test and Validate: Thoroughly test and validate your smart contract to ensure that privacy features are functioning correctly. Test various scenarios to verify the security and confidentiality of sensitive data handling.
- Deploy and Monitor: Deploy your smart contract onto the blockchain platform that Bubble supports and monitor its performance in a real-world environment. Continuously monitor for security vulnerabilities or privacy leaks and address them promptly to maintain confidentiality.
By following these instructions, contract writers can effectively develop secure and confidential smart contracts tailored to their specific use cases. More examples of confidential smart contracts and other helper functions can be found here.