Enterprise-Grade Blockchain Infrastructure

Build the Future with Neo Service Layer

A comprehensive blockchain service framework with 22+ smart contracts, Intel SGX support, and enterprise-grade security. Deploy scalable DeFi applications with confidence.

22+
Smart Contracts
100%
Test Coverage
SGX
Secure Enclaves

Why Choose Neo Service Layer?

Built for enterprise needs with cutting-edge technology and comprehensive tooling

Enterprise Security

Intel SGX trusted execution environments, comprehensive security monitoring, and enterprise-grade authentication systems.

  • Intel SGX Enclaves
  • Zero-Knowledge Proofs
  • Multi-signature Support

Modular Architecture

Extensible service framework with standardized interfaces, dependency injection, and easy service composition.

  • Service Registry
  • Template Generation
  • Dependency Injection

Production Ready

Comprehensive testing, CI/CD pipelines, Docker support, and production deployment tools out of the box.

  • Docker Containers
  • CI/CD Pipelines
  • Health Monitoring

DeFi Complete

Full suite of financial services including lending, insurance, tokenization, and marketplace functionality.

  • Lending Protocols
  • Insurance Contracts
  • NFT Marketplace

Cross-Chain

Seamless integration across multiple blockchain networks with standardized cross-chain protocols.

  • Multi-Network Support
  • Bridge Protocols
  • Asset Transfers

AI-Powered

Built-in AI services for pattern recognition, fraud detection, and predictive analytics.

  • Pattern Recognition
  • Fraud Detection
  • Predictive Analytics

Comprehensive Service Portfolio

22+ production-ready smart contracts covering all aspects of modern blockchain applications

💰

Lending Protocol

Decentralized lending and borrowing with automated liquidation and risk management.

Collateral Management Interest Rates Liquidation
🛡️

Insurance

Smart contract-based insurance with automated claims processing and risk assessment.

Claims Processing Risk Assessment Premium Calculation
💳

Payment Processing

Enterprise payment solutions with multi-currency support and compliance features.

Multi-Currency Compliance Escrow
🏪

Marketplace

NFT and digital asset marketplace with royalties, auctions, and trading features.

NFT Trading Auctions Royalties
🔐

Key Management

Secure key generation, storage, and management with hardware security module support.

HSM Support Key Rotation Multi-Sig
🔗

Cross-Chain

Seamless asset transfers and communication across multiple blockchain networks.

Asset Bridges Message Passing Multi-Network
📊

Monitoring

Real-time system monitoring with alerts, metrics collection, and performance tracking.

Real-time Alerts Metrics Performance
🗳️

Voting

Decentralized governance with proposal management and transparent voting mechanisms.

Governance Proposals Transparency
🏥

Healthcare

Secure patient data management with privacy-preserving analytics and compliance.

HIPAA Compliance Privacy Analytics
🚚

Supply Chain

End-to-end supply chain tracking with provenance verification and quality assurance.

Traceability Provenance Quality Control

Energy Management

Smart grid integration with renewable energy trading and carbon credit management.

Smart Grid Energy Trading Carbon Credits
🎮

Gaming

Blockchain gaming infrastructure with NFT assets, tournaments, and reward systems.

NFT Assets Tournaments Rewards
🧠

Pattern Recognition

AI-powered pattern detection for fraud prevention and behavioral analysis.

Fraud Detection Behavior Analysis Risk Assessment
📈

Predictive Analytics

Machine learning models for market prediction and trend analysis.

Market Prediction Trend Analysis ML Models
📊

Analytics

Comprehensive data analytics with real-time insights and custom reporting.

Real-time Insights Custom Reports Data Mining
🔍

Oracle Services

Reliable external data feeds with multiple data sources and validation mechanisms.

Data Feeds Validation Multi-Source

Comprehensive Documentation

Everything you need to get started and build amazing applications

Quick Start Guide

Get up and running in minutes with our step-by-step installation and setup guide.

Read Guide

API Reference

Complete API documentation with examples and interactive playground.

View API

Advanced Setup

Production deployment, security configuration, and performance optimization.

Learn More

GitHub Repository

Access the complete source code, examples, and community contributions.

View Source

