Protocol Implementation in ETH SG Hackathon
In the exciting context of Ethereum Singapore 2023, we are actively engaged, bridging essential components of the blockchain ecosystem. We will seamlessly integrate Metamask and the Linea smart contract with our cutting-edge FHE-DKSAP technology. Before we go into details, we provide the fundamental information of Metamask and Linea Smart contract.
- Metamask:
Metamask is a widely-used cryptocurrency wallet and gateway to decentralized applications (DApps) on the Ethereum blockchain. It serves as a browser extension, allowing users to securely manage their Ethereum-based assets, interact with decentralized platforms, and execute transactions seamlessly. With Metamask, users gain control over their digital identities and assets while navigating the decentralized landscape of the Ethereum network.
- Linea Smart Contract:
The Linea smart contract is a cutting-edge, self-executing digital agreement built on the Ethereum blockchain. Designed to automate and enforce specific contractual conditions without the need for intermediaries, Linea smart contracts ensure trust and transparency in various industries. These contracts operate according to predefined rules and execute actions when predetermined conditions are met, facilitating a wide range of applications, from automated financial services to supply chain management, while eliminating the risk of human error and reducing reliance on centralized authorities.
In the following, we provide the integration between Metamask, the Linea smart contract, and FHE-DKSAP. Our integration project leverages the strengths of three powerful components in the blockchain and cryptographic space—Metamask, the Linea smart contract, and Fully Homomorphic Encryption based Dual Key Stealth Address Protocol (FHE-DKSAP). This synergy empowers us to create a secure and efficient ecosystem for decentralized applications and data handling.
Implementation
- Metamask Connectivity: At the heart of our integration is Metamask, a renowned Ethereum wallet and DApp gateway. Users can seamlessly connect their Metamask wallets to our platform, enabling secure access to their digital assets and facilitating frictionless transactions within the Linea smart contract ecosystem.
- Linea Smart Contract Execution: The Linea smart contract serves as the backbone of our decentralized application framework. It enables the execution of transparent, self-enforcing agreements, ensuring that parties' interests are safeguarded by predefined rules. By utilizing Metamask as the interface for interacting with Linea, users can initiate, participate in, and monitor smart contract-based transactions with ease and confidence.
- In this step, we will write a Linea smart contract to store the key paris of Bob: [Metamask_Address, (spend_public_key, fhe_public_key)]. And step 2 and step 3 of the protocol into the contract:
- Alice generates a key pair (sk1, PK1) randomly. She then combines the two public keys, PK1 and PK_b, to obtain PK_z. The stealth address is generated based on PK_z. Finally, Alice encrypts the secret key sk1 using Bob's fully homomorphic encryption (FHE) public key PK_b, resulting in the ciphertext C1.
- Bob receives the ciphertext C1 and adds two ciphertexts together to get the C. With the additive homomorphism, he can decrypt the ciphertext C with his FHE private key sk_b. The result is the secret key sk_z. Then, he can generate the stealth address with sk_z and decrypt it with the private key, which only bob ones.
- After that, we write infrastructure RPC (Remote Procedure Call) to get latest blockchain headers information of step 2, step 3 and step 5 of the protocol. Here we provide a general outline.
Steps to create the RPC:
- Choose Your Ethereum Node:
Decide whether you want to run your own Ethereum node or use a service like Infura. If you choose to use Infura, sign up for an API key, and you'll be provided with an endpoint URL for Ethereum RPC.
- Send an RPC Request:
Use your preferred programming language or tool to send an HTTP POST request to the Ethereum RPC endpoint. You'll need to specify the JSON-RPC method you want to use, which is typically "eth_getHeaders" or "eth_getHeaderByNumber."
- Handle the Response:
The response will contain information about the latest block header. You can extract details such as the block number, timestamp, hash, and more, depending on your needs.
In conclusion, the harmonious integration of Metamask, the Linea smart contract, and the cutting-edge cryptographic capabilities of FHE-DKSAP represents a pivotal milestone in the evolution of privacy-preserving for recipients without revealing their real addresses. This synergy not only enhances user accessibility and security but also redefines the boundaries of trust, transparency, and privacy within decentralized applications