Skip to content

Blockfrost.NET Reference

Alexander Klee edited this page Aug 29, 2021 · 10 revisions

API Reference: blockfrost/openapi

Current Version: v0.1.26

Common

Root

/
Resource Method Service Method Parameters
/ GET GetRootAsync none

Health

Type

Interfaces

A
namespace Blockfrost.Api.Services.{GroupName]
{
    public partial interface I{SingularTagName}Service 
    {
      // ...
    }
}
B
namespace Blockfrost.Api.Services.{GroupName].{TagName}
{
    public partial interface IBlockfrostApiService : I{SingularTagName]Service
    {
      // ...
    }
}

Usage

Register

Extension Method

Resolve

A
using Blockfrost.Api.Services.{GroupName};

private IServiceProvider _provider;

var service = proider.GetRequiredService<I{SingularName}Service>();
B
using Blockfrost.Api.Services.{GroupName}.{TagName};

private IServiceCollection _serviceCollection;
private IServiceProvider _serviceProvider;

var service = proider.GetRequiredService<IBlockfrostApiService>();
/health
/health/clock
/metrics/
/metrics/endpoints
/network

Cardano

Blocks

Type

Interfaces

A
namespace Blockfrost.Api.Services.{GroupName]
{
    public partial interface I{SingularTagName}Service 
    {
      // ...
    }
}
B
namespace Blockfrost.Api.Services.{GroupName].{TagName}
{
    public partial interface IBlockfrostApiService : I{SingularTagName]Service
    {
      // ...
    }
}

Usage

Register

Extension Method

Resolve

A
using Blockfrost.Api.Services.{GroupName};

private IServiceProvider _provider;

var service = proider.GetRequiredService<I{SingularName}Service>();
B
using Blockfrost.Api.Services.{GroupName}.{TagName};

private IServiceCollection _serviceCollection;
private IServiceProvider _serviceProvider;

var service = proider.GetRequiredService<IBlockfrostApiService>();
/blocks/latest
/blocks/latest/txs
/blocks/{hash_or_number}
/blocks/slot/{slot_number}
/blocks/epoch/{epoch_number}/slot/{slot_number}
/blocks/{hash_or_number}/next
/blocks/{hash_or_number}/previous
/blocks/{hash_or_number}/txs

Network

Type

Interfaces

A
namespace Blockfrost.Api.Services.{GroupName]
{
    public partial interface I{SingularTagName}Service 
    {
      // ...
    }
}
B
namespace Blockfrost.Api.Services.{GroupName].{TagName}
{
    public partial interface IBlockfrostApiService : I{SingularTagName]Service
    {
      // ...
    }
}

Usage

Register

Extension Method

Resolve

A
using Blockfrost.Api.Services.{GroupName};

private IServiceProvider _provider;

var service = proider.GetRequiredService<I{SingularName}Service>();
B
using Blockfrost.Api.Services.{GroupName}.{TagName};

private IServiceCollection _serviceCollection;
private IServiceProvider _serviceProvider;

var service = proider.GetRequiredService<IBlockfrostApiService>();
/genesis

Epochs

Type

Interfaces

A
namespace Blockfrost.Api.Services.{GroupName]
{
    public partial interface I{SingularTagName}Service 
    {
      // ...
    }
}
B
namespace Blockfrost.Api.Services.{GroupName].{TagName}
{
    public partial interface IBlockfrostApiService : I{SingularTagName]Service
    {
      // ...
    }
}

Usage

Register

Extension Method

Resolve

A
using Blockfrost.Api.Services.{GroupName};

private IServiceProvider _provider;

var service = proider.GetRequiredService<I{SingularName}Service>();
B
using Blockfrost.Api.Services.{GroupName}.{TagName};

private IServiceCollection _serviceCollection;
private IServiceProvider _serviceProvider;

var service = proider.GetRequiredService<IBlockfrostApiService>();
/epochs/latest
/epochs/latest/parameters
/epochs/{number}
/epochs/{number}/next
/epochs/{number}/previous
/epochs/{number}/stakes
/epochs/{number}/stakes/{pool_id}
/epochs/{number}/blocks
/epochs/{number}/blocks/{pool_id}
/epochs/{number}/parameters