Neo Documentation

Official Neo blockchain documentation and developer resources.

Neo Docs

Community Support

Join our Discord community for support, discussions, and updates.

Join Discord

Code Examples

Real-world examples to help you get started quickly

Decentralized Lending Protocol

Create a lending pool with automated interest calculation and liquidation mechanisms.

Collateral Management Interest Calculation Liquidation
LendingProtocol.cs
using Neo.SmartContract.Framework;
using Neo.SmartContract.Framework.Services;

[DisplayName("LendingProtocol")]
public class LendingProtocol : SmartContract
{
    [InitialValue("0x...", ContractParameterType.Hash160)]
    private static readonly UInt160 Owner = default;

    public static bool CreateLendingPool(
        UInt160 collateralToken,
        UInt160 borrowToken,
        BigInteger collateralRatio,
        BigInteger interestRate)
    {
        // Validate caller permissions
        if (!Runtime.CheckWitness(Owner))
            throw new Exception("Unauthorized");

        // Create lending pool with parameters
        var poolId = GeneratePoolId(collateralToken, borrowToken);
        
        StorageMap pools = new(Storage.CurrentContext, "pools");
        pools.Put(poolId, new LendingPool
        {
            CollateralToken = collateralToken,
            BorrowToken = borrowToken,
            CollateralRatio = collateralRatio,
            InterestRate = interestRate,
            TotalCollateral = 0,
            TotalBorrowed = 0
        }.ToByteArray());

        return true;
    }

    public static bool Deposit(UInt160 user, UInt160 token, BigInteger amount)
    {
        if (!Runtime.CheckWitness(user))
            throw new Exception("Invalid witness");

        // Transfer tokens to contract
        var success = (bool)Contract.Call(token, "transfer", 
            CallFlags.All, user, Runtime.ExecutingScriptHash, amount, null);
        
        if (!success) return false;

        // Update user balance
        UpdateUserBalance(user, token, amount, true);
        
        OnDeposit(user, token, amount);
        return true;
    }
}

NFT Marketplace

Build a complete NFT marketplace with auctions, royalties, and trading features.

NFT Trading Auctions Royalties
NFTMarketplace.cs
using Neo.SmartContract.Framework;
using Neo.SmartContract.Framework.Services;

[DisplayName("NFTMarketplace")]
public class NFTMarketplace : SmartContract
{
    public static bool ListNFT(
        UInt160 nftContract,
        ByteString tokenId,
        BigInteger price,
        UInt160 seller)
    {
        if (!Runtime.CheckWitness(seller))
            throw new Exception("Invalid seller");

        // Verify NFT ownership
        var owner = (UInt160)Contract.Call(nftContract, "ownerOf", 
            CallFlags.ReadOnly, tokenId);
        if (owner != seller)
            throw new Exception("Not NFT owner");

        // Create listing
        var listingId = GenerateListingId(nftContract, tokenId);
        StorageMap listings = new(Storage.CurrentContext, "listings");
        
        listings.Put(listingId, new Listing
        {
            NFTContract = nftContract,
            TokenId = tokenId,
            Price = price,
            Seller = seller,
            IsActive = true,
            ListedAt = Runtime.Time
        }.ToByteArray());

        OnNFTListed(nftContract, tokenId, price, seller);
        return true;
    }

    public static bool PurchaseNFT(
        ByteString listingId,
        UInt160 buyer)
    {
        if (!Runtime.CheckWitness(buyer))
            throw new Exception("Invalid buyer");

        StorageMap listings = new(Storage.CurrentContext, "listings");
        var listingData = listings.Get(listingId);
        if (listingData == null)
            throw new Exception("Listing not found");

        var listing = (Listing)listingData.ToStruct();
        if (!listing.IsActive)
            throw new Exception("Listing inactive");

        // Process payment and transfer
        ProcessPayment(buyer, listing.Seller, listing.Price);
        TransferNFT(listing.NFTContract, listing.TokenId, 
                   listing.Seller, buyer);

        // Mark listing as sold
        listing.IsActive = false;
        listings.Put(listingId, listing.ToByteArray());

        OnNFTPurchased(listing.NFTContract, listing.TokenId, 
                      listing.Price, listing.Seller, buyer);
        return true;
    }
}

