Skip to content

Instantly share code, notes, and snippets.

@connorjcantrell
Last active February 10, 2022 16:51
Show Gist options
  • Save connorjcantrell/2b29eb84a97ea4da9d854b359852c884 to your computer and use it in GitHub Desktop.
Save connorjcantrell/2b29eb84a97ea4da9d854b359852c884 to your computer and use it in GitHub Desktop.
I envision Dappman being a convenient tool for rapidly managing Algorand applications. This is achieved by locally storing application details, algod credentials, and public/private keys and perhaps more

Dappman

Decentralized Application Manager for the Algorand Blockchain

Dappman is a Golang CLI toolkit for compiling, deploying, and managing Algorand applications. It is a thin wrapper built on top of goal app

Fetch from GitHub

Clone Dappman in a directory outside of GOPATH, as in the following example:

mkdir $HOME/src
cd $HOME/src
git clone https://github.com/connorjcantrell/dappman.git
cd dappman
go install

Create Environment Variables

  • ALGORAND_PASSPHRASE
  • ALGOD_ADDRESS
  • ALGOD_TOKEN

Initialize

Initialize dappman inside of your project directory:

dappman init --name my-app --global-byteslices 0 -global-ints 0 --local-byteslices 0 --local-ints 0 --pyteal

or use the shorthand, dappman init 0 0 0 0 --pyteal

This will generate the following project structure:

project
│   .config.json
│
└───public
│   
└───src
    │   approval_program.py
    │   clear_state_program.py

.config.json is a local representation of the application details that exist on the Algorand Blockchain. This file will be referenced/ modified during create, update and delete commands. Application ID is initially set to 0 to signify the app has not yet been created.

Do not manually modify .config.json

.config.json example

{
    "name": "my-app",
    "application_id": 0,
    "global_schema": {
        "byteslices": 0,
        "ints": 0
    },
    "local_schema": {
        "byteslices": 0,
        "ints": 0
    },
    "revision": 0,
    "deleted": 0
}

Compile

dappman compile pyteal
  1. Searches for approval_program.py and clear_state_program.py in /src directory
  2. Compiles PyTeal down to TEAL, writes TEAL programs to /public directory
project
│   .config.json
│
└───public
│   │   approval_program.teal
│   │   clear_state_program.teal
│
└───src
    │   approval_program.py
    │   clear_state_program.py

Create

Issue a transaction that creates an application using values provided in .config.json and reading teal programs located inside /public directory.

dappman create --name my-app

.config.json modifications

application_id will be changed from 0 revision will be increased by 1

Update

Issue a transaction that updates an application's ApprovalProgram and ClearStateProgram by reading teal programs located in /public directory.

dappman update --name my-app

.config.json modifications

revision will be increased by 1

Delete

dappman delete --name my-app

.config.json modifications

deleted changed to true

Reset

Erase current local application state and re-initialize, thus abondoning the application that exists on chain.

dappman reset --name my-app
@connorjcantrell
Copy link
Author

connorjcantrell commented Feb 9, 2022

Please feel free to share your thoughts on this idea and whether or not the Algorand development community would find this tool useful.

One area of concern is storing the secret passphrase in an environment variable. I am open for suggestions in this area specifically. Perhaps there is a way to sign transactions securely via a command line interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment