Skip to content

Latest commit

 

History

History
115 lines (93 loc) · 8.35 KB

samplesmartcontracts.md

File metadata and controls

115 lines (93 loc) · 8.35 KB

C# Smart Contract Developers Guide

NEO Blockchain C# Center of Excellence

The neo-csharpcoe project is an "umbrella" project for several initiatives related to providing tools and libraries (code), frameworks, how-to documentation, and best practices for full-stack development using .NET/C# and C#.NEO and the NEO Blockchain software platform.

The neo-csharpcoe is an independent, free, open source project that is 100% community-supported by people like yourself through your contributions of time, energy, passion, promotion, and donations. To learn more about contributing to the neo-csharpcoe, click here.

Appendix - Sample Smart Contracts

Purpose

TODO

Goals, Non-Goals and Assumptions

TODO

Principles

TODO

Drivers

TODO

Sample Smart Contracts

First dApps Competition [DAPPSCOMPETE1]

A few days ago, the first City of Zion dApps competition submission deadline was reached, and 17 valid projects were submitted. This post provides a brief overview of each project and the integrated components. The projects are presented in alphabetical order. [Chris Hager, Nov 23, 2017]

The following is a list of the links to the smart contracts in each project (some projects have two or more smart contracts).

  1. Splyse/neo-smart-iot from https://github.com/Splyse/neo-smart-iot/blob/master/neo-pubsub.py
  2. Splyse/neo-smart-iot from https://github.com/Splyse/neo-smart-iot/blob/master/elcaro-contract.py
  3. neoauth/smart-contract from https://github.com/neoauth/smart-contract/blob/master/src/NeoAuth.py
  4. BlockSaver/smart-saving-contract from https://github.com/BlockSaver/smart-saving-contract/blob/master/SmartSavingContract/SmartSavingContract.cs
    • ExecutionEngine.ExecutingScriptHash
    • JSON Arrays
    • Storage - medium-high level
    • Assets and Asset IDs
  5. imusify/smart-contract-incentify from https://github.com/imusify/smart-contract-incentify/blob/master/contract/ImusifyToken.cs
    • NEP5 token
    • Storage - medium
    • CheckWitness(owner) - (commented out) owner account in storage
  6. mmoravec/luckyneo from https://github.com/mmoravec/luckyneo/blob/master/LuckyNeo.py
  7. birmas/neotrade from https://github.com/birmas/neotrade/blob/master/neotrade.cs
    • NEP5 token
    • Assets and Asset IDs
    • Storage - medium level
    • Admin account
    • Runtime.CheckWitness
    • VerifySignature (commented out)
    • ExecutionEngine.ExecutingScriptHash
    • Transaction
    • Blockchain.GetHeader - for discount rate
  8. nickazg/neo-fund from https://github.com/nickazg/neo-fund/blob/master/neo-fund-sc/neo-fund-sc/NeoFund.cs
    • Transaction - high level
    • Role-based rights management
    • Storage - medium-high level
    • Assets and Asset IDs
    • Blockchain.GetHeader(Blockchain.GetHeight()).Timestamp
  9. ambethia/neo-raffle from https://github.com/ambethia/neo-raffle/blob/master/Contract.cs
    • !Runtime.CheckWitness(Owner)
    • ExecutionEngine.ExecutingScriptHash
    • Blockchain - high level
    • Transaction - high level
    • Assets and Asset IDs
    • long randomNumber = (long)(header.ConsensusData >> 32);
    • var prevTx = Blockchain.GetTransaction(input.PrevHash);
    • var thisOutput = prevTx.GetOutputs()[input.PrevIndex];
  10. block-shaman/NepSwap from https://github.com/block-shaman/NepSwap/blob/master/Contract1.cs
    • ExecutionEngine.ScriptContainer
    • Transaction - high level
    • Blockchain.GetAccount(contractHash) - hardcoded contractHash
    • NEP1 template
    • Assets and AssetIDs
    • ExecutionEngine.ExecutingScriptHash
  11. MediaServe/KRYPTON from https://github.com/MediaServe/KRYPTON/blob/master/contract/krypton.py
  12. Relfos/phantasma from https://github.com/Relfos/phantasma/blob/master/PhantasmaContract/PhantasmaContract.cs
    • NEP token
    • Assets and AssetIDs
    • ExecutionEngine.ExecutingScriptHash
    • Blockchain.GetHeader(Blockchain.GetHeight()).Timestamp
    • "Secure Blockchain email service"
    • Elaborate but good smart contract
  13. SmartPromise/SmartPromise.NeoContract from https://github.com/SmartPromise/SmartPromise.NeoContract/blob/master/SmartPromise/SmartPromise.cs
    • Storage - medium level
    • NEP token
    • ExecutionEngine.ExecutingScriptHash
    • Transactions - high level
    • Assets and AssetIDs
  14. JorritvandenBerg/sunny-dapp from https://github.com/JorritvandenBerg/sunny-dapp/blob/master/smartcontract/sunny_dapp.py
  15. ConjurTech/switcheo from https://github.com/ConjurTech/switcheo/blob/master/switcheo/BrokerContract.cs
    • Transaction - high level
    • Elaborate and long - good
    • Assets and AssetIDs
    • !Runtime.CheckWitness(offer.MakerAddress)
    • Long but very factored
  16. xtolya/TripShares from https://github.com/xtolya/TripShares/blob/master/TripShareSmartContract/TripShareSmartContract/TripShareContract.cs
    • Transaction - high level
    • Elaborate and long - good
    • Assets and AssetIDs
    • NEP5
  17. Nikolaj-K/turing-complete-smart-contract from https://github.com/Nikolaj-K/turing-complete-smart-contract/blob/master/contract.cs
    • Cool app

Figure C.1. First dApps Competition: List of Smart Contracts

References