Unity + Truffle + zeknd Template

Overview

A template for a zeknd DAppChain with a Unity client. Contains:

  • Template Blueprint Solidity contract implementing a basic string-to-string map. Perfect as a starting point.

  • Pre-configured Truffle project that automatically extracts ABIs and binaries of compiled contracts into corresponding folders.

  • Pre-configured optimally setup Unity project with Blueprint contract test scene, and an already included zeknd SDK.

#Template Structure

├── DAppChain/
│   ├── build/ # zeknd binary and app/blockchain state data will be stored here
│   │   ├── contracts/ # Compiled contracts .bin will go here
│   │   └── ...
│   ├── start-chain.sh # Starts the zeknd DAppChain
│   ├── reset-and-start-chain.sh ## Resets app/blockchain state and starts the zeknd DAppChain
│   ├── genesis.json # Change this file when changing/adding contracts
│   └── ...
├── TruffleProject/
│   └── ...
└── UnityClient/ # Unity client project
    ├── Assets/
    │   ├── Contracts/ # Contract ABIs will go here
    │   └── ...
    └── ...

#Getting the Template

First, you need to install Truffle, if it isn't installed already:

npm install -g truffle

After that, you can download the template itself:

git clone https://github.com/zekndnetwork/zeknd-unity-project-template.git

Feel free to rename the zeknd-unity-project-template folder right away according to the name of your project.

#Building the Truffle Project

# Build the Truffle project. This will extract the ABI files to the Unity client,
# and compiled contracts to the DAppChain/build/ directory

cd Truffle
truffle build

#Running the DAppChain

# Start the zeknd DAppChain. zeknd binary will be downloaded automatically

cd DAppChain
./start-chain.sh

#Running the Unity client

Open the Unity project located in UnityClient. Open the Blueprint/BlueprintTest scene and run/build it.

#Workflow

  1. Make changes to the contracts.

  2. Build the Truffle project using truffle build.

  3. Start the zeknd DAppChain using DAppChain/start-chain.sh.

  4. Make changes to the Unity client project.

Last updated