In reference to a calculation of a hidden stored value.

For example: Account A & Account B Both have hidden stored values.

Accounts A cannot know B's hidden stored value, and vice versa.

Is it possible for A to interact with B's value, without knowledge of B's hidden value.

Could a smart contract be written to allow A to interact with B's value without knowing (in this case compare and change the value?)

Im assuming this icovered by zkSnarks?

  • Fixed "hidden" to "stored". – AstroBoy Oct 26 '18 at 0:57

Short answer is Yes, but depends on what you really need. The following contract stores the age of the person and without revealing it, can "certify" if the person is a teen or an adult. You can also increase the age without knowing it.

pragma solidity ^0.4.25;

contract ZK {
    uint private age;

    constructor (uint _age) public {
        age = _age;

    function isAdult() public view returns (bool) {
        return (age >= 18);

    function isTeen() public view returns (bool) {
        return (age >= 13 && age <= 19);

    function addYears (uint _years) public {
        age += _years;

Of course the age variable is not really "hidden", but, as you said, is "stored" on the blockchain. From the point of view of a smart contract it is hidden...

| improve this answer | |
  • 1
    You can easily read the age by just checking the storage of the contract manually, it's not really hidden. – Raghav Sood Oct 26 '18 at 8:51
  • Exactly, but @AstroBoy changed "hidden" to "stored", so I assumed he was looking for a simpler thing than a real skSnark – Marco Ottolini Oct 26 '18 at 9:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.