ProjectOrigin.PedersenCommitment
0.2.0-rc.14
See the version list below for details.
dotnet add package ProjectOrigin.PedersenCommitment --version 0.2.0-rc.14
NuGet\Install-Package ProjectOrigin.PedersenCommitment -Version 0.2.0-rc.14
<PackageReference Include="ProjectOrigin.PedersenCommitment" Version="0.2.0-rc.14" />
paket add ProjectOrigin.PedersenCommitment --version 0.2.0-rc.14
#r "nuget: ProjectOrigin.PedersenCommitment, 0.2.0-rc.14"
// Install ProjectOrigin.PedersenCommitment as a Cake Addin #addin nuget:?package=ProjectOrigin.PedersenCommitment&version=0.2.0-rc.14&prerelease // Install ProjectOrigin.PedersenCommitment as a Cake Tool #tool nuget:?package=ProjectOrigin.PedersenCommitment&version=0.2.0-rc.14&prerelease
Project-Origin Pedersen Commitment
This client library has an interface and currently a single implementation of HD keys as descriped in BIP32, and implemented using NBitcoin with the Secp256k1 curve.
How to
To create a Pedersen Commitment one must create a new instance of a SecretCommitmentInfo with the quantity (message : uint) one wants to hide.
var secret = new SecretCommitmentInfo(250);
The secret has two fields that must be persisted to later prove the data, the Message and BlindingValue.
// store these values
uint message = secret.Message;
ReadOnlySpan<byte> blinding = secret.BlindingValue;
The commitment to share publicly can be gotten directly from the SecretCommitmentInfo.
ReadOnlySpan<byte> commitment = secret.Commitment.C;
Range proofs
If one wants to prove the commitment is within the allowed value, one can easily create a range proof using a label:
Note: In ProjectOrigin Electricity the label is always the string representation of certificate uuid.
string someLabel = "foobar";
ReadOnlySpan<byte> rangeProof = secret.CreateRangeProof(someLabel);
The range proof is hardcoded to allow values between 0 and uint.Max (32 bits).
Why use a label?
The label is to ensure that the range proof is unique as to ensure that the same range proof is not used for multiple commitments. This is important as the range proof is a zero-knowledge proof, and if the same range proof is used for multiple commitments, one could use the range proof for exploits.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.1.1 | 22,491 | 4/3/2024 |
1.0.3 | 9,045 | 8/31/2023 |
1.0.2 | 143 | 8/31/2023 |
1.0.1 | 171 | 8/24/2023 |
1.0.0 | 150 | 8/23/2023 |
0.2.2 | 168 | 8/21/2023 |
0.2.1 | 160 | 8/14/2023 |
0.2.0 | 279 | 8/14/2023 |
0.2.0-rc.17 | 3,953 | 6/28/2023 |
0.2.0-rc.16 | 1,032 | 6/28/2023 |
0.2.0-rc.15 | 85 | 6/27/2023 |
0.2.0-rc.14 | 83 | 6/26/2023 |
0.2.0-rc.13 | 104 | 6/23/2023 |
0.2.0-rc.12 | 71 | 6/21/2023 |
0.2.0-rc.11 | 82 | 6/16/2023 |
0.2.0-rc.10 | 71 | 6/16/2023 |
0.2.0-rc.9 | 117 | 6/16/2023 |
0.2.0-rc.4 | 84 | 6/16/2023 |
0.2.0-rc.3 | 79 | 6/12/2023 |
0.2.0-rc.2 | 81 | 6/12/2023 |
0.2.0-rc.1 | 87 | 6/12/2023 |