Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/baking-bad/netezos
Netezos is a cross-platform Tezos SDK for .NET developers, simplifying the access and interaction with the Tezos blockchain
https://github.com/baking-bad/netezos
blockchain cryptography tezos tezos-api tezos-blockchain tezos-client
Last synced: 3 months ago
JSON representation
Netezos is a cross-platform Tezos SDK for .NET developers, simplifying the access and interaction with the Tezos blockchain
- Host: GitHub
- URL: https://github.com/baking-bad/netezos
- Owner: baking-bad
- License: mit
- Created: 2019-05-16T15:27:51.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-05-23T17:20:58.000Z (6 months ago)
- Last Synced: 2024-06-29T03:46:49.842Z (4 months ago)
- Topics: blockchain, cryptography, tezos, tezos-api, tezos-blockchain, tezos-client
- Language: C#
- Homepage: https://netezos.dev
- Size: 1.94 MB
- Stars: 39
- Watchers: 5
- Forks: 21
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-tezos - Netezos
README
# Netezos
[![License: MIT](https://img.shields.io/github/license/baking-bad/netezos.svg)](https://opensource.org/licenses/MIT)> The first version of the library has been moved to the `v1` branch for historical purposes.
Netezos is a cross-platform Tezos SDK for .NET developers, simplifying the access and interaction with the [Tezos](https://tezos.com/) blockchain.
The following features have been implemented so far:
| Namespace | Description | Status |
| --------- | ----------- | ------ |
| Netezos.Contracts | Interaction with Tezos smart contracts | Ready to use. Dynamic wrapper: in progress... |
| Netezos.Forge| Forging (encoding) operation bytes | Ready to use |
| Netezos.Keys| Working with keys, HD keys, signing, verifying signature, etc. | Ready to use |
| Netezos.Ledger| Interaction with Tezos Ledger App | Ready to use (separate package) |
| Netezos.Rpc | Tezos RPC wrapper | Ready to use |For full documentation and API Reference, please refer to the [Netezos website](https://netezos.dev/)
### Contribution
Netezos is an open development project so any contribution is highly appreciated, starting from documentation improvements, writing examples of usage, etc. and ending with adding new features (as long as these features do not break existing API or are only intended for one person and for very specific use case).
Do not hesitate to use [GitHub issue tracker](https://github.com/baking-bad/netezos/issues) to report bugs or request features.
### Support
Feel free to join our [Discord server](https://discord.gg/aG8XKuwsQd), [Telegram chat](https://t.me/baking_bad_chat), or find us in [Tezos Dev Slack](https://tezos-dev.slack.com/archives/CV5NX7F2L).
We will be glad to hear any feedback and feature requests and will try to help you with general use cases of the Netezos library.## Getting started
Let's consider the most common use case - sending a transaction.
### Installation
`PM> Install-Package Netezos`
### Create private key
````cs
// generate new key
var key = new Key();// or use existing one
var key = Key.FromBase58("edsk4ZkGeBwDyFVjZLL2neV5FUeWNN4NJntFNWmWyEBNbRwa2u3jh1");// use this address to receive some tez
var address = key.PubKey.Address; // tz1SauKgPRsTSuQRWzJA262QR8cKdw1d9pyK
````### Get some data from RPC
````cs
using var rpc = new TezosRpc("https://mainnet-tezos.giganode.io/");// get a head block
var head = await rpc.Blocks.Head.Hash.GetAsync();// get account's counter
var counter = await rpc.Blocks.Head.Context.Contracts[address].Counter.GetAsync();
````### Forge an operation
Since our address has just been created, we need to reveal its public key before sending any operation, so that everyone can validate our signatures.
Therefore, we need to send actually two operations: a reveal and then a transaction.Netezos allows you to pack multiple operations into a group and forge/send it as a single batch.
````cs
var content = new ManagerOperationContent[]
{
new RevealContent
{
Source = address,
Counter = ++counter,
PublicKey = key.PubKey.GetBase58(),
GasLimit = 1500,
Fee = 1000 // 0.001 tez
},
new TransactionContent
{
Source = address,
Counter = ++counter,
Amount = 1000000, // 1 tez
Destination = "tz1KhnTgwoRRALBX6vRHRnydDGSBFsWtcJxc",
GasLimit = 1500,
Fee = 1000 // 0.001 tez
}
};var bytes = await new LocalForge().ForgeOperationGroupAsync(head, content);
````### Sign and send
````cs
// sign the operation bytes
byte[] signature = key.SignOperation(bytes);// inject the operation and get its id (operation hash)
var result = await rpc.Inject.Operation.PostAsync(bytes.Concat(signature));
````That is it. We have successfully injected our first operation into the Tezos blockchain.
## Useful links
- [Examples of Netezos usage](https://baking-bad.org/blog/2019/11/14/tezos-c-sdk-examples-of-netezos-usage/)
- [Forge an operation locally and sign it using Ledger](https://baking-bad.org/blog/2019/12/30/tezos-c-sdk-netezos-forge-an-operation-locally-and-sign-it-using-ledger-wallet/)