/idetix

Truffle project to maintain and test all smart contracts centrally.

Primary LanguageJavaScript

Ticketing dApp

Blockchain Ticketing

Software Project

University of Zurich

Contribution Workflow

  1. Create a new issue (automatically adds the issue to the To Do column of Ticketing dApp project)
  2. Assign yourself an issue from the To Do column of the Ticketing dApp project and move it to the In Progress column
  3. Pull the latest changes from origin/master
  4. Create a new local branch beginning with the issue number (e.g., 4-feature).
  5. Commit to this branch mentioning the issue number in the commit message (e.g. add functionality xyz (#4)
  6. Finish your implementation on the branch
  7. Pull and merge the latest changes from origin/master into your local branch
  8. Verify that your changes still work as expected
  9. Merge your branch into master and push the changes
  10. Close the issue and move it to the Done column of the Ticketing dApp project

Generate ABIs

truffle compile

This generates the ABIs in a new folder idetix/abi in the root directory. Use these files to interact with the smart contracts from your web app.

Deploy contracts on the test network

Make sure Ganache is running on port 7545 or change the port in truffle-config.js.

truffle migrate --reset

Test

Install the necessary dependencies:

npm install

Run the tests:

tuffle test

Evaluation Scripts

To quickly create many events, use the evaluation scripts under evaluation.

  1. set the contract addresses in the environment:
export EVENT_FACTORY_ADDRESS=0x055b6e305864DC13E0b9F4ecB1591eE2e8a99C99  IDENTITY_ADDRESS=0x067b6772E882b541121a2af3Cf947E27D1edf4E9 TEST_ERC20_ADDRESS=0xf88D4b83Aa41d7E810d7235cC19365F0e522730C
  1. run the scripts:
truffle test evaluation/GasCostAnalysis.js --network ganachecli

IPFS JSON schemas

The metadata of events, tickets and identity approvers is stored on IPFS to reduce storage on the blockchain. In the following it is shown what data is stored on the blockchain and what data is stored on IPFS and according to what JSON schema.

Events:

Following information is stored on the blockchain:

  • IPFS hash (of the JSON below)
  • Identity approver's Ethereum address
  • Minimum required identity approvement level
  • Accepted token for payment (Either the null address for ETH or a valid Ethereum address of an ERC20 token contract)

IPFS event metadata JSON schema:

{
  "version": "1.0",
  "event": {
    "title": "string",
    "location": "string",
    "category": "string",
    "description": "string",
    "time": "unix",
    "website": "url",
    "twitter": "url",
    "image": "base64",
  }
}

Ticket types:

Following information is stored on the blockchain:

  • IPFS hash (of the JSON below)
  • Whether the ticket is non-fungible
  • Price
  • Finalization time
  • Supply
  • Presale block (Optional - only for ticket types with a presale)

IPFS ticket metadata JSON schema:

{
  "version": "1.0",
  "ticket": {
    "title": "string",
    "description": "string",
    "color": "hex",
    "event": "constractHash",
    "mapping": [
        "x1/y1",
        "x1/y2",
        "x1/y3"
    ]
  }
}

Identity Approvers:

Following information is stored on the blockchain:

  • IPFS hash (of the JSON below)

IPFS identity approver metadata JSON schema:

{
  "version": "1.0",
  "approver": {
    "title": "string",
    "methods": [
      {
        "level": 1,
        "value": "method-name"
      },
      {
        "level": 2,
        "value": "method-name"
      }
    ],
    "website": "url",
    "twitter": "url"
  }
}

Most recent deployments

Kovan Testnet

EventFactory deployed at: 0x3840DFe78536c4b27A928B1B86898302C938Ae9D

Identity deployed at: 0x2583d96704f7F0a6737b158b59739ac4b239F1dE

TestERC20Token deployed at: 0xBFd25cac00F0E9a0cdFA634bdaED379FdC69E24d