+
Skip to content

[Feature Request] Support for Encrypted Return Values in Generated Solidity Contracts #328

Open
@oftiyf

Description

@oftiyf

[Feature Request] Support for Encrypted Return Values in Generated Solidity Contracts

Description

Currently, the Circom framework has limitations regarding return values in the generated Solidity contracts. This constraint reduces flexibility in many use cases where we need to return encrypted data to be stored on-chain.

Current Behavior

  • Generated Solidity contracts don't support return values
  • Limited flexibility in complex scenarios requiring on-chain encrypted data storage
  • No option to return encrypted computation results

Proposed Enhancement

Add optional support for returning encrypted values that can be stored on-chain. This would:

  1. Allow circuits to return encrypted computation results
  2. Enable more complex use cases while maintaining zero-knowledge properties
  3. Provide more flexibility for projects with advanced requirements
  4. Make the encrypted return values optional (opt-in feature)

Use Cases

  1. Privacy-preserving computations that need to store encrypted results on-chain
  2. Complex ZK applications requiring state updates with encrypted data
  3. Advanced protocols needing to chain multiple ZK proofs with intermediate encrypted results

Benefits

  • Enhanced flexibility for complex ZK applications
  • Broader range of possible use cases
  • Maintained security through encryption
  • Optional feature (wouldn't affect existing implementations)

Implementation Suggestions

  1. Add encryption wrapper for circuit outputs
  2. Modify Solidity contract generator to support encrypted return values
  3. Provide documentation for proper usage and security considerations
  4. Include example implementations

Questions

  • What encryption methods would be most suitable?
  • How would this affect gas costs?
  • What would be the optimal way to implement this without compromising the framework's security guarantees?

Additional Context

This feature would be particularly valuable for projects requiring:

  • Complex multi-step ZK proofs
  • On-chain state management with encrypted data
  • Integration with other privacy-preserving protocols

Would love to hear the community's thoughts on this proposal and potential implementation approaches.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载