https://github.com/dkackman/chia-dotnet-bls
.NET BLS Library https://dkackman.github.io/chia-dotnet-bls/index.html
https://github.com/dkackman/chia-dotnet-bls
Last synced: 8 months ago
JSON representation
.NET BLS Library https://dkackman.github.io/chia-dotnet-bls/index.html
- Host: GitHub
- URL: https://github.com/dkackman/chia-dotnet-bls
- Owner: dkackman
- License: apache-2.0
- Created: 2024-01-01T21:53:20.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-18T20:59:35.000Z (about 2 years ago)
- Last Synced: 2025-02-15T08:05:49.296Z (over 1 year ago)
- Language: C#
- Homepage:
- Size: 9.91 MB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# chia-dotnet-bls
.NET BLS Library
[](https://github.com/dkackman/chia-dotnet-bls/actions/workflows/dotnet.yml)
[](https://github.com/dkackman/chia-dotnet-bls/actions/workflows/github-code-scanning/codeql)
[](https://www.nuget.org/packages/chia-dotnet-bls/)
## Introduction
Many thanks to [Rigidity](https://github.com/Rigidity) who's code this is a direct port of and and helped immensely along the way.
This is a direct port of the [chia bls typescript library](https://github.com/Chia-Network/node-chia-bls). Coding style and naming have been converted to C# conventions but otherwise it is very similar in API.
## See Also
- [Documentation](https://dkackman.github.io/chia-dotnet-bls/)
- [chia-dotnet](https://www.nuget.org/packages/chia-dotnet/)
- [chia-dotnet-clvm](https://www.nuget.org/packages/chia-dotnet-clvm/)
- [chia-blockchain](https://chia.net)
- [dotnetstandard-bip39](https://www.nuget.org/packages/dotnetstandard-bip39/)
## Example Usage
```csharp
using chia.dotnet.bls;
using dotnetstandard_bip39; // https://www.nuget.org/packages/dotnetstandard-bip39/
const string MNEMONIC = "abandon abandon abandon";
const string MESSAGE = "hello world";
// create a secret key from a mnemonic
var bip39 = new BIP39();
var seed = bip39.MnemonicToSeedHex(MNEMONIC, "");
var sk = PrivateKey.FromSeed(seed);
// sign the message
var signature = sk.Sign(MESSAGE);
// verify the signature
var pk = sk.GetG1();
var result = pk.Verify(MESSAGE, signature);
Console.WriteLine($"Signature is valid: {result}");
```
___
_chia and its logo are the registered trademark or trademark of Chia Network, Inc. in the United States and worldwide._