{"id":22437046,"url":"https://github.com/blockfrost/blockfrost-dotnet","last_synced_at":"2025-08-01T15:31:59.502Z","repository":{"id":46554214,"uuid":"390634420","full_name":"blockfrost/blockfrost-dotnet","owner":"blockfrost","description":".NET, C# and PowerShell SDK for Blockfrost.io API","archived":false,"fork":false,"pushed_at":"2022-12-23T14:36:43.000Z","size":1333,"stargazers_count":18,"open_issues_count":10,"forks_count":9,"subscribers_count":4,"default_branch":"staging","last_synced_at":"2025-07-29T06:24:05.086Z","etag":null,"topics":["blockfrost","cardano","csharp","dotnet","ipfs","sdk"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blockfrost.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-29T07:09:42.000Z","updated_at":"2025-07-12T20:12:32.000Z","dependencies_parsed_at":"2023-01-30T18:46:05.561Z","dependency_job_id":null,"html_url":"https://github.com/blockfrost/blockfrost-dotnet","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/blockfrost/blockfrost-dotnet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockfrost%2Fblockfrost-dotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockfrost%2Fblockfrost-dotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockfrost%2Fblockfrost-dotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockfrost%2Fblockfrost-dotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blockfrost","download_url":"https://codeload.github.com/blockfrost/blockfrost-dotnet/tar.gz/refs/heads/staging","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockfrost%2Fblockfrost-dotnet/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268250647,"owners_count":24219893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockfrost","cardano","csharp","dotnet","ipfs","sdk"],"created_at":"2024-12-06T00:11:27.039Z","updated_at":"2025-08-01T15:31:58.923Z","avatar_url":"https://github.com/blockfrost.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![.NET](https://github.com/blockfrost/blockfrost-dotnet/actions/workflows/dotnet.yml/badge.svg?branch=master)](https://github.com/blockfrost/blockfrost-dotnet/actions/workflows/dotnet.yml)\n\u003cbr/\u003e\n\n\u003cimg src=\"https://blockfrost.io/images/logo.svg\" width=\"250\" align=\"right\" height=\"90\"\u003e\n\n# blockfrost-dotnet\n\n\u003cbr/\u003e\n\n\u003cp align=\"center\"\u003e.NET SDK for Blockfrost.io API.\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#getting-started\"\u003eGetting started\u003c/a\u003e •\n  \u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e •\n  \u003ca href=\"#usage\"\u003eUsage\u003c/a\u003e\n\u003c/p\u003e\n\u003cbr\u003e\n\n## Getting started\n\nTo use this SDK, first go to [blockfrost.io](https://blockfrost.io) and create your project to retrive your API token.\n\n\u003cimg src=\"https://i.imgur.com/smY12ro.png\"\u003e\n\n\u003cbr/\u003e\n\n### Setup environment\n\n`blocfrost-dotnet` supports the following environment variables.\n\n```ps\n$\u003e $env:BFCLI_NETWORK\ntestnet\n\n$\u003e $env:BFCLI_API_KEY\nyourawesomeapikeyforblockfrostio\n```\n\n\u003e Make sure you have configured them if you add `blockfrost-dotnet` using `services.AddBlockfrost();`\n\u003e\n\u003e There are other extension methods to configure `blockfrost-dotnet` where the environment variables are not required. One of them is shown in the sample below.\n\n### Setup\n\nThe SDK is hosted on [nuget.org](https://www.nuget.org/packages/Blockfrost.Api/latest), so you can directly import it using your favorite package manager.\n\n```sh\n$\u003e dotnet new console -n blockfrost-client\n$\u003e cd blockfrost-client\n$\u003e dotnet add package Blockfrost.Api\n$\u003e dotnet add package Blockfrost.Extensions\n```\n\n### Usage\n\nUsing the SDK is pretty straight-forward as you can see from the following example.\n\n#### Cardano Services\n\n```cs\nusing System.IO;\nusing Blockfrost.Api.Extensions;\nusing Blockfrost.Api.Models.Extensions;\nusing Blockfrost.Api.Services;\nusing Blockfrost.Api.Services.Extensions;\nusing Microsoft.Extensions.DependencyInjection;\n\n/*\n * Parameters\n */\nstring apiKey = \"YOUR_BLOCKFROST_PROJECT_ID\";\nstring network = \"NETWORK_OF_THE_PROJECT_ID\";\nstring sender_address = \"SENDER_ADDR\";\nstring receiver_address = \"RECEIVER_ADDR\";\nstring signedTx = File.ReadAllText(\"path/to/your/signed/transaction\");\n\n/*\n * Init Services using apiKey and network\n */\nvar cardano = new ServiceCollection()\n    .AddBlockfrost(network, apiKey)\n    .BuildServiceProvider()\n    .GetRequiredService\u003cICardanoService\u003e();\n\n/*\n * Show metrics for your account\n */\nvar metrics = await cardano.Metrics.GetMetricsAsync();\nvar opt = new System.Text.Json.JsonSerializerOptions() { WriteIndented = true };\nSystem.Console.WriteLine($\"Metrics: {metrics.ToJson(opt)}\");\n\n/*\n * Show sender UTxO\n */\nvar utxoSender = await cardano.Addresses.GetUtxosAsync(sender_address);\nlong totalSender = utxoSender.SumAmounts(\"lovelace\");\nSystem.Console.WriteLine($\"Sender Total: {totalSender} lovelace\");\n\n/*\n * Sum receiver UTxO\n */\nvar utxoReceiver = await cardano.Addresses.GetUtxosAsync(receiver_address);\nlong totalReceiver = utxoReceiver.SumAmounts(\"lovelace\");\nSystem.Console.WriteLine($\"Receiver Total: {totalReceiver} lovelace\");\n\n/*\n * Query tip\n */\nvar tip = await cardano.Blocks.GetLatestAsync();\nlong? latestSlot = tip.Slot;\n\nSystem.Console.WriteLine($\"Tip now at Epoch {tip.Epoch} Slot {tip.Slot} Block {tip.Height}\");\n\n/*\n * Send submit tx\n */\nSystem.Console.WriteLine(signedTx);\nstring txid = await cardano.Transactions.PostTxSubmitAsync(signedTx);\n\nSystem.Console.WriteLine($\"Your Transaction was transmitted to the {network}\");\nSystem.Console.WriteLine($\"https://explorer.cardano-{network}.iohkdev.io/en/transaction?id={txid}\");\n\n/*\n * Wait two blocks\n */\ntip = await cardano.Blocks.WaitAsync(\n    count: 2,\n    interval: System.TimeSpan.FromSeconds(5),\n    callback: latest =\u003e System.Console.WriteLine(latest.Slot),\n    cancellationToken: System.Threading.CancellationToken.None\n);\nSystem.Console.WriteLine($\"Tip now at Epoch {tip.Epoch} Slot {tip.Slot} Block {tip.Height}\");\n```\n\n### Run the sample\n\n```sh\n$ dotnet run\nMetrics: [\n  {\n    \"time\": 1631750400,\n    \"calls\": 3\n  },\n  ...\n]\nSender Total: 988258310 lovelace\nReceiver Total: 10000000 lovelace\nTip now at Epoch 160 Slot 38978334 Block 2965005\n\nYour Transaction was transmitted to the testnet\nhttps://explorer.cardano-testnet.iohkdev.io/en/transaction?id=2b1ca81b94c5dd737fe939444264046c6fbbe96ff403e49ee99e8022b0e512bb\nTip: 38978334\nTip: 38978334\nTip: 38978334\nTip: 38978334\nTip: 38978334\nTip now at Epoch 160 Slot 38978436 Block 2965007\n```\n\n\u003c!-- ### Command line tool\n\nBefore you install the command line tool, make sure the environment variables `BFCLI_API_KEY` and `BFCLI_NETWORK` exist.\n\n_Note: In DEV environment the api key is managed in Blockfrost.Cli secret store._\n\n```ps\n$\u003e $env:BFCLI_NETWORK\ntestnet\n\n$\u003e $env:BFCLI_API_KEY\nyourawesomeapikeyforblockfrostio\n```\n\n#### Install the command line tool (preview)\n\n```ps\n$\u003e pwd\n{$SolutionDir}\\src\\Blockfrost.Cli\n\n$\u003e dotnet tool install bfcli --add-source nupkg --version 0.3.0\nTool 'bfcli' (version '0.3.0') was successfully installed.\n\n$\u003e dotnet bfcli -v\nbfcli v0.3.0\nA .NET Cross Platform Tool / Console App for interacting with Blockfrost API.\n\nUSAGE: bfcli (OPTION | COMMAND)\n\nAvailable options:\n    -v, --version   Show the bfcli version\n    -h, --help      Show this help text\n\nAvailable commands:\n    health\n\n$\u003e dotnet bfcli health | ConvertFrom-Json\n\nis_healthy\n----------\n      True\n``` --\u003e\n\n\u003c!--\n\n### IPFS\n\n```cs\n// TODO\n```\n\nFor a more detailed list of possibilities, [check out the wiki](https://github.com/blockfrost/blockfrost-dotnet/wiki).\n\n--\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblockfrost%2Fblockfrost-dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblockfrost%2Fblockfrost-dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblockfrost%2Fblockfrost-dotnet/lists"}