Building a Custom Provider
Any storage system, blockchain, or distributed network can become an OASIS provider by implementing IOASISProvider and registering with the ONODE.
Step 1 — Create the Project
Create a new .NET class library targeting the same framework as your ONODE:
terminal
dotnet new classlib -n MyNetworkOASIS cd MyNetworkOASIS dotnet add reference ../NextGenSoftware.OASIS.API.Core/NextGenSoftware.OASIS.API.Core.csproj
Step 2 — Implement OASISStorageProviderBase
Extend OASISStorageProviderBase (which implements the boilerplate of IOASISProvider) and override the methods your backend supports:
csharp
public class MyNetworkOASIS : OASISStorageProviderBase, IOASISStorageProvider { public override EnumProviderType ProviderType => EnumProviderType.Custom; public override string ProviderName => "MyNetworkOASIS"; public override async Task<OASISResult<IAvatar>> SaveAvatarAsync(IAvatar avatar) { // write to your network / storage here var result = new OASISResult<IAvatar>(); try { var saved = await _myClient.WriteAsync(avatar); result.Result = saved; } catch (Exception ex) { OASISErrorHandling.HandleError(ref result, ex.Message); } return result; } // implement LoadAvatarAsync, DeleteAvatarAsync, SaveHolonAsync, etc. }
Step 3 — Register with the ONODE
In your ONODE's startup, register the provider before the kernel initialises:
csharp
OASISBootLoader.RegisterProvider(new MyNetworkOASIS(config));
Optional Capability Interfaces
| Interface | Adds capability |
|---|---|
INFTOASISProvider | NFT minting, transfer, query |
IGeoSpatialOASISProvider | GeoNFT and geospatial hotspot storage |
IOASISNETProvider | ONET P2P network participation |
IOASISBlockchainStorageProvider | On-chain data storage primitives |
IOASISSmartContractProvider | Smart contract deployment and interaction |
The kernel checks for these interfaces at runtime — you only need to implement what your backend supports.
Use an existing provider as a template
NextGenSoftware.OASIS.API.Providers.SQLiteOASIS is the simplest complete provider implementation in the repo — a good starting point for a new custom provider.