Skip to main content

URN Resolution

💜 Support the DIG Network

Overview​

The DIG Network uses URNs (RFC 8141) for permanent, location-independent resource identification per DIP-0001.

URN Specification​

Format:

urn:dig:chia:{storeID}:{optional roothash}/{optional resource key}

Components:

  • urn - Scheme identifier (case insensitive)
  • dig - DIG namespace (case insensitive)
  • chia - Chain name (case sensitive)
  • storeID - DataStore identifier (case sensitive)
  • roothash - Merkle root of version (optional, case sensitive)
  • resource key - Path to resource (optional, case sensitive)

Examples:

# Latest version of DataStore
urn:dig:chia:17f89f9af15a046431342694fd2c6df41be8736287e97f6af8327945e59054fb

# Specific resource
urn:dig:chia:17f89f9af15a046431342694fd2c6df41be8736287e97f6af8327945e59054fb/css/app.css

# Version-pinned DataStore
urn:dig:chia:17f89f9af15a046431342694fd2c6df41be8736287e97f6af8327945e59054fb:35cccf5cba6e3ee2dcf237b4b8a47c64e89cf733a95c6f5e9ac7062734c22b81

# Version-pinned resource
urn:dig:chia:17f89f9af15a046431342694fd2c6df41be8736287e97f6af8327945e59054fb:35cccf5cba6e3ee2dcf237b4b8a47c64e89cf733a95c6f5e9ac7062734c22b81/css/app.css

Resolution Methods​

1. Native Network Resolution​

URN → Query DIG Network → Discover PlotCoins → Retrieve capsules → Reconstruct content

2. Web2 Gateway Resolution​

https://dig.kackman.net/urn:dig:chia:abc123.../index.html
http://urn.fi/urn:dig:chia:abc123.../index.html

3. DIG Handle Resolution​

my-awesome-app.dig → urn:dig:chia:17f89f...54fb
my-awesome-app.dig/api/v1/data → urn:dig:chia:17f89f...54fb/api/v1/data

Resolution Algorithm​

def resolve_dig_handle(handle):
# 1. Extract and validate handle
domain_name = extract_domain_name(handle)

# 2. Query blockchain for DataStore
handle_record = query_chia_blockchain(domain_name)
datastore_id = handle_record.associated_datastore

# 3. Get DataStore metadata
datastore = get_datastore(datastore_id)
capsule_manifest = datastore.capsule_manifest

# 4. Discover providers for each capsule
providers = {}
for capsule_id in capsule_manifest:
plotcoins = query_plotcoins(capsule_id)
providers[capsule_id] = filter_active_providers(plotcoins)

# 5. Optimize provider selection
selected = optimize_provider_selection(providers)

# 6. Parallel retrieval
capsule_data = await_all([
download_capsule(selected[capsule_id], capsule_id)
for capsule_id in capsule_manifest
])

# 7. Verify integrity and reconstruct
return reconstruct_content(capsule_data, datastore.metadata)

Provider Selection​

The system optimizes provider selection based on:

  • Geographic proximity: Lower latency
  • Performance metrics: Response time, availability
  • Economic incentives: Bribe amounts
  • Load balancing: Distribute requests

Developer Integration​

SDK Example​

import { DIGResolver } from '@dig-network/sdk';

const resolver = new DIGResolver();

// Simple resolution
const content = await resolver.resolve('my-app.dig');

// URN resolution
const data = await resolver.resolveURN(
'urn:dig:chia:17f89f...54fb/data.json'
);

// Advanced options
const result = await resolver.resolve('my-app.dig', {
preferredProviders: ['provider1', 'provider2'],
cachePolicy: 'network-first',
integrityCheck: true,
timeout: 30000
});

Summary​

The DIG Network's URN-based resolution system provides permanent, decentralized content addressing that works seamlessly with human-readable handles, enabling efficient content discovery across the distributed storage network.