Skip to content

Smart Contract developed in PyTEAL, CLI application written in Python to build a dApp for carpooling with Algorand Blockchain

Notifications You must be signed in to change notification settings

bara96/algo-carsharing-python

Repository files navigation

Algorand Carsharing Python

Smart Contract developed in PyTeal to build a dApp for car sharing in Algorand Blockchain.
Linked to Algorand Carsharing Android project.

This is a project developed for my Master's Degree in Computer Science.
Feel free to read the thesis if you want to achieve a better knowledge on the work done.

Requirements

Sandbox environment

In order to deploy any transaction on Algorand Blockchain you need first to set up an Algorand node.
You can easily set up an Algorand sandbox node following the official guide or following this tutorial.

To start the Testnet sandbox:
./sandbox up testnet

On tesntet the indexer is not enabled, in order to use it you can switch on release sandbox: ./sandbox up release

Python environment and dependencies

Install the required dependencies for the project.
Using a Python virtual environment (venv) is recommended to do this.
The following commands will activate the virtual environment and then install all dependencies, including PyTeal and the Algorand Python SDK.

Setup Python environment (one time).
python3 -m venv venv

Activate venv. Replace bin with Scripts on Windows.
. venv/bin/activate

Make sure that you have pip installed. If not, you can install it like this:
sudo apt install python3-pip

Now install all requirements.
pip3 install -r requirements.txt

Env and Constants

Copy the .env.example into .env
On constants.py set the correct account to use from assets.

Account Management

Use goal in order to create wallet and manage accounts.

Useful commands

Wallet:

  • goal wallet new Create a new wallet
  • goal wallet new List wallets managed by kmd

Account:

  • goal account list Show the list of Algorand accounts on this machine
  • goal account new Create a new account
  • goal account -f [name] Set the account with this name to be the default account
  • goal account info -a [address] Retrieve information about the assets and applications belonging to the specified account
  • goal account import -m [menmonic] Import an existing account
  • goal account export -a [address] Export an account key for use with account import
  • goal account delete -a [address] Delete an account

App:

  • goal goal app info --app-id [id] Look up current parameters for an application
  • goal goal app clear --app-id [id] -f [account] Clear out an application's state in your account
  • goal goal app delete --app-id [id] Delete an application

Logging

  • goal logging enable -n [nodeName] Enable Algorand remote logging
  • goal logging disable -n [nodeName] Disable Algorand remote logging

Funding Account

Follow this guide to fund a test account before perform transactions.

Test Wallet

In order to test this application a local test Wallet is created with some funded account to use:

  • wallet name: carsharing-testnet
  • wallet password: carsharing

You can see the funded account on constants.py or into assets/accounts.xlsx.
Commands to create a wallet and import funded users are written on create_wallet.txt.

Note: this wallet is available only on sandbox mode with testnet configuration.

About

Smart Contract developed in PyTEAL, CLI application written in Python to build a dApp for carpooling with Algorand Blockchain

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published