Skip to content

Instantly share code, notes, and snippets.

View johnshearing's full-sized avatar

John Shearing johnshearing

View GitHub Profile
@johnshearing
johnshearing / setting_up_cip30_example.md
Created June 10, 2023 23:20
Starting Marlowe CIP-30 Example Smart Contract

Assuming Nami wallet is installed in the web browser. Assuming Nami is connected to an address with at least 100 ada on the Cardano preproduction network. Assuming the example code is already installed:

Open a Linux command line terminal session on your computer.

Change to the following directory: Your path will be differnt of course. /home/user/marlowe-starter-kit/06-cip30

From the Ubuntu command line, remove the any previous PPP lesson materials or in the alternative just create a new clean directory.
Then delete all containers inside the Docker Desktop or just leave them alone if you wish to use previous installations also.
Then reboot computer.
Docker Desktop should restart automatically.
Sync your fork of the Plutus Pioneers Program repository.
From the Ubuntu command line, clone the synced fork into your Ubuntu environment.
From the Ubuntu command line cd to the newly cloned plutus-pioneers-program directory.
Then type code . to open VS Code.
Then a dialog will ask if you want to reopen the project from within Docker. Say yes.
Register port 8000 using the Port menu item next to the Terminal menu item.
The following is the terminal window history of inputs and outputs for lesson 5 of Marlowe Pioneers.
The lesson is found at the following URL:
https://github.com/input-output-hk/marlowe-cardano/blob/73ed922f025e494d0060e21cfba4a340b70d12e0/marlowe-cli/lectures/05-marlowe-cli-pab.ipynb
[nix-shell:~/marlowe-cardano]$ export CARDANO_NODE_SOCKET_PATH=/tmp/node.socket
[nix-shell:~/marlowe-cardano]$ export CARDANO_TESTNET_MAGIC=1567
[nix-shell:~/marlowe-cardano]$ marlowe-cli --version
marlowe-cli 0.0.5.0
[nix-shell:~/marlowe-cardano]$ cardano-cli --version
cardano-cli 1.34.1 - linux-x86_64 - ghc-8.10
git rev 0000000000000000000000000000000000000000
[nix-shell:~/marlowe-cardano]$ cardano-wallet version
v2022-01-18 (git revision: 0000000000000000000000000000000000000000)
There was an error at block ten of Lesson 4
https://github.com/input-output-hk/marlowe-cardano/blob/73ed922f025e494d0060e21cfba4a340b70d12e0/marlowe-cli/lectures/04-marlowe-cli-concrete.ipynb
This is the History of input and output at the Linux terminal.
The error message is shown at the very bottom.
C:\Users\jshea>wsl
johnshearing@LAPTOP-NGQPLDGT:/mnt/c/Users/jshea$ cd ~

Marlowe Pioneers:

Setting Up A Cardano Development Environment On a Windows 10 Computer

I made this tutorial so that I can remember how to set up my Cardano development environment if I ever have to do it again. Much thanks to all the community members that helped me through the process.
I hope others may find this useful.

Tutorial showing how to:

  • Setup a Linux environment on Windows 10 using Windows Subsystem for Linux (WSL)
  • Setup VS Code for use with WSL
{-# LANGUAGE OverloadedStrings #-}
module Example where
import Language.Marlowe.Extended
-- Simulates an auto loan for a used car with compound interest. Native token represents title for the car.
-- Input loan amount. We imagine the car costs 5000 ADA
loan_amount_in_ADA = 5000 :: Double
{-# LANGUAGE OverloadedStrings #-}
module Example where
import Language.Marlowe.Extended
-- Input loan amount
loan_amount_in_ADA = 353.3 :: Double
-- Input number of payments
number_of_payments = 4 :: Integer
Let
"LoanAmount"
(Constant 200000000)
(Let
"PaymentAmount"
(Constant 100000000)
(Let
"NumberOfPayments"
(DivValue
(ConstantParam "LoanAmount")
Seems we need to load an example in the playground before we can paste in a project of our own over the top of text which is there already.
I don't know why
Constant parameters show up in the Marlow Playground simulator as variables before actually running the contract.
This might be misleading.
Contract does respect the constants when running the contract.
It might be nice to have a powers function in the variables.
For the bank loan homework from lesson 4 it might be nice if an NFT can be delivered by the bank to reprsent the property received by the borrower after paying off the loan.