Backend Workflow
Here is an example workflow of how a user file is uploaded by Intra on behalf of the user:
Once per day, for every registered user we fetch Oura data from the API. The JSON files are zipped. We then do client side encryption using the user’s signature just like the tee-ui-template:
vanaencrypt.ClientSideEncrypt(zipFileBuf.Bytes(), ourauser.Signature)The encrypted file is saved to our DigitalOcean storage space (links are publicly accessibly just like DropBox, GoogleDrive)
https://walletchat-pfp-storage.sgp1.digitaloceanspaces.com/0x4A8a9147ab0DF5A8949f964bDBA22dc4583280E22024-12-12_21-28-23_archive.zip
We encrypt the user signature using the DLP public key (producing the DLP EEK)
vanaencrypt.EncryptWithWalletPublicKey(ourauser.Signature, publicKeyDLP, iv, ephemPrivateKeyBytes)
We then call /addFileWithPermissions to register to file on the Vana blockchain: vanatransact.AddFileWithPermissions(walletAddress, fileUrl, hexDataDlpEEK)
https://moksha.vanascan.io/tx/0xd1cd537a60052867ca4083a6516ef464749318ffbf6806439ba5b5b7ea480b5f
Get file TEE contribution price/cost:
vanatransact.GetTeeContributionProof(fileID)
https://moksha.vanascan.io/tx/0x5879692b3d4dca00407f91c13546e095b4f2c2a1583d530352ac555a85db1f04
Get the jobIds for the File:
vanatransact.GetFileJobIDs(fileIDstr)Get TEE details for the retrieved JobID:
vanatransact.GetTeeDetails(*latestJobId)
Tee Info Result: {0x29181092943eF1dd869C04eA10BD6D5961e597ca https://satya-node-moksha-20.usevana.com 1 0 0 63 0x6abe081dffc9cf6beb30fc6bcc9b134f960d068f1d01f07b3263c8d0c65b841534fce525968ff432543483e09f9792d3d444e0258d0c1db470400d14ebc281de}
Encrypt the user signature (TEE EEK), and API key (secrets parameter) - and call /RunProof to the TEE:
vanatransact.SendContributionProof(latestJobId, fileID, publicKeyDLP, envVars, secrets, teePublicKey…)Request reward for the file:
vanatransact.RequestRewardFromDLP(fileID)
https://moksha.vanascan.io/tx/0xf6c5f8c50061497ab23aa32d244540a554e3f670644d42e80a79bd9d7d811f0e
Our TEE Proof is at: https://github.com/Wallet-Chat/vana-satya-proof-template-py/releases
Last updated