Skip to content

darwinzer0/scrt-diff-privacy-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Differential privacy example on Secret Network

This repository contains an example of differentially private queries on encrypted data stored on Secret Network. It demonstrates COUNT and MEAN queries which are fuzzied using the Laplace mechanism to add noise to the result.

Running test

Follow the instructions to build the contract in the contract folder. Start the dev chain (cosmwasm v1.0 version) and run the test script in test. More instructions for building and running tests, respectively, are in the README.md files of each subdirectory.

Features

The test script uploads a set of observations to the contract (sample data from the Iris dataset) and calculates fuzzy count and average values for the observations.

The substrate-fixed crate was used to implement noise calculation using fixed-point arithmetic. (The Laplace mechanism requires logarithm on a unit interval random number).

Contract initialization sets the epsilon value (higher epsilon gives closer to true value / less privacy, lower epsilon adds more noise / more privacy), and a privacy budget. Each query will use some of the privacy budget, and once it is exhausted no more queries are allowed on the data.

The queries are implemented as exec functions in the contract, because they need to update how much of the privacy budget is left.

About

Simple example implementing differential privacy in a secret network contract

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published