Blockcoli.Libra.Net
0.7.0
See the version list below for details.
dotnet add package Blockcoli.Libra.Net --version 0.7.0
NuGet\Install-Package Blockcoli.Libra.Net -Version 0.7.0
<PackageReference Include="Blockcoli.Libra.Net" Version="0.7.0" />
paket add Blockcoli.Libra.Net --version 0.7.0
#r "nuget: Blockcoli.Libra.Net, 0.7.0"
// Install Blockcoli.Libra.Net as a Cake Addin #addin nuget:?package=Blockcoli.Libra.Net&version=0.7.0 // Install Blockcoli.Libra.Net as a Cake Tool #tool nuget:?package=Blockcoli.Libra.Net&version=0.7.0
Blockcoli.Libra.Net
Libra Wallet SDK for .NET
Blockcoli is an open source project which is the world 1st .NET SDK for creating Libra wallet. It is hosted on Github repository and also built as a Nuget package.
Build from .NET Standard 2.0 and .NET Core 3.1
What's New
- Update Proto
- Change AccountStatePath
- Change RawTransactionHashSalt
- Transaction Payload Change from Program to ScriptLCS
- Libra Client - SubmitTransactionRequest.SignedTxn ⇒ SubmitTransactionRequest.Transaction
- Faucet change to LibExplorer API
Installation
To install the nuget package from a command line, run:
dotnet add package Blockcoli.Libra.Net
Or from Visual Studio Package Manager Console
Install-Package Blockcoli.Libra.Net
Usage
At the top of your class file, add using
for two namespaces.
using Blockcoli.Libra.Net.Wallet;
using Blockcoli.Libra.Net.Client;
Creating an account
In order to create a libra account, you would need to instantiate the LibraWallet
as shown in the following code example:
// Create a new wallet
var wallet = new LibraWallet();
// Create a new account
var account = wallet.NewAccount();
// Mnemonic words (secret) for recovering wallet
var mnemonic = wallet.Mnemonic;
Console.WriteLine(mnemonic);
// Get your account address
Console.WriteLine(account.Address);
Recovering an account
In order to create a libra account, you would need to instantiate the LibraWallet
as shown in the following code example:
// Recovering a wallet with mnemonic words (secret)
var mnemonic = "elite kidney kangaroo enhance list mule paddle arrange popular frown ahead carry endorse thunder toy broken absorb level surprise arrow analyst segment wave fat";
// Create a wallet
var wallet = new LibraWallet(mnemonic);
// Recover an Account
var account = wallet.NewAccount();
// Get your account address
Console.WriteLine(account.Address);
Minting an amount
To mint an amount, you would need to create a LibraClient
and use it to mint
// Currently minting only works for testnet and uses the faucet service.
var client = new LibraClient(LibraNetwork.Testnet);
// Mint amout in Micro-Libra. (1 Libra = 1000000 Micro-Libra)
var resualAmount = await client.MintWithFaucetService(account.Address, 1000000);
Checking an address balance
// You can use parameter array for checking multiple addresses.
var accountState = await client.QueryBalance(account.Address);
Console.WriteLine(accountState.Balance);
Transferring Libra coins
// You can use parameter array for checking multiple addresses.
var sender = wallet.Accounts.ElementAt(0).Value;
var receiverAddress = "face4412ab3325cf6e26624cff089eb1bf8ec6da489f05aad72a81de5ff7b5d1";
var amount = 10000000UL;
var success = await client.TransferCoins(sender, receiverAddress, amount);
Console.WriteLine($"AC Status: {success}");
Related projects
- Libra Core by perfectmak : https://github.com/perfectmak/libra-core
- Libra Core by kulapio : https://github.com/kulapio/libra-core
- Elliptic-curve cryptography by PeterWaher : https://github.com/PeterWaher/IoTGateway
- 1950Labs / 2019_POC_Libra : https://github.com/1950Labs/2019_POC_Libra
License
MIT License Copyright (c) 2019 Blockcoli
Official website
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Google.Protobuf (>= 3.11.2)
- Grpc (>= 2.25.0)
- System.Text.Json (>= 4.7.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Update Proto | Change AccountStatePath | Change RawTransactionHashSalt | Transaction Payload Change from Program to ScriptLCS | Libra Client - SubmitTransactionRequest.SignedTxn | SubmitTransactionRequest.Transaction | Faucet change to LibExplorer API