DeFi Integration

Integrate multiple DeFi protocols for yield farming and liquidity provision.

Yield Farming Liquidity Pools Rewards
DeFiIntegration.cs
using Neo.SmartContract.Framework;
using Neo.SmartContract.Framework.Services;

[DisplayName("DeFiIntegration")]
public class DeFiIntegration : SmartContract
{
    public static bool AddLiquidity(
        UInt160 tokenA,
        UInt160 tokenB,
        BigInteger amountA,
        BigInteger amountB,
        UInt160 provider)
    {
        if (!Runtime.CheckWitness(provider))
            throw new Exception("Invalid provider");

        // Calculate optimal amounts
        var (optimalA, optimalB) = CalculateOptimalAmounts(
            tokenA, tokenB, amountA, amountB);

        // Transfer tokens to pool
        TransferToPool(provider, tokenA, optimalA);
        TransferToPool(provider, tokenB, optimalB);

        // Mint LP tokens
        var lpTokens = CalculateLPTokens(optimalA, optimalB);
        MintLPTokens(provider, lpTokens);

        // Update pool state
        UpdatePoolReserves(tokenA, tokenB, optimalA, optimalB);

        OnLiquidityAdded(provider, tokenA, tokenB, 
                        optimalA, optimalB, lpTokens);
        return true;
    }

    public static bool Stake(
        UInt160 lpToken,
        BigInteger amount,
        UInt160 staker)
    {
        if (!Runtime.CheckWitness(staker))
            throw new Exception("Invalid staker");

        // Transfer LP tokens to staking contract
        var success = (bool)Contract.Call(lpToken, "transfer",
            CallFlags.All, staker, Runtime.ExecutingScriptHash, amount, null);
        
        if (!success) return false;

        // Update staking balance
        UpdateStakingBalance(staker, lpToken, amount);
        
        // Calculate and distribute rewards
        DistributeRewards(staker, lpToken);
        
        OnTokensStaked(staker, lpToken, amount);
        return true;
    }
}

Oracle Service

Reliable external data feeds with validation and aggregation mechanisms.

Data Feeds Validation Aggregation
OracleService.cs
using Neo.SmartContract.Framework;
using Neo.SmartContract.Framework.Services;

[DisplayName("OracleService")]
public class OracleService : SmartContract
{
    public static bool UpdatePrice(
        string symbol,
        BigInteger price,
        uint timestamp,
        UInt160 oracle)
    {
        if (!IsAuthorizedOracle(oracle))
            throw new Exception("Unauthorized oracle");

        // Validate price data
        if (price <= 0 || timestamp == 0)
            throw new Exception("Invalid price data");

        // Store price with validation
        StorageMap prices = new(Storage.CurrentContext, "prices");
        var priceData = new PriceData
        {
            Symbol = symbol,
            Price = price,
            Timestamp = timestamp,
            Oracle = oracle,
            IsValid = true
        };

        prices.Put(symbol, priceData.ToByteArray());
        
        OnPriceUpdated(symbol, price, timestamp, oracle);
        return true;
    }

    public static BigInteger GetPrice(string symbol)
    {
        StorageMap prices = new(Storage.CurrentContext, "prices");
        var priceData = prices.Get(symbol);
        
        if (priceData == null)
            throw new Exception("Price not found");

        var price = (PriceData)priceData.ToStruct();
        
        // Check if price is recent (within 1 hour)
        if (Runtime.Time - price.Timestamp > 3600)
            throw new Exception("Price data stale");

        return price.Price;
    }
}

Get Started in Minutes

Follow these simple steps to deploy your first Neo Service Layer application

1

Clone Repository

Get the latest version of Neo Service Layer from GitHub.

git clone https://github.com/r3e-network/neo-service-layer.git
2

Install Dependencies

Restore NuGet packages and build the solution.

dotnet restore && dotnet build
3

Run Tests

Verify everything works with our comprehensive test suite.

./scripts/testing/run-all-tests.sh
4

Deploy Contracts

Deploy your first smart contract to the Neo blockchain.

neo-express contract deploy UserManagementContract.nef