Official Docs

I. InstallationII. TransactionsIII. Smart ContractsIV. StorageV. RPC APIVI. TestnetGasMainnetTestnet

Examples

Bank Vault Smart ContractChat Room Smart ContractRectangle Smart ContractSample Smart Contract

API Reference

EventsNRC20 TokensREPL ConsoleRemote Procedure Calls (RPC)RPC Admin

Designing Nebulas

OverviewAddressBlockchainConsensusCryptoMerkle Patricia TreeNetwork ProtocolNebulas Virtual MachineSmart ContractsTransactions

Additional Resources

Contribute to NebulasCrash ReporterFAQLogging

Rectangle Smart Contract

class Rectangle { constructor() { // define fields stored to state trie. LocalContractStorage.defineProperties(this, { height: null, width: null, }); } // init function. init(height, width) { this.height = height; this.width = width; } // calc area function. calcArea() { return this.height * this.width; } // verify function. verify(expected) { let area = this.calcArea(); if (expected != area) { throw new Error("Error: expected " + expected + ", actual is " + area + "."); } } } module.exports = Rectangle

Go back to the homepage