Zen Protocol Documentation
WebsiteTelegramBlogForum
  • Zen Protocol Docs
  • Apps
    • Headless Full Node
      • Full Node NPM Package
      • Build from Source
      • CLI
      • API
        • Wallet
        • Contracts
        • General
        • Blockchain
        • AddressDB
      • Deploy
        • Systemd
        • Shell script
        • Docker
      • Technical Model
      • AddressDB
    • Wallet
      • Desktop Wallet
        • Installers
      • Web Wallet
        • Run Locally
      • Wallet User Guide
        • Connect a Wallet
          • Create a Wallet
          • Import a Wallet
          • Watch Mode
        • My Wallet
          • Navigation Bar
          • Portfolio
          • Receive
          • Send / Execute
          • Transaction History
        • Contracts
          • Active Contracts
          • Execute a Contract
            • Message Body Field
          • Extend a Contract
          • Activate a Contract
        • Voting
          • Common Goods Pool
            • Generating a Ballot ID
          • Governance
        • Signer
        • Settings
          • Account Settings
          • Node Connectivity
      • Deprecated Desktop Wallet
        • Executable Installers
        • Wallet Structure
          • Video Tutorials
    • Explorer
    • Zen.js
      • Payment Processing
    • Oracle
      • Oracle GUI
      • Oracle Service
      • Oracle's API
      • Deploy
        • Systemd
        • Docker
      • How the Oracle contract works
      • How to create an Attestation token
    • Dex
      • Dex User Guide
        • Traded Pairs
        • Search Pairs
        • Order Book
        • Operations
        • My Wallet
        • Settings
      • How DEX contract works
    • Fixed Payout
      • Fixed Payout Generator User Guide
        • Issue
        • Redeem
        • Cancel
        • Verify
        • Settings
      • How the FP Contract works
      • How are the asset named?
  • Smart Contracts
  • Contract Structure
  • Contract Cost
  • Contract Activation
  • Contract Examples
  • Smart Contracts SDK
  • Contracts Language ZF*
  • Named Token Tutorial
  • Consensus
  • Common Goods Pool
  • Block Validation
  • Transaction Validation
  • Serialization
  • Use Cases
    • Create Unsigned Transaction
    • Secure Sign Transaction
    • Cold Storage using Full Node
  • Troubleshooting
    • Responsible Disclosure
    • Bug Bounty
    • Known Bugs
  • For Miners
    • Pools
    • GPU Mining
    • GPU Bounties
  • Check Crowdsale Contribution
  • Alpha call option
Powered by GitBook
On this page
  • Installation
  • From Source
  • From NPM
  • Windows
  • Linux
  • Point your npm directory to our repository
  • Installing / Updating
  • Usage
  • create
  • elaborate
  • verify
  • extract
  • compile
  • pack
  • generate-fsx
  • run-fsx
  • contractid
  • acost
  • info

Smart Contracts SDK

Learn how to use the ZP Smart Contract SDK to write, compile and test smart contracts in the ZF* language.

Zen-SDK Repo -> https://github.com/zenprotocol/ZFS-SDK

Installation

From Source

You will need to have mono installed. Instructions for your OS can be found here. For Linux, you will need either the mono-devel or mono-complete package. Do not install mono from your package manager - follow the instructions on the mono website.

Linux

  • Clone this repo

  • Run the following commands. Note that this could take a few minutes.

  • cd ZFS-SDK

  • ./paket restore

  • ./build.sh

OSX

  • Clone this repo

  • Run the following commands. Note that this could take a few minutes.

  • cd ZFS-SDK

  • mono paket restore

  • ./build.sh

From NPM

OSX

  1. Install mono-devel. If you choose to install via a package manager, add Mono's own repository first.

  2. Install Nodejs

    1. Recommended to install using NVM

    2. Recommended to install Node LTS nvm install 8.9.4

Windows

  1. Install .NET Framework 4.7.

  2. Install Nodejs (LTS version recommended)

  3. Open the Command Prompt