Transactions

Type

Interfaces

A
namespace Blockfrost.Api.Services.{GroupName]
{
    public partial interface I{SingularTagName}Service 
    {
      // ...
    }
}
B
namespace Blockfrost.Api.Services.{GroupName].{TagName}
{
    public partial interface IBlockfrostApiService : I{SingularTagName]Service
    {
      // ...
    }
}

Usage

Register

Extension Method

Resolve

A
using Blockfrost.Api.Services.{GroupName};

private IServiceProvider _provider;

var service = proider.GetRequiredService<I{SingularName}Service>();
B
using Blockfrost.Api.Services.{GroupName}.{TagName};

private IServiceCollection _serviceCollection;
private IServiceProvider _serviceProvider;

var service = proider.GetRequiredService<IBlockfrostApiService>();
/txs/{hash}
/txs/{hash}/utxos
/txs/{hash}/stakes
/txs/{hash}/delegations
/txs/{hash}/withdrawals
/txs/{hash}/mirs
/txs/{hash}/pool_updates
/txs/{hash}/pool_retires
/txs/{hash}/metadata
/txs/{hash}/metadata/cbor
/tx/submit

Accounts

Type

Interfaces

A
namespace Blockfrost.Api.Services.{GroupName]
{
    public partial interface I{SingularTagName}Service 
    {
      // ...
    }
}
B
namespace Blockfrost.Api.Services.{GroupName].{TagName}
{
    public partial interface IBlockfrostApiService : I{SingularTagName]Service
    {
      // ...
    }
}

Usage

Register

Extension Method

Resolve

A
using Blockfrost.Api.Services.{GroupName};

private IServiceProvider _provider;

var service = proider.GetRequiredService<I{SingularName}Service>();
B
using Blockfrost.Api.Services.{GroupName}.{TagName};

private IServiceCollection _serviceCollection;
private IServiceProvider _serviceProvider;

var service = proider.GetRequiredService<IBlockfrostApiService>();
/accounts/{stake_address}
/accounts/{stake_address}/rewards
/accounts/{stake_address}/history
/accounts/{stake_address}/delegations
/accounts/{stake_address}/registrations
/accounts/{stake_address}/withdrawals
/accounts/{stake_address}/mirs
/accounts/{stake_address}/addresses
/accounts/{stake_address}/addresses/assets

Metadata

Type

Interfaces

A
namespace Blockfrost.Api.Services.{GroupName]
{
    public partial interface I{SingularTagName}Service 
    {
      // ...
    }
}
B
namespace Blockfrost.Api.Services.{GroupName].{TagName}
{
    public partial interface IBlockfrostApiService : I{SingularTagName]Service
    {
      // ...
    }
}

Usage

Register

Extension Method

Resolve

A
using Blockfrost.Api.Services.{GroupName};

private IServiceProvider _provider;

var service = proider.GetRequiredService<I{SingularName}Service>();
B
using Blockfrost.Api.Services.{GroupName}.{TagName};

private IServiceCollection _serviceCollection;
private IServiceProvider _serviceProvider;

var service = proider.GetRequiredService<IBlockfrostApiService>();

Paths

/metadata/txs/labels
/metadata/txs/labels/{label}
/metadata/txs/labels/{label}/cbor

Addresses

Type

Interfaces

A
namespace Blockfrost.Api.Services.{GroupName]
{
    public partial interface I{SingularTagName}Service 
    {
      // ...
    }
}
B
namespace Blockfrost.Api.Services.{GroupName].{TagName}
{
    public partial interface IBlockfrostApiService : I{SingularTagName]Service
    {
      // ...
    }
}

Usage

Register

Extension Method

Resolve

A
using Blockfrost.Api.Services.{GroupName};

private IServiceProvider _provider;

var service = proider.GetRequiredService<I{SingularName}Service>();
B
using Blockfrost.Api.Services.{GroupName}.{TagName};

