become a node

  • Each Node does HMAC signing to the request message with secret key sk.
  • The signing is done through circuit representation of sha3_256 derived from Scale-Mamba library.
  • The user and the Node evaluate the circuit using with a 2PC connection where the input to the sha3_256 is secret shares {key_user , key_oracle_1} of the secret key from each user and Node.
1sk = key_user ^ key_oracle_1

Prerequisites for Running the Node

  1. Get the following library: mpc.git
  2. Build the garbler application in the /apps/garbled folder

Generate shares for the Node

  1. Run the application in apps/garbled/examples/key-import.mpcl using the garbler application
  2. The user (garbler) provides three arguments:
    - key [64]byte: the key to import
    - split [64]byte: random input for the key split value
    - mask [64]byte: random mask to mask garbler's key share result
  3. The node (evaluator) provides two arguments: the split and the mask values.
  4. The MPC program splits the key into two random shares:
    - users share : key_user = g.Split ^ e.Split
    - Node’s share: key_oracle= keyG ^ g.Key
  5. The result shares are masked with respective masks and returned as the result of the computation:
    - key_user_masked = keyG ^ g.Mask
    - key_oracle_masked = keyE ^ e.Mask
  6. Using these parameters:
1key:    a968f050ebd5c4ed2ddf9717f0f0fd9325b07c68ff5d62094800f5b69464bab9
2        8dd886a7c49460503fafa75f5f7430f2cdda7bd5cb60c1cbd471e35d67432d58
3split_oracle: 7e1d9bb27838f5c8481b7194f07b5f3059f9471ae8e69ea3fe79c629a92588d9
4        524a6e4364e77d222210135f6c5435a8be52fc99ad8fc8280e8207cac91fc7b3
5mask_oracle:  bed1bc2a3e6089bd016ff0175c62346438a9eb7b741f41787e5f7aad1720ee08
6        233a89e81e3bbd5eef26d158750a0fdd47471ded518d781f23de6d4346ea68ad
8split_user: b2146ed7385d63a76f599b27f03e83971149208b0c41604eea010806460a3266
9        93820075bc25c485b2bfcb9226488ba961eeb07980f8ab374b38f793e41e5247
10mask_user:  a0698ff8e72f51bf3bff3895c80a8ba8a527abaa5a7603391545ed5dcebb22b5
11        a2f191bcb3ac3a543cfdba99bded67a3ac6f5f254ff7e5c34520312c9b91f672
  1. Run the user:
1./garbled -e -v -i 0xb2146ed7385d63a76f599b27f03e83971149208b0c41604eea010806460a326693820075bc25c485b2bfcb9226488ba961eeb07980f8ab374b38f793e41e5247,0xa0698ff8e72f51bf3bff3895c80a8ba8a527abaa5a7603391545ed5dcebb22b5a2f191bcb3ac3a543cfdba99bded67a3ac6f5f254ff7e5c34520312c9b91f672 examples/key-import.mpcl
  1. Run the node:
1./garbled -v -i 0xa968f050ebd5c4ed2ddf9717f0f0fd9325b07c68ff5d62094800f5b69464bab98dd886a7c49460503fafa75f5f7430f2cdda7bd5cb60c1cbd471e35d67432d58,0x7e1d9bb27838f5c8481b7194f07b5f3059f9471ae8e69ea3fe79c629a92588d9524a6e4364e77d222210135f6c5435a8be52fc99ad8fc8280e8207cac91fc7b3,0xbed1bc2a3e6089bd016ff0175c62346438a9eb7b741f41787e5f7aad1720ee08233a89e81e3bbd5eef26d158750a0fdd47471ded518d781f23de6d4346ea68ad examples/key-import.mpcl
  1. The program returns two values: user’s and oracle's masked key shares:
1Result[0]: 72d8494f7e051fd2262d1aa45c27e8c370198cea90b8bf956a27b482f80f54b7e2f2e7dec6f904f97f8909953f16b1dc98fb510d7cfa1b0066649d1a6bebfd59
2Result[1]: c5088acd4c9f033d3162453138bfaa9cc827b053418c9fdd493dd6c4b5f022b3eee1792daffae3a393fdc50ba885e950be096810a9e04717d4eb2228d1d34ede
  1. Both peers can extract their key shares by XOR-ing their result with their mask value:
1share_oracle: cc09f5654065966f2742eab30045dca748b06791e4a7feed1478ce2fef2fbabf
2        c1c86e36d8c2b9a790afd8cd4a1cbe01dfbc4ce02d77631f45baf0592d0195f4
3share_user: 65610535abb052820a9d7da4f0b521346d001bf91bfa9ce45c783b997b4b0006
4        4c10e8911c56d9f7af007f9215688ef312663735e617a2d491cb13044a42b8ac

Calculate HMAC using garbled circuit

  1. Run the application in apps/garbled/examples/hmac-sha256.mpcl using the garbler application.
  2. The user and oracle share the secret (HMAC) key as random key shares as shown in the above steps:

    key_user: 4de216d2fdc9301e5b9c78486f7109a05670d200d9e2f275ec0aad08ec42af47 fcb59bf460d50b01333a748f3a9efb13e08036d49a26c21ba2e33a5f8a2cf0e7

    key_oracle: f87a00ef89c2396de32f6ac0748f6fa1b641013d46f74ce25cc625904215a675 01c0c7196a2602f6516527958a82271847933c35d170d98bfdb04d2ddf3bb197

    and the resulting HMAC key is key_user^key_oracle:
1secret_key : b598163d740b0973b8b312881bfe6601e031d33d9f15be97b0cc8898ae570932
2      fd755ced0af309f7625f531ab01cdc0ba7130ae14b561b905f53777255174170
  1. The application  must define the message lengths -here we are using uses 32-byte messages (Garbler.msg [32]byte) - so let's use the following message:

    msg : Hello, world!...................
    hex : 48656c6c6f2c20776f726c64212e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e

    and we should get the following HMAC-SHA256 output:

    Expected Hmac : 60d27dbd14f1e351f20069171fead00ef557d17ac9a41d02baa488ca4b90171a
  2. Now we can run the MPC protocol. First, run the user with one input: the user’s key share:
1./garbled -e -v -i 0xf87a00ef89c2396de32f6ac0748f6fa1b641013d46f74ce25cc625904215a67501c0c7196a2602f6516527958a82271847933c35d170d98bfdb04d2ddf3bb197 examples/hmac-sha256.mpcl
  1. The Oracle takes two inputs: the message and the user's key share:
1./garbled -v -i 0x48656c6c6f2c20776f726c64212e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e,0x4de216d2fdc9301e5b9c78486f7109a05670d200d9e2f275ec0aad08ec42af47fcb59bf460d50b01333a748f3a9efb13e08036d49a26c21ba2e33a5f8a2cf0e7 examples/hmac-sha256.mpcl
  1. The MPC computation provides the expected HMAC result:

    Result[0]: 60d27dbd14f1e351f20069171fead00ef557d17ac9a41d02baa488ca4b90171a

Sometimes the Command::new does not immeditely fire-up a process. Workaround is deployed. Working on a fix which handles the process exit gracefully. Multiple 2-PC is simulated using hard-coded values and tested. Production will require oracle setups. This bug should clear-out itself once oracles run on individual instances.


If you encounter any issues or have questions during the integration process, our support team is here to assist you.

Support Contact

Thank you for choosing ZKON. We're excited to be a part of your journey towards a more secure and decentralized world.

Contact us

We have received your submission! Wait for ZKON to contact you at the e-mail address provided.
Thank you very much!
Oops! Something went wrong when you submitted the form. Please try again or fill in any missing fields.