Evidence Box Data
On-Chain Data Structure
enum Status {Storing, Selling, Auctioning, Paid, Refunding, Delaying, Published, Blacklisted}
struct PublicData {
Status _status;
uint256 _price;
uint256 _deadline;
}
struct SecretData {
bytes32 _minterId;
bytes _encryptedData; // sapphire encrypted data (private key)
bytes32 _nonce; // sapphire encrypted nonce, decryption required
}
mapping(uint256 boxId => BasicData) internal _basicData;
mapping(uint256 boxId => SecretData) internal _secretData;
- PublicData: Current status, price, and expiration time, used for transaction matching and access permission control.
- SecretData: Confidential fields encrypted by Sapphire TEE, containing the creator ID, encrypted confidential data (usually a key), and a nonce.
The minterId is not an address, but a random bytes32 type data generated through the UserManager contract. It looks like an address, but it has no relationship with the real address. This is done to ensure that the whistleblower's original address is not associated on the chain, thereby guaranteeing privacy.
metadata-Box
The metadata file of the Evidence Box is stored on IPFS. Its CID is not directly stored in the contract, but is recorded on-chain triggered by contract events.
emit BoxCreated(boxId, userId, boxInfoCID_);
There are two methods to create a Evidence Box: create and createAndPublish.
create
Creates a sellable Evidence Box with the initial Status of Storing. Only create requires data encryption processing, and the metadata contains the encrypted data.
{
"mint_method": "create",
"encryption_slices_metadata_cid": {
"encryption_data": "0xabae872298fe488793f17df3e79c5dd4e8f8e9f9da0cf1edee035314887c7192deb7ada30b04915e0602a75c001991ecc570966430f9cf6fa06d3d8fb53caa1e02d7417447f91957336525",
"encryption_iv": "0x76ed0699369e1b84988d424b"
},
"encryption_file_cid": [
{
"encryption_data": "0x71f4e8844358d32996f98a27c807fffdd706dec902764f6ba00221ca5e3e16c80c42a86a65c6f975ad1ce6d566cdccda5335d7379985956c39fb1bffb51e0dc9510f2c48cf7a1985cf7487",
"encryption_iv": "0x11bcacd05f25f5fb5dc88191"
},
{
"encryption_data": "0xd3d0d4d7f519cc846dfd2faeaf0cc3de1be26fdd7e0b7405778d6c42d9da140f6f281e318a45331fc5f65ea4b2dccc61bbc36ddc02a34a1fea31eb05b59ae5ba762c3136f58ace71c57245",
"encryption_iv": "0x827b3181516cb4283ac44a76"
}
],
"encryption_password": {
"encryption_data": "0xbad15d202fc944949086f1d490d169f2b17b49f71fd0ca63020348b8060e8166c6a485c0c3c87d59d8810b6e8480a73cf1900287722afc053296d4522e9dc51ed8f72b7ab6f3f9ae65440aef7b6f3518",
"encryption_iv": "0x3dd46d0c6a9df5c8e7bf9b3f"
},
"public_key": "0x3059301306072a8648ce3d020106082a8648ce3d03010703420004cdb130ae2d72132ec0369c11873353f22ddb09e4f0d52c221c9d673090596bc38fab6d842690d0ce6aedf7fddc740fd1572c2511e86728b1332b6eb8732ad9ca",
"file_list": []
}
createAndPublish
Creates a directly public Evidence Box with the Status of Published. It does not require encryption and does not contain symmetrically encrypted data. Instead, it directly stores the CIDs of the evidence files for direct access.
{
"mint_method": "createAndPublish",
// "encryption_slices_metadata_cid": {
// "encryption_data": "",
// "encryption_iv": ""
// },
// "encryption_file_cid": [],
// "encryption_password": {
// "encryption_data": "",
// "encryption_iv": ""
// },
// "public_key": "",
"file_list": ["bafkreibnsg36tgfxsoyq3jb6dfwwb3ffunn3mrrd6twlj6p5mhstfym3xy"]
}