Skip to content

icpfans-xyz/ices-motoko-library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The ICES (Internet Computer Event System) Motoko Library

Event log storage and analysis service on the Internet Computer

ICES (Internet Computer Event System) is a canister custom event log storage and analysis service on Dfinity. It mainly solves the problem that canister's interaction records cannot be publicly queried. Any canister can access ICES without permission, store the interactive data permanently, and query it through the public API and dashboard provided by ICES.

IC Mainnet demo

Guides and Documentation

To start using the ICES Motoko Library to integrate ICES into your Motoko-based Canister, visit our documentation or the examples folder in this repository.

IC Mainnet demo

Requirements

Getting started

You're required to have Vessel Motoko package manager binary installed and configured in your operating system.

Here's a quick breakdown, but use the original documentation for latest details:

  • You understand the basics of dfx cli, otherwise take the time to learn dfx getting started

  • Download a copy of the Vessel binary from the release page or build one yourself

  • Add the Vessel binary location to your PATH (e.g. for macOS one of the quickest ways to achieve this would be to symlink the binary in the /usr/local/bin directory which is included in PATH by default)

  • Run Vessel init in your project root.

    vessel init
  • Edit package-set.dhall to include the ICES Motoko Library as described in add the library to a project.

  • Include the vessel sources command in the build > packtool of your dfx.json

    ...
    "defaults": {
      "build": {
        "packtool": "vessel sources"
      }
    }
    ...
  • From then on, you can simply run the dfx build command or dfx deploy

    dfx build
    dfx deploy <canister>

Add the library to a project

After you have initialised Vessel, edit the package-set.dhall and include the ICES Motoko library and the version, as available in the releases of ICES Motoko Library.

In the example below of our package-set.dhall, we are using v0.1.0:

let Package =
    { name : Text, version : Text, repo : Text, dependencies : List Text }

let
  additions =
      [
            { dependencies = [] : List Text
            , name = "base"
            , repo = "https://github.com/dfinity/motoko-base.git"
            , version = "494824a2787aee24ab4a5888aa519deb05ecfd60"
            },
            { name = "ices"
            , repo = "https://github.com/icpfans-xyz/ices-motoko-library"
            , version = "v0.1.0"
            , dependencies = [] : List Text
            }
      ] : List Package

in  additions

Make sure you also add the library as a dependency to your vessel.dhall file like this:

{
  dependencies = [ "base", "ices" ],
  compiler = Some "0.6.2"
}

We've assumed that you have followed Vessel initialisation e.g. the init and the dfx.json.

Here's a breakdown of a project initialised by the dfx cli:

  1. Create a new Motoko project called ICES-motoko-example (it's a random name that we selected for our example, you can name it whatever you want)
dfx new ices-motoko-example
  1. Initialise Vessel
vessel init
  1. Add the ICES Motoko library to package-set.dhall, as described in Add the library to a project

  2. Edit dfx.json and set vessel sources in the defaults > build > packtool

{
  "canisters": {
    "ices-motoko-example": {
      "main": "src/ices-motoko-example/main.mo",
      "type": "motoko"
    }
  },
  "defaults": {
    "build": {
      "args": "",
      "packtool": "vessel sources"
    }
  },
  "networks": {
    "local": {
      "bind": "127.0.0.1:8000",
      "type": "ephemeral"
    }
  },
  "version": 1
}

🔗 Links