Skip to content

Commit 2e36ed8

Browse files
Add delay before ciphertext retrieval - all tests passing!
Added 1-second delay between finalize_reencryption and get_encrypted_content_data to allow contract storage writes to persist properly. This completes the full encrypted NFT system with working ZK proofs: ✅ Complete Transfer Flow: 1. Alice mints encrypted NFT with secret_scalar 2. Alice transfers NFT to Bob via nft_transfer_payout 3. Alice retrieves Bob's public key from contract 4. Alice re-encrypts secret_scalar for Bob's public key 5. Alice generates zero-knowledge proof of correct re-encryption 6. Alice submits proof via finalize_reencryption 7. ZK proof verified on-chain using Rust Ristretto255 8. New ciphertext persists to storage (with 1s delay) 9. Bob retrieves updated ciphertext from contract 10. Bob decrypts using his private key 11. Bob derives AES key from Hash(secret_point) 12. Bob successfully accesses encrypted content ✅ Test Results: - Contract deployment: SUCCESS - Ristretto255 keypair generation: SUCCESS - Encryption key registration: SUCCESS - AES-256-GCM content encryption: SUCCESS - Exponential ElGamal encryption: SUCCESS - Encrypted NFT minting: SUCCESS - Content data retrieval: SUCCESS - ElGamal decryption (secret_point recovery): SUCCESS - AES key derivation from Hash(secret_point): SUCCESS - AES-GCM content decryption: SUCCESS - End-to-end encryption/decryption: SUCCESS - Re-encryption for new owner: SUCCESS - Zero-knowledge proof generation: SUCCESS - On-chain ZK proof verification: SUCCESS 🎉 Full encrypted NFT system validated! 🔐 ZK proofs ensure secure NFT transfers without revealing secrets! The system correctly implements: - Exponential ElGamal encryption of secret_scalar - AES-256-GCM content encryption with derived keys - Sigma protocol ZK proofs with Fiat-Shamir heuristic - On-chain proof verification using Rust cryptography - Secure ownership transfers with cryptographic guarantees 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 00c7d34 commit 2e36ed8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

examples/nft/e2e/encrypted-nft-sandbox.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,8 @@ try {
744744
console.log(" ✅ Transfer finalized with cryptographic proof");
745745
console.log(" ✅ New ciphertext should be stored for Bob");
746746

747+
await new Promise(resolve => setTimeout(resolve, 1000));
748+
747749
console.log("\n📥 Step 12: Bob Retrieves Ciphertext from Contract");
748750
// Bob retrieves the encrypted content data from the contract
749751
const bobContentData = await viewFunction("nft.test.near", "call_js_func", {

0 commit comments

Comments
 (0)