private IServiceCollection _serviceCollection;
private IServiceProvider _serviceProvider;

var service = proider.GetRequiredService<IBlockfrostApiService>();

Paths

/addresses/{address}
/addresses/{address}/total
/addresses/{address}/utxos
/addresses/{address}/txs
/addresses/{address}/transactions

Pools

Type

Interfaces

A
namespace Blockfrost.Api.Services.{GroupName]
{
    public partial interface I{SingularTagName}Service 
    {
      // ...
    }
}
B
namespace Blockfrost.Api.Services.{GroupName].{TagName}
{
    public partial interface IBlockfrostApiService : I{SingularTagName]Service
    {
      // ...
    }
}

Usage

Register

Extension Method

Resolve

A
using Blockfrost.Api.Services.{GroupName};

private IServiceProvider _provider;

var service = proider.GetRequiredService<I{SingularName}Service>();
B
using Blockfrost.Api.Services.{GroupName}.{TagName};

private IServiceCollection _serviceCollection;
private IServiceProvider _serviceProvider;

var service = proider.GetRequiredService<IBlockfrostApiService>();
/pools
/pools/retired
/pools/retiring
/pools/{pool_id}
/pools/{pool_id}/history
/pools/{pool_id}/metadata
/pools/{pool_id}/relays
/pools/{pool_id}/delegators
/pools/{pool_id}/blocks
/pools/{pool_id}/updates

Assets

Type

Interfaces

A
namespace Blockfrost.Api.Services.{GroupName]
{
    public partial interface I{SingularTagName}Service 
    {
      // ...
    }
}
B
namespace Blockfrost.Api.Services.{GroupName].{TagName}
{
    public partial interface IBlockfrostApiService : I{SingularTagName]Service
    {
      // ...
    }
}

Usage

Register

Extension Method

Resolve

A
using Blockfrost.Api.Services.{GroupName};

private IServiceProvider _provider;

var service = proider.GetRequiredService<I{SingularName}Service>();
B
using Blockfrost.Api.Services.{GroupName}.{TagName};

private IServiceCollection _serviceCollection;
private IServiceProvider _serviceProvider;

var service = proider.GetRequiredService<IBlockfrostApiService>();
/assets
/assets/{asset}
/assets/{asset}/history
/assets/{asset}/txs
/assets/{asset}/transactions
/assets/{asset}/addresses
/assets/policy/{policy_id}

IPFS

/ipfs/add
/ipfs/gateway/{IPFS_path}
/ipfs/pin/add/{IPFS_path}
/ipfs/pin/list/
/ipfs/pin/list/{IPFS_path}
/ipfs/pin/remove/{IPFS_path}

Nutlink

/nutlink/{address}
/nutlink/{address}/tickers
/nutlink/{address}/tickers/{ticker}
/nutlink/tickers/{ticker}

Appendix A: All Paths

/
/health
/health/clock
/blocks/latest
/blocks/latest/txs
/blocks/{hash_or_number}
/blocks/slot/{slot_number}
/blocks/epoch/{epoch_number}/slot/{slot_number}
/blocks/{hash_or_number}/next
/blocks/{hash_or_number}/previous
/blocks/{hash_or_number}/txs
/genesis
/epochs/latest
/epochs/latest/parameters
/epochs/{number}
/epochs/{number}/next
/epochs/{number}/previous
/epochs/{number}/stakes
/epochs/{number}/stakes/{pool_id}
/epochs/{number}/blocks
/epochs/{number}/blocks/{pool_id}
/epochs/{number}/parameters
/txs/{hash}
/txs/{hash}/utxos
/txs/{hash}/stakes
/txs/{hash}/delegations
/txs/{hash}/withdrawals
/txs/{hash}/mirs
/txs/{hash}/pool_updates
/txs/{hash}/pool_retires
/txs/{hash}/metadata
/txs/{hash}/metadata/cbor
/tx/submit
/accounts/{stake_address}
/accounts/{stake_address}/rewards
/accounts/{stake_address}/history
/accounts/{stake_address}/delegations
/accounts/{stake_address}/registrations
/accounts/{stake_address}/withdrawals
/accounts/{stake_address}/mirs
/accounts/{stake_address}/addresses
/accounts/{stake_address}/addresses/assets
/metadata/txs/labels
/metadata/txs/labels/{label}
/metadata/txs/labels/{label}/cbor
/addresses/{address}
/addresses/{address}/total
/addresses/{address}/utxos
/addresses/{address}/txs
/addresses/{address}/transactions
/pools
/pools/retired
/pools/retiring
/pools/{pool_id}
/pools/{pool_id}/history
/pools/{pool_id}/metadata
/pools/{pool_id}/relays
/pools/{pool_id}/delegators
/pools/{pool_id}/blocks
/pools/{pool_id}/updates
/assets
/assets/{asset}
/assets/{asset}/history
/assets/{asset}/txs
/assets/{asset}/transactions
/assets/{asset}/addresses
/assets/policy/{policy_id}
/ipfs/add
/ipfs/gateway/{IPFS_path}
/ipfs/pin/add/{IPFS_path}
/ipfs/pin/list/
/ipfs/pin/list/{IPFS_path}
/ipfs/pin/remove/{IPFS_path}
/metrics/
/metrics/endpoints
/network
/nutlink/{address}
/nutlink/{address}/tickers
/nutlink/{address}/tickers/{ticker}
/nutlink/tickers/{ticker}

Appendix B: Block distribution route

paths:
  /epochs/{number}/blocks/{pool_id}:
    get:
      tags:
        - Cardano » Epochs
      summary: Block distribution
      description: Return the block minted for the epoch specified by stake pool.
      parameters:
        - in: path
          name: number
          required: true
          schema:
            type: integer
          description: Number of the epoch
          example: 225
        - in: path
          required: true
          name: pool_id
          schema:
            type: string
          description: Stake pool ID to filter
          example: "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy"
        - in: query
          name: count
          required: false
          schema:
            type: integer
            maximum: 100
            default: 100
          description: The number of results displayed on one page.
        - in: query
          name: page
          required: false
          schema:
            type: integer
            default: 1
          description: The page number for listing the results.
        - in: query
          name: order
          required: false
          schema:
            type: string
            enum: [asc, desc]
            default: asc
          description: |
            The ordering of items from the point of view of the blockchain,
            not the page listing itself. By default, we return oldest first, newest last.
      responses:
        "200":
          description: Return the data about the epoch
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/epoch_block_content"
        "400":
          $ref: "#/components/responses/bad_request"
        "403":
          $ref: "#/components/responses/unauthorized_error"
        "404":
          $ref: "#/components/responses/not_found"
        "429":
          $ref: "#/components/responses/overusage_limit"
        "418":
          $ref: "#/components/responses/autobanned"
        "500":
          $ref: "#/components/responses/internal_server_error"

Appendix C: Conventions

Deriving template identifiers

We can derive template identifiers for each path in the openapi spec:

Appendix B shows the Block distribution endpoint of the epochs resource. It has the following route template:

  • GET /epochs/{number}/blocks/{pool_id}?count={count}&page={page}&order={order}

| Identifier | Value | Formula | | {{ ResourceName }} | epochs | - | | {{ HttpMethod }} | Get | CAMEL_CASE ( {{ ResourceName }} ) | | {{ ServiceName }} | Epoch | CAMEL_CASE ( SINGULAR ( {{ ResourceName }} ) ) | | {{ #parameters }} | [number, pool_id, count, page, order] |

The #parameters define the API of the Service:

| Identifier | Value | Formula | | {{ #parameters[0] }} | number | |

namespace Blockfrost.Api.Services.{{ServiceGroup}}
{ 
    public interface I{{ServiceName}}
    {
        // for routes like 
        public Task {{HttpMethod}}{{SingularBlock}}Async
    }
}

Starging from v1.0.0 the naming of service methods will be of the following form:

namespace Blockfrost.Api.Services.[ServiceGroup].[ServiceName]

Lets look at the Block distribution endpoint