Linux

  1. Install mono-devel. If you choose to install via a package manager, add Mono's own repository first.

  2. Install Nodejs (Version >= 6)

    1. Recommended to install using NVM

    2. Recommended to install Node LTS (8.9.4) nvm install --lts

Point your npm directory to our repository

Run the following commands in the Terminal / Command Prompt:

npm config set @zen:registry https://www.myget.org/F/zenprotocol/npm/

Installing / Updating

Run the following commands in the Terminal / Command Prompt:

npm install @zen/zebra -g

Usage

USAGE: zebra [--help] [<subcommand> [<options>]]

SUBCOMMANDS:

    create <options>      Create a new template contract
    elaborate, e <options>
                          Elaborate the source File and verify
    verify, v <options>   Verify the source file
    extract, x <options>  Extract the source file
    compile, c <options>  Compile from source file
    pack, p <options>     Pack the contract to be activated on zen blockchain
    generate-fsx, g <options>
                          Generate a .fsx file to test the contract with
    run-fsx, r <options>  Run the given .fsx file, automatically loading Zen dlls.
    contractid, cid <options>
                          Compute contract ID.
    acost, ac <options>   Compute activation cost.
    info, i <options>     Get contract information

    Use 'zebra <subcommand> --help' for additional information.

OPTIONS:

    --help                display this list of options.

create

USAGE: zebra create [--help] <filename>

FILENAME:

    <filename>            File name of the generated contract

OPTIONS:

    --help                display this list of options.

elaborate

USAGE: zebra elaborate [--help] [--z3rlimit <rlimit>] [--log-types] <filename>

FILENAME:

    <filename>            File name of the contract to elaborate

OPTIONS:

    --z3rlimit, -z <rlimit>
                          Z3 rlimit
    --log-types, -t       Log types
    --help                display this list of options.

verify

USAGE: zebra verify [--help] [--z3rlimit <rlimit>] [--log-types] <filename>

FILENAME:

    <filename>            File name of the contract to verify

OPTIONS:

    --z3rlimit, -z <rlimit>
                          Z3 rlimit
    --log-types, -t       Log types
    --help                display this list of options.

extract

USAGE: zebra extract [--help] [--z3rlimit <rlimit>] [--log-types] <filename>

FILENAME:

    <filename>            File name of the contract to extract

OPTIONS:

    --z3rlimit, -z <rlimit>
                          Z3 rlimit
    --log-types, -t       Log types
    --help                display this list of options.

compile

USAGE: zebra compile [--help] [--z3rlimit <rlimit>] [--log-types] <filename>

FILENAME:

    <filename>            File name of the contract to compile

OPTIONS:

    --z3rlimit, -z <rlimit>
                          Z3 rlimit
    --log-types, -t       Log types
    --help                display this list of options.

pack

USAGE: zebra pack [--help] <filename>

FILENAME:

    <filename>            File name of the contract to pack

OPTIONS:

    --help                display this list of options.

generate-fsx

USAGE: zebra generate-fsx [--help] <filename>

FILENAME:

    <filename>            File name of the source contract to generate FSX script from

OPTIONS:

    --help                display this list of options.

run-fsx

USAGE: zebra run-fsx [--help] <filename>

FILENAME:

    <filename>            File name of the FSX script

OPTIONS:

    --help                display this list of options.

contractid

USAGE: zebra contractid [--help] <filename>

FILENAME:

    <filename>            File name of the contract

OPTIONS:

    --help                display this list of options.

acost

USAGE: zebra acost [--help] [--numofblocks <uint>] [--z3rlimit <rlimit>] <filename>

FILENAME:

    <filename>            File name of the contract

OPTIONS:

    --numofblocks, -n <uint>
                          Number of blocks
    --z3rlimit, -z <rlimit>
                          Z3 rlimit
    --help                display this list of options.

info

USAGE: zebra info [--help] [--z3rlimit <rlimit>] <filename>

FILENAME:

    <filename>            File name of the contract

OPTIONS:

    --z3rlimit, -z <rlimit>
                          Z3 rlimit
    --help                display this list of options.
PreviousContract ExamplesNextContracts Language ZF*

Last updated 3 years ago