NArk.Core 1.0.82-beta

This is a prerelease version of NArk.Core.
dotnet add package NArk.Core --version 1.0.82-beta
                    
NuGet\Install-Package NArk.Core -Version 1.0.82-beta
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NArk.Core" Version="1.0.82-beta" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NArk.Core" Version="1.0.82-beta" />
                    
Directory.Packages.props
<PackageReference Include="NArk.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NArk.Core --version 1.0.82-beta
                    
#r "nuget: NArk.Core, 1.0.82-beta"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NArk.Core@1.0.82-beta
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NArk.Core&version=1.0.82-beta&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=NArk.Core&version=1.0.82-beta&prerelease
                    
Install as a Cake Tool

NArk .NET SDK

A .NET SDK for building applications on the Ark protocol — a Bitcoin layer-2 that enables instant, low-cost off-chain transactions using virtual UTXOs (VTXOs).

NuGet License: MIT

Packages

Package Description
NArk.Abstractions Interfaces and domain types (IVtxoStorage, IContractStorage, IWalletProvider, ArkCoin, ArkVtxo, etc.)
NArk.Core Core services: spending, batch management, VTXO sync, sweeping, wallet infrastructure, gRPC transport
NArk.Swaps Boltz swap integration for BTC-to-Ark and Ark-to-BTC chain/submarine swaps
NArk.Storage.EfCore Entity Framework Core storage implementations (provider-agnostic — works with PostgreSQL, SQLite, etc.)
NArk Meta-package that pulls in NArk.Core + NArk.Swaps

Quick Start

Install

dotnet add package NArk                    # Core + Swaps
dotnet add package NArk.Storage.EfCore     # EF Core persistence

Minimal Setup with Generic Host

using NArk.Hosting;
using NArk.Core.Wallet;
using NArk.Storage.EfCore;
using NArk.Storage.EfCore.Hosting;

var builder = Host.CreateDefaultBuilder(args)
    .AddArk()
    .WithVtxoStorage<EfCoreVtxoStorage>()
    .WithContractStorage<EfCoreContractStorage>()
    .WithIntentStorage<EfCoreIntentStorage>()
    .WithWalletProvider<DefaultWalletProvider>()
    .WithSafetyService<YourSafetyService>()
    .WithTimeProvider<YourChainTimeProvider>()
    .OnMainnet()
    .EnableSwaps();

// Register your DbContext and EF Core storage
builder.ConfigureServices((_, services) =>
{
    services.AddDbContextFactory<YourDbContext>(opts =>
        opts.UseNpgsql(connectionString));

    services.AddArkEfCoreStorage<YourDbContext>();
});

var app = builder.Build();
await app.RunAsync();

Setup with IServiceCollection (plugin/non-host scenarios)

using NArk.Hosting;
using NArk.Core.Wallet;
using NArk.Storage.EfCore.Hosting;

services.AddArkCoreServices();
services.AddArkNetwork(ArkNetworkConfig.Mainnet);
services.AddArkSwapServices();

services.AddDbContextFactory<YourDbContext>(opts =>
    opts.UseNpgsql(connectionString));

services.AddArkEfCoreStorage<YourDbContext>();

// Register remaining required services
services.AddSingleton<IWalletProvider, DefaultWalletProvider>();
services.AddSingleton<ISafetyService, YourSafetyService>();
services.AddSingleton<IChainTimeProvider, YourChainTimeProvider>();

Architecture

NArk (meta-package)
 ├── NArk.Core
 │    ├── Services (spending, batches, VTXO sync, sweeping, intents)
 │    ├── Wallet (WalletFactory, signers, address providers)
 │    ├── Hosting (DI extensions, ArkApplicationBuilder)
 │    └── Transport (gRPC client for Ark server communication)
 │
 ├── NArk.Swaps
 │    ├── Boltz client (submarine & chain swaps)
 │    └── Swap management service
 │
 └── NArk.Abstractions
      ├── Domain types (ArkCoin, ArkVtxo, ArkContract, ArkAddress, etc.)
      ├── Storage interfaces (IVtxoStorage, IContractStorage, IIntentStorage)
      └── Wallet interfaces (IWalletProvider, IArkadeWalletSigner)

NArk.Storage.EfCore (optional, provider-agnostic persistence)
 ├── EF Core entity mappings
 ├── Storage implementations
 └── DI extension: AddArkEfCoreStorage<TDbContext>()

Wallet Management

The SDK supports two wallet types:

HD Wallets — BIP-39 mnemonic with BIP-86 taproot derivation (m/86'/cointype'/0'):

var serverInfo = await transport.GetServerInfoAsync();
var wallet = await WalletFactory.CreateWallet(
    "abandon abandon abandon ... about",  // BIP-39 mnemonic
    destination: null,
    serverInfo);
// wallet.WalletType == WalletType.HD

Single-Key Wallets — nostr nsec format (Bech32-encoded secp256k1 key):

var wallet = await WalletFactory.CreateWallet(
    "nsec1...",
    destination: null,
    serverInfo);
// wallet.WalletType == WalletType.SingleKey

Save and load wallets through IWalletStorage:

await walletStorage.SaveWallet(wallet);
var loaded = await walletStorage.LoadWallet(wallet.Id);
var all = await walletStorage.LoadAllWallets();

Spending

Use ISpendingService to send Ark transactions:

// Automatic coin selection
var txId = await spendingService.Spend(
    walletId,
    outputs: [new ArkTxOut(recipientAddress, Money.Satoshis(10_000))]);

// Manual coin selection
var coins = await spendingService.GetAvailableCoins(walletId);
var txId = await spendingService.Spend(
    walletId,
    inputs: coins.Take(2).ToArray(),
    outputs: [new ArkTxOut(recipientAddress, Money.Satoshis(5_000))]);

Collaborative Exits (On-chain)

Move funds from Ark back to the Bitcoin base layer:

var btcTxId = await onchainService.InitiateCollaborativeExit(
    walletId,
    new ArkTxOut(bitcoinAddress, Money.Satoshis(50_000)));

Contracts

Derive receiving addresses and manage contracts:

// Derive a new receive contract (generates a new Ark address)
var contract = await contractService.DeriveContract(
    walletId,
    NextContractPurpose.Receive);

// The contract's script can be converted to an ArkAddress for display

EF Core Storage

NArk.Storage.EfCore provides ready-made storage implementations. It is provider-agnostic — no dependency on Npgsql or any specific database driver.

DbContext Setup

In your DbContext.OnModelCreating, call ConfigureArkEntities:

public class MyDbContext : DbContext
{
    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.ConfigureArkEntities(opts =>
        {
            opts.Schema = "ark";           // default
            // opts.WalletsTable = "Wallets";   // all table names configurable
        });
    }
}

Storage Options

ArkStorageOptions controls schema, table names, and provider-specific behavior:

services.AddArkEfCoreStorage<MyDbContext>(opts =>
{
    opts.Schema = "my_schema";

    // PostgreSQL-specific text search on contract metadata
    opts.ContractSearchProvider = (query, searchText) =>
        query.Where(c => EF.Functions.ILike(c.Metadata, $"%{searchText}%"));
});

Entities

Entity Table Primary Key
ArkWalletEntity Wallets Id
ArkWalletContractEntity WalletContracts (Script, WalletId)
VtxoEntity Vtxos (TransactionId, TransactionOutputIndex)
ArkIntentEntity Intents IntentTxId
ArkIntentVtxoEntity IntentVtxos (IntentTxId, VtxoTransactionId, VtxoTransactionOutputIndex)
ArkSwapEntity Swaps (SwapId, WalletId)

Networks

Pre-configured network environments:

// Fluent builder
builder.AddArk().OnMainnet();
builder.AddArk().OnMutinynet();
builder.AddArk().OnRegtest();
builder.AddArk().OnCustomGrpcArk("http://my-ark-server:7070");

// IServiceCollection
services.AddArkNetwork(ArkNetworkConfig.Mainnet);
services.AddArkNetwork(new ArkNetworkConfig(
    ArkUri: "http://my-ark-server:7070",
    BoltzUri: "http://my-boltz:9069/"));

Swaps (Boltz Integration)

Enable Bitcoin ↔ Ark swaps through Boltz:

// Fluent builder
builder.AddArk()
    .EnableSwaps()
    // or with custom Boltz URL:
    .OnCustomBoltz("https://api.boltz.exchange", websocketUrl: null);

// IServiceCollection
services.AddArkSwapServices();
services.AddHttpClient<BoltzClient>();

The SwapsManagementService handles swap lifecycle automatically — monitoring status, cooperative claim signing, and VHTLC management.

Extensibility Points

The SDK uses a pluggable architecture. Register your implementations for:

Interface Purpose Default
IVtxoStorage VTXO persistence EfCoreVtxoStorage
IContractStorage Contract persistence EfCoreContractStorage
IIntentStorage Intent persistence EfCoreIntentStorage
ISwapStorage Swap persistence EfCoreSwapStorage
IWalletStorage Wallet persistence EfCoreWalletStorage
IWalletProvider Wallet signer/address resolution DefaultWalletProvider
ISafetyService Distributed locking Must implement
IChainTimeProvider Current blockchain height/time Must implement
IFeeEstimator Transaction fee estimation DefaultFeeEstimator
ICoinSelector UTXO selection strategy DefaultCoinSelector
ISweepPolicy VTXO consolidation rules Register zero or more
IContractTransformer Custom contract → coin transforms Register zero or more
IEventHandler<T> React to batch/sweep/spend events Register zero or more

Local Development

The SDK uses .NET Aspire for local orchestration with Docker containers (arkd, Bitcoin Core, Boltz, etc.):

cd NArk.AppHost
dotnet run

Running Tests

# Unit tests
dotnet test NArk.Tests

# End-to-end tests (requires Docker)
dotnet test NArk.Tests.End2End

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on NArk.Core:

Package Downloads
NArk

Meta-package for the Ark protocol .NET SDK. Pulls in NArk.Core (spending, batches, VTXO sync, wallets) and NArk.Swaps (Boltz integration).

NArk.Swaps

Boltz swap integration for the Ark protocol .NET SDK. Enables BTC-to-Ark and Ark-to-BTC submarine and chain swaps.

NArk.Transport.GrpcClient

Package Description

NArk.Hosting

Package Description

NArk.Storage.EfCore

Entity Framework Core storage implementations for the Ark protocol .NET SDK. Provider-agnostic persistence for VTXOs, contracts, intents, swaps, and wallets.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.82-beta 26 2/19/2026
1.0.80-beta 29 2/18/2026
1.0.55-beta 41 2/13/2026
1.0.54-beta 48 2/13/2026
1.0.53-beta 41 2/13/2026
1.0.52-beta 44 2/12/2026
1.0.51-beta 40 2/11/2026
1.0.50-beta 43 2/10/2026
1.0.45-beta 48 2/9/2026
1.0.44-beta 39 2/8/2026
1.0.40-beta 43 2/8/2026
1.0.39-beta 42 2/8/2026
1.0.38-beta 39 2/8/2026
1.0.36-beta 47 2/8/2026
1.0.34-beta 45 2/8/2026
1.0.32-beta 52 2/8/2026
1.0.22-beta 47 1/30/2026
1.0.13-beta 55 1/28/2026
1.0.12-beta 46 1/27/2026
1.0.11-beta 45 1/27/2026
Loading failed