Algorand 0.1.2.1
See the version list below for details.
dotnet add package Algorand --version 0.1.2.1
NuGet\Install-Package Algorand -Version 0.1.2.1
<PackageReference Include="Algorand" Version="0.1.2.1" />
paket add Algorand --version 0.1.2.1
#r "nuget: Algorand, 0.1.2.1"
// Install Algorand as a Cake Addin #addin nuget:?package=Algorand&version=0.1.2.1 // Install Algorand as a Cake Tool #tool nuget:?package=Algorand&version=0.1.2.1
Dotnet Algorand SDK
Finally, the dotnet algorand sdk is ready for use, give it a try!
- Prerequisites
This library is compliant to .Net Standard 2.0, so you can use this library on any planform which can use the .Net Standard 2.0.
- How to Install
Open the NuGet command line and type:
Install-Package Algorand
- Quick Start
string ALGOD_API_ADDR = "your algod api address";
//string ALGOD_API_ADDR = "http://hackathon.algodev.network:9100"; //hackathon
string ALGOD_API_TOKEN = "your algod api token"; //find in the algod.token
//string ALGOD_API_TOKEN = "ef920e2e7e002953f4b29a8af720efe8e4ecc75ff102b165e0472834b25832c1";
AlgodApi algodApiInstance = new AlgodApi(ALGOD_API_ADDR, ALGOD_API_TOKEN);
Get information from algorand blockchain:
try
{
Supply supply = algodApiInstance.GetSupply();
Console.WriteLine("Total Algorand Supply: " + supply.TotalMoney);
Console.WriteLine("Online Algorand Supply: " + supply.OnlineMoney);
}
catch (ApiException e)
{
Console.WriteLine("Exception when calling algod#getSupply: " + e.Message);
}
ulong? feePerByte;
string genesisID;
Digest genesisHash;
ulong? firstRound = 0;
try
{
TransactionParams transParams = algodApiInstance.TransactionParams();
feePerByte = transParams.Fee;
genesisHash = new Digest(Convert.FromBase64String(transParams.Genesishashb64));
genesisID = transParams.GenesisID;
Console.WriteLine("Suggested Fee: " + feePerByte);
NodeStatus s = algodApiInstance.GetStatus();
firstRound = s.LastRound;
Console.WriteLine("Current Round: " + firstRound);
}
catch (ApiException e)
{
throw new Exception("Could not get params", e);
}
If you want to go furfure, you should have an account. You can use Account acc = new Account();
to generate a random account. Surely you can use mnemonic to create an account. The example below using mnemonic to create an account and send some algos to another address.
ulong? amount = 100000;
ulong? lastRound = firstRound + 1000; // 1000 is the max tx window
string SRC_ACCOUNT = "typical permit hurdle hat song detail cattle merge oxygen crowd arctic cargo smooth fly rice vacuum lounge yard frown predict west wife latin absent cup";
Account src = new Account(SRC_ACCOUNT);
Console.WriteLine("My account address is:" + src.Address.ToString());
string DEST_ADDR = "KV2XGKMXGYJ6PWYQA5374BYIQBL3ONRMSIARPCFCJEAMAHQEVYPB7PL3KU";
Transaction tx = new Transaction(src.Address, new Address(DEST_ADDR), amount, firstRound, lastRound, genesisID, genesisHash);
//sign the transaction before send it to the blockchain
SignedTransaction signedTx = src.SignTransactionWithFeePerByte(tx, feePerByte);
Console.WriteLine("Signed transaction with txid: " + signedTx.transactionID);
// send the transaction to the network
try
{
//encode to msg-pack
var encodedMsg = Algorand.Encoder.EncodeToMsgPack(signedTx);
TransactionID id = algodApiInstance.RawTransaction(encodedMsg);
Console.WriteLine("Successfully sent tx with id: " + id.TxId);
}
catch (ApiException e)
{
// This is generally expected, but should give us an informative error message.
Console.WriteLine("Exception when calling algod#rawTransaction: " + e.Message);
}
That's all? Yes this is a complete example, you can find more examples in the sdk-examples project.
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
- BouncyCastle.NetCore (>= 1.8.5)
- Microsoft.CSharp (>= 4.7.0)
- Newtonsoft.Json (>= 12.0.3)
- Newtonsoft.Msgpack (>= 0.1.11)
- RestSharp (>= 106.6.10)
- System.ComponentModel.Annotations (>= 4.7.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Algorand:
Package | Downloads |
---|---|
Swisschain.Sirius.Sdk.Crypto
Package Description |
|
Quantoz.Nexus.Sdk.Token
Sdk for interacting with the Quantoz Nexus token environment. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.2.1 | 22,910 | 12/8/2021 |
0.2.0.9 | 24,912 | 11/17/2021 |
0.2.0.8 | 1,984 | 9/23/2021 |
0.2.0.7 | 1,433 | 7/21/2021 |
0.2.0.6 | 2,331 | 6/11/2021 |
0.2.0.5 | 2,598 | 3/21/2021 |
0.2.0.4 | 326 | 3/17/2021 |
0.2.0.3 | 454 | 1/31/2021 |
0.2.0.2 | 357 | 1/28/2021 |
0.2.0.1 | 489 | 1/28/2021 |
0.2.0 | 691 | 11/11/2020 |
0.1.2.6 | 566 | 5/29/2020 |
0.1.2.5 | 504 | 5/11/2020 |
0.1.2.4 | 455 | 4/24/2020 |
0.1.2.3 | 545 | 12/23/2019 |
0.1.2.2 | 499 | 12/21/2019 |
0.1.2.1 | 491 | 12/19/2019 |
0.1.2 | 499 | 12/19/2019 |
0.1.1 | 508 | 12/17/2019 |
0.1.0 | 535 | 12/15/2019 |
The first version of the Algorand SDK.