Skip to content

Instantly share code, notes, and snippets.

View johnshearing's full-sized avatar

John Shearing johnshearing

View GitHub Profile

Everything about working with the Ethereum blockchain is found here at DecypherTV videos

These are notes for the second video

Install Node

Go to nodejs.org and install the latest version of Node.
This will also install NPM.

Install the following packages into the working directory.

Method 1

At the commandline cd into the working directory, type the following and hit enter for each command.

Everything about working with the Ethereum blockchain is found here at DecypherTV videos

These are notes for the fourth video

This video first shows how to make unsigned transactions by unlocking your account. Then a more secure method is shown for creating signed transactions in a secure local environment and then sending them to a test blockchain without ever having your account unlocked and without ever exposing your private key to the Internet.

Make a Local BlockChain

See my instructions for making a local blockchain and for setting up accounts. In the alternative you can use testrpc. If you are using a local block chain then you will need to create 4 accounts in order to experiment with the transactions in this exercise and you will need to mine some play ether into your first account to pay for your transactions. This is all covered at the link above.

Everything about working with the Ethereum blockchain is found here at DecypherTV videos

These are notes for the sixth video.

This video shows how to create signed transactions in a secure local environment and then send them to the public Ethereum blockchain without the need to run an Ethereum node or do any mining.

The biggest advantage to creating signed transactions is security. The idea is to create a signed transaction offline with an air-gapped computer. An air-gapped computer is a computer which is not connected to the Internet. This greatly reduces the chances that hackers can spook around your computer and find your private key.

Two methods are shown. One uses a service called INFURA and the other uses a service called BlockCypher.
We will be working with INFURA first.

Everything about working with the Ethereum blockchain is found here at DecypherTV videos

These are notes for the seventh video.

This video is an introduction to working with smart contracts from the NodeJS console.

The first part of these notes shows how to deploy a smart contract through a geth node running locally.
Geth unlocks an account in order to accomplish this.
These notes follow Jordan's video pretty closely except that a local blockchain is used instead of TestRPC.

The second part of these notes shows the use of Jordan's decypher command line utility to deploy a contract to the Public Ethereum Block chain using INFURA. Using this method it is necessary to provide the private key when logging into the decypher utility but the key is only used to sign transaction instructions before sending.

If
(ValueLE
(ConstantParam "DepositAmount")
(Constant 0)
)
Close
(Let
"Amount"
(ConstantParam "DepositAmount")
(When
If
(ValueLE
(ConstantParam "DepositAmount")
(Constant 0)
)
Close
(Let
"Amount"
(ConstantParam "DepositAmount")
(When
{"then":"close","if":{"value":0,"le_than":0},"else":{"then":{"when":[{"then":{"when":[{"then":{"token":{"token_name":"","currency_symbol":""},"to":{"party":{"role_token":"Receiver1"}},"then":{"token":{"token_name":"","currency_symbol":""},"to":{"party":{"role_token":"Receiver1"}},"then":"close","pay":{"use_value":"Amount"},"from_account":{"role_token":"Giver2"}},"pay":{"use_value":"Amount"},"from_account":{"role_token":"Giver1"}},"case":{"party":{"role_token":"Giver2"},"of_token":{"token_name":"","currency_symbol":""},"into_account":{"role_token":"Giver2"},"deposits":{"use_value":"Amount"}}}],"timeout_continuation":"close","timeout":1654723187480},"case":{"party":{"role_token":"Giver1"},"of_token":{"token_name":"","currency_symbol":""},"into_account":{"role_token":"Giver1"},"deposits":{"use_value":"Amount"}}},{"then":{"when":[{"then":{"token":{"token_name":"","currency_symbol":""},"to":{"party":{"role_token":"Receiver1"}},"then":{"token":{"token_name":"","currency_symbol":""},"to":{"party":{"role_token":"Rece
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.
Let
"LoanAmount"
(Constant 200000000)
(Let
"PaymentAmount"
(Constant 100000000)
(Let
"NumberOfPayments"
(DivValue
(ConstantParam "LoanAmount")
{-# 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