A comprehensive blockchain service framework with 22+ smart contracts, Intel SGX support, and enterprise-grade security. Deploy scalable DeFi applications with confidence.
Built for enterprise needs with cutting-edge technology and comprehensive tooling
Intel SGX trusted execution environments, comprehensive security monitoring, and enterprise-grade authentication systems.
Extensible service framework with standardized interfaces, dependency injection, and easy service composition.
Comprehensive testing, CI/CD pipelines, Docker support, and production deployment tools out of the box.
Full suite of financial services including lending, insurance, tokenization, and marketplace functionality.
Seamless integration across multiple blockchain networks with standardized cross-chain protocols.
Built-in AI services for pattern recognition, fraud detection, and predictive analytics.
22+ production-ready smart contracts covering all aspects of modern blockchain applications
Decentralized lending and borrowing with automated liquidation and risk management.
Smart contract-based insurance with automated claims processing and risk assessment.
Enterprise payment solutions with multi-currency support and compliance features.
NFT and digital asset marketplace with royalties, auctions, and trading features.
Secure key generation, storage, and management with hardware security module support.
Seamless asset transfers and communication across multiple blockchain networks.
Real-time system monitoring with alerts, metrics collection, and performance tracking.
Decentralized governance with proposal management and transparent voting mechanisms.
Secure patient data management with privacy-preserving analytics and compliance.
End-to-end supply chain tracking with provenance verification and quality assurance.
Smart grid integration with renewable energy trading and carbon credit management.
Blockchain gaming infrastructure with NFT assets, tournaments, and reward systems.
AI-powered pattern detection for fraud prevention and behavioral analysis.
Machine learning models for market prediction and trend analysis.
Comprehensive data analytics with real-time insights and custom reporting.
Reliable external data feeds with multiple data sources and validation mechanisms.
Everything you need to get started and build amazing applications
Get up and running in minutes with our step-by-step installation and setup guide.
Read GuideProduction deployment, security configuration, and performance optimization.
Learn MoreAccess the complete source code, examples, and community contributions.
View SourceReal-world examples to help you get started quickly
Create a lending pool with automated interest calculation and liquidation mechanisms.
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;
}
}
Build a complete NFT marketplace with auctions, royalties, and trading features.
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;
}
}
Integrate multiple DeFi protocols for yield farming and liquidity provision.
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;
}
}
Reliable external data feeds with validation and aggregation mechanisms.
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;
}
}
Follow these simple steps to deploy your first Neo Service Layer application
Get the latest version of Neo Service Layer from GitHub.
Restore NuGet packages and build the solution.
Verify everything works with our comprehensive test suite.
Deploy your first smart contract to the Neo blockchain.