Skip to content

livborre/escrow

Repository files navigation

Internal Blockchain Winter School 2022 - IT University of Copenhagen

Team ZTLment, Use Case Provided: here

Here you will find the code for an escrow smart contract on the Algorand blockchain. It's purpose is to tokenise carbon credits as NFTs, allow sellers of carbon credits to deposit their NFT carbon credits within the non-custodial escrow contract, and finally allow buyers to pay the contract in exchange for the NFT carbon credit.

Two people coded up this implementation in the space of two working days ready for a presentation at the Internal Blockchain Winter School 2022 in Copenhagen. The coders are Liv Hartoft Borre and Sasha Aldrick.

Example workflow

For Linux/Mac/WSL:

  • If you don't have Docker Desktop, install it from here.

  • Setup the sandbox (this starts an Algorand node to communicate with a local network, the testnet or the mainnet):

git clone https://github.com/algorand/sandbox
cd sandbox
./sandbox up testnet

    (This sandbox initial startup takes a while. You can proceed while you wait.)

  • In another terminal, clone this repository and move into the project:
cd <where-you-want-to-locate-the-project>
git clone https://github.com/livborre/escrow
cd escrow
  • Activate a new Python environment and install the project requirements:
python3 -m venv escrow_venv
source escrow_venv/bin/activate
pip3 install -r requirements.txt
  • Generate Algorand accounts (creator, seller and buyer), and store the details in a local .env file:
python generateAccounts.py
  • Remember to fund the testnet accounts, which can be done here!!!

  • Run the example.py file for a full example of deploying the contract, creating an NFT and trading it between the buyer and seller:

python example.py

Extras

  • We recommend using the 'Algosigner' Wallet Extension for Chrome/Brave: here
  • You can also use Algodesk to 'visually' see the NFTs in the seller account. Note that it will not appear in the buyer account using Algodesk, as it deals with created assets.

Have fun! :)

About

Selling and buying carbon credits (NFTs) on the Algorand blockchain

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages