memoryfraction / Algorand.algonode.sdk.net

An algorand sdk in .net core based on algonode.io.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Algorand.algonode.sdk.net

[Readme]: 中文 | English

摘要

本项目基于algonode.io,用户可以通过调用C#类库,得到、操作Algorand节点信息。

术语

区块链,一种高级数据库机制,允许在企业网络中透明地共享信息。 区块链数据库将数据存储在区块中,而数据库则一起链接到一个链条中。 数据在时间上是一致的,因为在没有网络共识的情况下,您不能删除或修改链条。 因此,您可以使用区块链技术创建不可改变的分类账,以便跟踪订单、付款、账户和其他交易。

Algorand,一个基于区块链加密货币平台,以安全、高可扩展性与去中心化为宗旨。[1]阿尔戈兰德平台支持智能合约功能[2],其共识机制基于权益证明原则和拜占庭共识协议。[1][3][4]该平台的原生加密货币称为阿尔戈(Algo)。[2]

Algorand平台的研发由位于波士顿的阿尔戈兰公司(Algorand, Inc.)负责。2017年,麻省理工学院计算机科学教授、图灵奖得主希尔维奥·米卡利创办了这家公司。[5][6]

Algorand的测试网络于2019年4月向公众开放[7],主网络则于2019年6月开通。[8]

Algorand.sdk.net,基于NetStandard和Net 6开发的跨平台类库,用户可以使用C#语言直接通过简单步骤获取algorand链上信息。

使用步骤

1 安装依赖项

1.1 安装对应Nuget包 暂无

1.2 下载整个项目,添加对于Algorand.sdk.net的引用

2 设置基础信息

见Algorand.sdk.Net.UniTests, 其基础信息格式如下:

{ 
   "Configuration": {
    "HostAddress": "https://mainnet-algorand.api.purestake.io/ps2",
    "TestAlgoAddress": "",
    "LFOAssetId": "",
    "ReserveAddress": ""
  }
}

右击项目 Algorand.sdk.Net.UniTests -> Manage UserSecret.json, 在其中配置真正的信息。

注意:UserSecret.json不会被上传到Git

3 运行TestCases

UserSecret.json配置完毕后,单元测试才能正常运行。

打开View -> TestExplorer。运行所有单元测试

4 常用案例

4.1 获取账户信息

var account = await _clientV2.GetAccountInformationAsync(_lfoAssetId, _testAlgoAddress);
Assert.IsTrue(account.AssetHolding.Amount > 1);

#Response Json
{
  "asset-holding": {
    "amount": ,
    "asset-id": ,
    "is-frozen": false  },
  "round": 33351743
}

4.2 获取Asset信息

var assetResponse = await _clientV2.GetAssetInformationAsync(_lfoAssetId);
Assert.IsTrue(assetResponse.Succeed);
Assert.IsTrue(assetResponse.Response != null);

#Response Json
{
  "index": ,
  "params": {
    "clawback": "",
    "creator": "",
    "decimals": 4,
    "default-frozen": false,
    "freeze": "",
    "manager": "",
    "name": "",
    "name-b64": "TGVhZGVyRnVuZE9uZQ==",
    "reserve": "",
    "total": 10000000000000,
    "unit-name": "",
    "unit-name-b64": "TEZP"  }
}

更多案例,详见Algorand.sdk.Net.UnitTests测试Cases。

小结

本项目基于algonode.io开发了.NET Core 类库,C#使用者可以方便调用Algorand相关信息。

关于作者

热爱C#、区块链等技术。

Email:     rex.fan18@gmail.com

拥有沃顿商学院: Economics of Blockchain and Digital Assets - Certificate

Badge验证链接:  Economics of Blockchain and Digital Assets - Credly

参考资料

1 Algorand - Wikipedia

2 如何在Algorand链上创建自己的Token?

如果我的工作对您有帮助,还请收藏本项目、转发、请作者喝咖啡。

Algo address: EFIRPOWUEZIOGEBSR47R5WOEFIKSDBPA5UJERXX75GIIP3JTPBAI5PC7I4

Introduction

An algorand sdk in .net core based on algonode.io.

Terms

Blockchain, an advanced database mechanism that allows transparent sharing of information across corporate networks. Blockchain databases store data in blocks, and databases are linked together in a chain. The data is consistent in time because you cannot delete or modify the chain without network consensus. Therefore, you can use blockchain technology to create an immutable ledger in order to track orders, payments, accounts and other transactions.

Algorand, a blockchain-based cryptocurrency platform for security, scalability and decentralization. [1] The Algorand platform supports smart contract functions [2], and its consensus mechanism is based on the principle of proof of stake and Byzantine consensus protocol. [1][3][4] The platform’s native cryptocurrency is called Algo. [2] The Algorand platform is developed by Algorand, Inc., located in Boston. The company was founded in 2017 by MIT computer science professor and Turing Award winner Silvio Mikkali. [5][6] Algorand's testnet opened to the public in April 2019 [7], and the mainnet opened in June 2019. [8]

Algorand.sdk.net, a cross-platform class library developed based on NetStandard and Net 6, users can use the C# language to directly obtain information on the algorand chain through simple steps. According to user feedback, Post operations may be added later.

Steps to Use

1 Install dependencies

1.1 install the corresponding Nuget package no nuget package so far

1.2 Download the entire project and add a reference to Algorand.algonode.sdk.net

2 Set basic information

See Algorand.sdk.Net.UniTests, the basic information format is as follows:

{ 
 "Configuration": {
    "HostAddress": "https://mainnet-algorand.api.purestake.io/ps2",
    "ApiKey": "",
    "TestAlgoAddress": "",
    "LFOAssetId": "",
    "ReserveAddress": ""
  }
}

Right click on the project Algorand.sdk.Net.UniTests -> Manage UserSecret.json, and configure the real information in it.

Note: UserSecret.json will not be uploaded to Git

3 Run TestCases

Unit tests can only run properly after UserSecret.json is configured.

Open View -> TestExplorer. run all unit tests

4 Common cases

4.1 Get account information

var account = await _clientV2.GetAccountInformationAsync(_lfoAssetId, _testAlgoAddress);
Assert.IsTrue(account.AssetHolding.Amount > 1);

#Response Json
{
  "asset-holding": {
    "amount": ,
    "asset-id": ,
    "is-frozen":   },
  "round": 
}

4.2 Get Asset Information

var assetResponse = await _clientV2.GetAssetInformationAsync(_lfoAssetId);
Assert.IsTrue(assetResponse.Succeed);
Assert.IsTrue(assetResponse.Response != null);

#Response Json
{
  "index": ,
  "params": {
    "clawback": "",
    "creator": "",
    "decimals": 4,
    "default-frozen": false,
    "freeze": "",
    "manager": "",
    "name": "",
    "name-b64": "TGVhZGVyRnVuZE9uZQ==",
    "reserve": "",
    "total": 10000000000000,
    "unit-name": "",
    "unit-name-b64": "TEZP"  }
}

For more cases, see Algorand.sdk.Net.UnitTests Test Cases.

Summary

This project has developed a .NET Core class library based on https://algonode.io/api/, and C# users can easily call Algorand related information.

The Author

#Rex Fan

Love C#, blockchain and other technologies.

Email: rex.fan18@gmail.com

Linkedin: https://www.linkedin.com/in/rongfan1031/

With Wharton: Economics of Blockchain and Digital Assets - Certificate

Validation Badge URL:  Economics of Blockchain and Digital Assets - Credly

Reference

1 Algorand - Wikipedia

2 How to create your own Algorand token

Originality is not easy, your feedback is the driving force for continuous innovation.

If my work is helpful to you, please bookmark this project, forward it, or buy the author to drink coffee.

Algo address: EFIRPOWUEZIOGEBSR47R5WOEFIKSDBPA5UJERXX75GIIP3JTPBAI5PC7I4

About

An algorand sdk in .net core based on algonode.io.

License:MIT License


Languages

Language:C# 100.0%