In order to run CTL's Contract
effects, several services are required. These can be accessed through a ContractEnv
value that holds websocket connections, information about server hosts/ports, and other requisite information. Which services are required depends on which backend you are using.
The choice is either Ogmios+Kupo+cardano-node (a.k.a. "CTL backend") or Blockfrost.
Our nix environment includes CTL backend services, but for now Blockfrost can be only used externally (either by connecting the public SaaS or the run-your-own version. The self-hosted version still requires Ogmios for some of the endpoints).
Table of Contents
Info in this section only applies to CTL backend services.
The services that are currently required are:
- Ogmios
- You must use Ogmios v6 or greater with CTL with
--include-transaction-cbor
option - Ogmios itself requires a running Cardano node, so you may also need to deploy a node. Node v8.1.1 or greater is recommended
- You can also use our fork which has improved Nix integration
- You must use Ogmios v6 or greater with CTL with
- Kupo
- Required to query UTxOs and resolve inline datums and reference scripts
- You must use Kupo v2.2.0 or greater with CTL
- Like Ogmios, Kupo requires a running Cardano node
To start all of them for tests, run npm run start-runtime
.
CTL's dependencies can be configured and started via NixOS modules. See nix/test-nixos-configuration.nix for example.
CTL's overlays.runtime
(contained in runtime.nix) provides some mechanisms for conveniently launching all runtime services using Arion (itself a wrapper around docker-compose
). To use this, you must have docker installed, the docker deamon running and you must have a setup based on Nix flakes (recommended as well for using CTL as a dependency for Purescript projects).
The project template flake uses the runtime
overlay to launch all of the required services.
For launching services for developing CTL itself, see our documentation on development.
CTL supports using networks other than the public preview testnet to provide different development environments.
To choose a different network, you must specify an alternative way of getting the network configuration. The cardano-configurations repo provides configs for mainnet
, preprod
and a few other networks. The network.name
parameter of buildCtlRuntime
determines which of the network config directories is chosen.
You can also specify your own fork of cardano-configurations
like this:
inputs.cardano-transaction-lib.inputs.cardano-configurations.follows = "...";
When changing networks, make sure that network.magic
is correctly synchronized with value in config (see protocolConsts.protocolMagic
in byron.json
).
See here for the documentation.
In order to run most Contract
actions in the browser, you must use one of the supported wallets. The following steps must be taken to ensure that you can run CTL contracts:
- Make sure that your wallet is running on the testnet (some wallets can be configured via a toggle in the settings menu, other provide a separate extension)
- Fund the wallet using the Testnet Faucet
- Make sure that you have set collateral for the wallet, which wallets reserve apart from other UTxOs