Author | ieigen-max, robert |
---|---|
Status | Designing |
Type | Private Smart Contract |
Category | Core |
Created | 2021-06-22 |
[toc]
Client: instance of e-wallet,
- Manage the accounts of owner(especially the private key), including account creation, account import and export, etc.
- Account information display: such as token balance.
- Transfer function: send and receive token.
- Transaction signature.
- AES and ECC encryption and decryption.
- Interact with "Identity Management" smart contract on L1 Geth(like ethereum).
EigenCC: backend of TEE,
- Provide APIs for TEE interaction.
- AES and ECC encryption and decryption.
- Transaction signature.
- Privacy DAG execution.
- Upload and resolve the public key registration list.
L2: layer2 rollup,
- Provide tx, state proof, and signature rollup functions.
- Privacy DAG generation.
- Efficient rollup, staking and validation.
L1: base layer (ethereum, bitcoin, etc.)
Secret: the records including everything you create in the blockchain network;
-
EigenCC issues a key pair according to public parameters (ring signature), seals the private key on the disk, then distributes the public key to L1 smart contracts;
-
Client generates an AES key to encrypt it's secret, then encrypt the AES key by public key from step 1;
-
Client makes a transaction with cipher as the input of PrivacyERC20, and submits the transaction to EVM contract on L2 Geth;
-
The EVM contract on L2 Geth will initialize a context with the encrypted AES key, then there maybe exist multiple
ecall
in one contract method, which all are share one context. Finally, all the inputs and outputs from theecall
s will be composed into a DAG withecall
as it's nodes and the inputs or outputs as edge. -
At the end of each contract method, the DAG will be executed in EigenCC. EigenCC decrypts the AES key by the private key from step 1, and then decrepts the cipher by AES key, and executes the DAG, then encrypts the results by AES key;
We use multi TEE computation and verification scheme, which can make computation verifiable for all EigenCC in the list.
If people leak their AES key, we should enable them to upgrade the AES key. Since AES key have been used to encrypt the secrets in the contract, Leaking means we lost the confidentiality of the cipher. We provide an re-encrypt function exposed by ecall.
- unary operations: not, or, and, xor
- binary operations: add, sub, mul
- recrypt: update the AES key, and re-encrypt the secrets
- where(cond, x, y): if cond is true, return x, else return y;
- Context
struct Context {
string ctx_id;
int32 version; // AES key version
mapping(bytes=>bytes) value; // value is cipher, key can be address or any other unique id
}
- Privacy ERC20: The balance of each address is hided
contract PrivacyERC20 {
use EigenPriv for *;
Context ctx;
function PrivacyToken() public view returns () {
}
}