
Smart Contract Installations
-
Coxygen Content Material
-
Cardano Smart Contract Development
-
Technical Documentation
-
GHC and Cabal, NixOS, Marlowe,Plu-ts, Helios, Lucid and Mesh
-
Author: Bernard Sibanda, Billie Matema
-
Date: 6 May 2024
Haskell : GHC, Stake and Cabal Installations(windows, linux, iOS)
Welcome! Haskell installations used to take long and did not have good documentation. Coxygen aims not only to give you text, videos to read or listen to but also to walk you through the process until your development environment is set and you are ready to code. This means that you need to contact Coxygen Helpers to walk you through with this documentation @ https://coxygen.co or contact us using social media found at the website.
On a high level you need to have these pre-requisites:
- Skills and knowledge of installing software in windows, linux and iOS
- Computer/Laptop with windows(windows 10/11), linux(ubuntu 18, 20, 22) and Mac(TBD)
- HDD- SSD(500GB), RAM(32GB) and Internet Speed(30mb/s) and above
- Install anydesk or any other remote desktop so that we are able to install with you remotely
- Patience : Coxygen is a live support and as such will take away frustrations.
Below are high level guides one can follow
INSTALLING GHC and CABAL on macOS and Linux
Step 1
To use the GHCup installer to install GHC and Cabal, type:
```bash
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
Step 2
During installation, when prompted:
- Press ENTER to proceed.
- To prepend the required PATH variable to $HOME/.bashrc, type
P. - When prompted to install haskell-language-server (HLS), type
N. - When prompted to install Slack, type
N. - Press ENTER to proceed.
Step 3
When GHCup finishes installing GHC and Cabal, type the following commands to reload your shell profile, and then confirm that GHCup installed correctly:
source $HOME/.bashrc
ghcup --version
INSTALLING GHC and CABAL on Windows
Step 1
Open PowerShell and run as administrator.
Step 2
Paste the following command into PowerShell:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
- Type
chocoto verify whether it is installed successfully. - Close PowerShell if Chocolatey is installed successfully.
Step 3
Run Command Prompt as an administrator, then type:
choco install ghc cabal
During installation, when prompted:
- Press
yto run the script to install Cabal. - Press
yto run the script to install GHC. - Type
refreshenvto refresh PowerShell. - Type
ghc --versionto verify whether it has installed successfully. - Type
cabal --versionto verify whether it has installed successfully.
This layout organizes the steps clearly and makes it easier to follow the instructions for each operating system.
Haskell Nix
Haskell has many mature tools and infrustructures. Nix is another one. This documentation is ment to help the live sessions and will require more study and reading of this https://input-output-hk.github.io/haskell.nix/index.html
Installing NIXOS
1. **Download NixOS ISO**:
- Go to the [NixOS download page](https://nixos.org/download.html).
- Choose the appropriate version of NixOS for your system architecture (usually 64-bit).
- Click on the download link to get the ISO file.
2. **Create Bootable USB Drive**:
- Insert a USB drive with at least 4GB of storage capacity into your Windows computer.
- Download and install Rufus, a tool for creating bootable USB drives ([Rufus](https://rufus.ie/)).
- Run Rufus and select your USB drive from the Device dropdown menu.
- Click on the "Select" button next to "Boot selection" and choose the NixOS ISO file you downloaded.
- Leave all other settings as default and click on the "Start" button.
- Rufus will now create a bootable USB drive with the NixOS ISO.
3. **Configure BIOS/UEFI Settings**:
- Restart your computer and enter the BIOS/UEFI settings.
- Change the boot order to prioritize booting from USB devices.
- Save the changes and exit the BIOS/UEFI settings.
4. **Boot from USB Drive**:
- Insert the bootable USB drive into your computer.
- Restart your computer.
- Your computer should now boot from the USB drive and load the NixOS installer.
5. **Start NixOS Installation**:
- Once the NixOS installer loads, you'll be presented with the boot menu.
- Select the "Graphical Installation" option if you prefer a graphical installer, or "Normal Installation" for a text-based installer.
6. **Configure NixOS Installation**:
- Create a configuration file (`configuration.nix`) that specifies how you want your system to be set up.
- You can either create this file manually or generate it using the `nixos-generate-config` command.
7. **Install NixOS**:
- Once your configuration file is ready, start the installation process by running:
```
sudo nixos-install
```
- This command will install NixOS onto your system according to the configuration specified in `configuration.nix`.
8. **Reboot**:
- After the installation process completes successfully, remove the USB drive and reboot your computer:
```
sudo reboot
```
9. **Post-Installation**:
- After rebooting, log in to your new NixOS system.
- You can now customize your system further, install additional packages using the Nix package manager, and configure any remaining settings according to your preferences.
# HOW TO CONFIGURE YOUR NIXOS
**Step 1:** After the successful installation of NIXOS, open the terminal and type the following command to enter into the NIXOS directory:
cd /etc/nixos/
**Step 2:** Use the command `ls` to confirm and view the files in the NIXOS directory. There should be `configuration.nix` and `hardware-configuration.nix` files.
**Step 3:** Type the following command to enter into the `configuration.nix` file:
sudoedit configuration.nix
**Step 4:** To install the Vim package provided in the `configuration.nix` file, type/click:
- Press "ctrl + o" to enter the edit/write mode.
- Scroll down the `configuration.nix` file and uncomment Vim by removing the "#" character.
- Press "ctrl + x" to exit the edit/writing mode.
**Step 5:** On the terminal, type the following command to build the new configurations:
sudo nixos-rebuild switch
NIXOS will then configure the changes accordingly.
**Step 6:** To configure the file further, you can search for other packages using the following link: [NixOS Package Search](https://search.nixos.org/packages).
Follow steps 3 - 5 to configure the changes to NIXOS successfully.
# After installing NixOS, here are some logical steps to get started:
1. **Update Packages**:
- Start by updating the packages. Even if you used the latest ISO for installation, updates are essential.
- Check for updates in added channels:
```
nix-channel --update
```
- Install any available updates:
```
sudo nixos-rebuild switch --upgrade
```
2. **Change Hostname**:
- Unlike traditional methods (using `hostnamectl`), NixOS handles hostname changes differently.
- Edit the main configuration file:
```
sudo nano /etc/nixos/configuration.nix
```
- Locate the line:
```
networking.hostName = "nixos";
```
- Change it to your desired hostname:
```
networking.hostName = "Your_Hostname";
```
- Save the changes and apply them:
```
sudo nixos-rebuild switch
```
3. **Setup Flatpak**:
- NixOS doesn't handle Flatpak installations the same way as Ubuntu or other distributions.
- Edit the `configuration.nix` file:
```
sudo nano /etc/nixos/configuration.nix
```
- Add the following line at the end:
```
services.flatpak.enable = true;
```
- Save the changes and apply them:
```
sudo nixos-rebuild switch
```
- Add the Flathub repository:
```
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
```
## Why it is important to install Flatpak
1. **Universal Packaging**:
- Flatpak is like a universal gift box for apps.
- It wraps up an app along with all its necessary stuff (dependencies) in one package.
2. **No More Dependency Hassles**:
- With Flatpak, you don't need to worry about missing pieces.
- It brings everything needed, so apps work smoothly on any Linux system.
3. **Secure and Self-Contained**:
- Flatpak apps run in a safe sandbox.
- They can even update themselves without bothering you.
4. **Install Anywhere**:
- Whether you're on Ubuntu, Fedora, or any other Linux, Flatpak works everywhere.
# Installing Google Chrome on NixOS
1. **Update your package list**:
Before downloading any new software, it's a good practice to update your package list to ensure you're getting the latest versions of available software. You can do this by running:
sudo nix-channel --update
2. **Add the overlay**:
You need to add the overlay containing Google Chrome to your NixOS configuration. You can do this by editing your `configuration.nix` file located at `/etc/nixos/configuration.nix` and adding the overlay like this:
nixpkgs.overlays = [ (import (fetchTarball "https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz
Haskell Stake
"Stack is a program for developing Haskell projects. It is aimed at Haskellers both new and experienced. It is cross-platform and aims to support fully users on Linux, macOS and Windows."(https://docs.haskellstack.org/en/stable/)
1. Linux Installation Stake
curl -sSL https://get.haskellstack.org/ | sh or wget -qO- https://get.haskellstack.org/ | sh
2. Windows 64 Installation of Stake
https://get.haskellstack.org/stable/windows-x86_64-installer.exe
3. Mac OS Installation of Stake
curl -sSL https://get.haskellstack.org/ | sh or wget -qO- https://get.haskellstack.org/ | sh
Marlowe Installation
One great Cardano Smart Contract development tool is Marlowe. It is very consice and efficient and its playground is here -> https://play.marlowe.iohk.io/#/
In order to run and compile Marlowe locally then Coxygen will assist you do the installations below:

Install CABAL AND GHCup
Step 1: To use the GHCup installer to install GHC and Cabal, type:
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
Step 2: During installation, when prompted:
- Press ENTER to proceed.
- To prepend the required PATH variable to `$HOME/.bashrc`, type P.
- When prompted to create an initial `cabal.config`, type Y.
- When prompted to install haskell-language-server (HLS), type N.
- When prompted to install stack, type N.
- Press ENTER to proceed.
Step 3: When GHCup finishes installing GHC and Cabal, reload your shell profile, and then confirm that GHCup installed correctly:
ghcup --version
Step 4: Clone the Marlowe repository and execute cabal:
git clone https://github.com/input-output-hk/marlowe-cardano.git
cd marlowe-cardano
cabal install exe:marlowe-cli
Plu-ts
Installing plu-ts
Step 1 - Installing Node.js
1.1 Open your bash terminal and type:
sudo apt install node.js
1.2 Check if Node.js was installed successfully by typing the following command:
node -version
or
node -v
Step 2 - Install npm
Use the following command:
sudo apt install npm
2.1 Check if npm was installed successfully by typing the following command:
npm -version
or
npm -v
Step 3 - Alternative Installation Method for Node.js and npm
3.1 Install Node.js and npm: If you don't have Node.js and npm installed, you can install them using a Node version manager like nvmยน. Here are the commands to install nvm, Node.js, and npm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
source ~/.bashrc
nvm install node
The first command downloads and installs nvm, the second command updates your current shell session to include nvm, and the third command installs the latest version of Node.js (which includes npm).
3.2 Verify the Installation: After the installation, you can verify that Node.js and npm are installed correctly by again checking their versions:
node -v
npm -v
Step 4 - Add plu-ts as a Dependency
Use the following command:
npm install @harmoniclabs/plu-ts
Step 5 - Get plu-ts from Source
Use the following command:
git clone https://github.com/HarmonicLabs/plu-ts.git
5.1 Then run npm install to set up everything using the following command:
npm install
Step 6 - Build the Project
Finally, build the project using the following command:
npm run build
Mesh
One of the most easy Smart Contract Languages for React and Nextjs or typescript users is Mesh.

The setup for development environment is from Mesh website. Click the source link below.
Source: https://meshjs.dev/guides/nextjs
# System Setup
## 1. Visual Studio Code
Visual Studio Code is a code editor made by Microsoft. Download and install Visual Studio Code for code editing.
## 2. Node.js
Node.js is a cross-platform JavaScript runtime environment that runs on the V8 engine and executes JavaScript code. Install the Long-Term Support (LTS) version of Node.js (as of writing v16.16.0).
## Setup Next.js
### 1. Create Project Folder and Open Visual Studio Code
Create a new folder for your project, and give the folder a meaningful name. Open the Visual Studio Code application and drag your project folder into Visual Studio Code.
### 2. Create Next.js App
From the menu options in Visual Studio Code, open the Terminal and execute this command to create a new Next.js application:
```bash
npx create-next-app@latest --typescript .
3. Start Development Server
After the installation is complete, start the development server with:
npm run dev
Visit http://localhost:3000 to view your application. Press CTRL+C to stop the application.
Setup Mesh
1. Install MeshJS Package
Install the latest version of Mesh with npm:
npm install @meshsdk/core @meshsdk/react
2. Add Webpack in next.config.js
Open next.config.js and append webpack configurations. Your next.config.js should look like this:
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
webpack: function (config, options) {
config.experiments = {
asyncWebAssembly: true,
layers: true,
};
return config;
},
};
module.exports = nextConfig;
In the more recent Next version, configuration for next.config.mjs:
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
webpack: function (config, options) {
config.experiments = {
asyncWebAssembly: true,
layers: true,
};
return config;
},
};
export default nextConfig;
3. Congratulations
You just saved a few weeks of learning and a number of days trying to get started. Your Next.js application is ready to connect wallet, browse assets, and make some transactions.
Helios
"Helios is a Javascript/Typescript SDK for the Cardano blockchain. Helios is all you need to build dApps on Cardano, including a simple smart contract language: the Helios language."[source]https://www.hyperion-bt.org/helios-book/intro.html
Installation of the Helios development environment is simple. You need Nodejs, npm, git installed on your computer/laptop.
One can simple write the Smart Contract on the playground. The link is below: https://www.hyperion-bt.org/helios-playground/
1. Installation of Nodejs
Click the link https://nodejs.org/en/download. Download the installer according to our operating system. Nodejs installation comes with npm, a tool for managing dependecies.
2. Installation of Git
2.1 Linux
Use the terminal and run the command on Fedora (or any closely-related RPM-based distribution, such as RHEL or CentOS)
- $ sudo dnf install git-all Debian-based distribution, such as Ubuntu, try apt:
- $ sudo apt install git-all
2.2 macOS
Install the Xcode Command Line Tools and test by checking the version using this command.
$ git --version
Follow the wizard to install the git on macOS.
2.3 Windows
To install git on windows, go to the link below
https://git-scm.com/download/win Select 32bit or 64bit and download
3. Installation of VSCode
VSCode is the most used text editor on typescript development. To install the vscode go to this link
3.1 Debian and Ubuntu
Download and install the .deb package (64-bit) using command below
sudo apt install ./
If you're on an older Linux distribution, you will need to run this instead:
sudo dpkg -i
.deb sudo apt-get install -f For manual installations use commands below
sudo apt-get install wget gpg
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" |sudo tee /etc/apt/sources.list.d/vscode.list > /dev/null
rm -f packages.microsoft.gpg
sudo apt install apt-transport-https
sudo apt update
sudo apt install code # or code-insiders
You will to update the package cache and install the package using dnf (Fedora 22 and above) using commands below:
dnf check-update
sudo dnf install code # or code-insiders
For old versions use this command
yum check-update
sudo yum install code # or code-insiders
In linux you can also use Snap
sudo snap install --classic code # or code-insiders
For openSUSE and SLE-based distributions
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ntype=rpm-md\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" |sudo tee /etc/zypp/repos.d/vscode.repo > /dev/null
After running the above update and install
sudo zypper refresh
sudo zypper install code
Lucid
In this page you will learn how to install Lucid. Head over to this link https://www.npmjs.com/package/lucid-cardano
## 1. NPM
To install `lucid-cardano`, use the following command:
```bash
npm install lucid-cardano
2. Deno
For JavaScript and TypeScript, you can import Lucid from Deno:
import { Lucid } from "https://deno.land/x/lucid@0.10.7/mod.ts";
3. Web
In a web environment, you can import Lucid using a script tag:
<script type="module">
import { Lucid } from "https://unpkg.com/lucid-cardano@0.10.7/web/mod.js"
// ...
</script>
4. Build from Source
To build both the NPM and Web targets, run the following command:
deno task build
This command outputs a dist folder.
Aiken
In this page you will learn how to get Aiken development environment up and running. You can go straight to the official documentation https://aiken-lang.org/installation-instructions if need be.
1. Linux & MacOS
You can use a tool called aikup
curl -sSfL https://install.aiken-lang.org | bash
after running above curl then run code below
aikup
or use another tool called Nix flakes
nix build github:aiken-lang/aiken#aiken
2. All platforms
cargo install aiken --version 1.0.26-alpha
Linux Ubuntu 20 Installation
Computer Specifications:
- 2 GHz dual-core processor or better.
- 4 GB system memory.
- 25 GB of free hard drive space.
1. Download the ISO File
Download the ISO file using the following link:
[Ubuntu Download Page](https://ubuntu.com/#download)
2. Download Etcher/Rufus (for Windows Users Only)
Download either Etcher or Rufus to create a bootable USB drive:
- [Etcher](https://etcher.balena.io/)
- [Rufus](https://rufus.ie/en/)
3. Creating a Bootable USB using Etcher
After installing Etcher, open it and connect a USB drive.
!!!NB - Make sure the USB drive is formatted and has at least 8 GB storage space !!!
3.1 Next, click "Flash from file" on the Etcher window and select the ISO image downloaded in step 1.
3.2 Next, click "Select target" and choose the USB drive inserted into the computer.
3.3 Finally, click on the flash button and wait for a few minutes to complete the burning process.
4. Creating a Bootable USB using Rufus
After installing Rufus, open it and connect a USB drive.
4.1 The drive will automatically be identified by Rufus, tap on the device and select your USB to boot.
4.2 NB!! Make sure the boot selection is set to disk or ISO image. A file explorer will be open, then select the ISO image downloaded in step 1.
4.3 Click on the start button to create the bootable disk.
5. The Installing Process
Restart the computer then click on your specific computer/laptop's boot menu key (e.g., F12, F11, Esc, and Del).
5.1 Once in the BIOS, select the bootable disk with the ISO image.
5.2 After selecting the bootable USB, you should be redirected to the Ubuntu OS in the USB.
5.3 Click on "Install Ubuntu" and then choose the language you are comfortable with.
5.4 On the next window, click "Normal installation, download updates while installing Ubuntu, and install third-party software" then click on "Continue."
5.5 On the "Installation type" window, click on "Erase disk and install Ubuntu" then click on "Install now."
5.6 A "Write the changes on disk" window will appear, click on "Continue."
5.7 Click or search your location on the next window and then click "Continue."
5.8 On the "Who are you?" screen, fill in your relevant personal details then click "Continue." You can also select the login method you want on this window.
5.9 After clicking "Continue," Ubuntu will start to install.
5.10 After installing, click on "Restart" and remove the bootable disk.
5.11 The computer will then restart, and Ubuntu will be fully installed.
Follow the wizard to install the git on macOS.