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.
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
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
Copy the .env.example
into .env
On constants.py
set the correct account to use from assets
.
Use goal in order to create wallet and manage accounts.
Wallet:
goal wallet new
Create a new walletgoal wallet new
List wallets managed by kmd
Account:
goal account list
Show the list of Algorand accounts on this machinegoal account new
Create a new accountgoal account -f [name]
Set the account with this name to be the default accountgoal account info -a [address]
Retrieve information about the assets and applications belonging to the specified accountgoal account import -m [menmonic]
Import an existing accountgoal account export -a [address]
Export an account key for use with account importgoal account delete -a [address]
Delete an account
App:
goal goal app info --app-id [id]
Look up current parameters for an applicationgoal goal app clear --app-id [id] -f [account]
Clear out an application's state in your accountgoal goal app delete --app-id [id]
Delete an application
Logging
goal logging enable -n [nodeName]
Enable Algorand remote logginggoal logging disable -n [nodeName]
Disable Algorand remote logging
Follow this guide to fund a test account before perform transactions.
- Algorand Testnet Dispenser: fund test account
- AlgoExplorer: search for transactions (set on testnet)
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.