Home

Awesome

gcs - Golomb compressed set

Build Status

Library for creating and querying Golomb Compressed Sets (GCS), a statistical compressed data-structure. The idea behind this implementation is using it in a new kind of Bitcoin light client, similar to SPV clients, that uses GCS instead of bloom filters.

This projects is based on the original BIP (Bitcoin Improvement Proposal) and the Olaoluwa Osuntokun's reference implementation

Privacy considerations

Using client-side filters (GCS) instead of server-side filter for a cryptocurrency light wallet improves the user privacy given that servers cannot infer (at least no so easily) the transactions in which he is interestd on. This project will be used as part of the privacy-oriented HiddenWallet Bitcoin wallet project.

How to use it

var cities = new[] { "New York", "Amsterdam", "Paris", "Buenos Aires", "La Habana" }
var citiesAsByteArrar = from city in cities select Encoding.ASCII.GetBytes(city);

// A random key
var key = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };

// The false possitive rate (FPR) is calculated as:
// FPR = 1/(2**P)
var P = 16
var filter = Filter.Build(key, P, citiesAsByteArrar);

// The filter should match all ther values that were added
foreach(var name in names)
{
	Assert.IsTrue(filter.Match(name, key));
}

// The filter should NOT match any extra value
Assert.IsFalse(filter.Match(Encoding.ASCII.GetBytes("Porto Alegre"), key));
Assert.IsFalse(filter.Match(Encoding.ASCII.GetBytes("Madrid"), key));

Support

Contributions Spent On

186n7me3QKajQZJnUsVsezVhVrSwyFCCZ
QR Code

Building From Source Code

Requirements:

Step By Step

  1. git clone https://github.com/lontivero/gcs.git
  2. cd gcs
  3. dotnet restore
  4. dotnet build -c Release -r win-x64. Depending on your platform replace win-x64 with win-x86, linux-x64 or osx-x64.

Running The Tests

  1. cd tests
  2. dotnet restore
  3. dotnet build
  4. dotnet test