• Stars
    star
    256
  • Rank 159,219 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created over 5 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Algorand Python SDK

py-algorand-sdk

PyPI version Documentation Status Code style: black

A python library for interacting with the Algorand network.

Installation

Run $ pip3 install py-algorand-sdk to install the package.

Alternatively, choose a distribution file, and run $ pip3 install [file name].

Supported Python versions

py-algorand-sdk's minimum Python version policy attempts to balance several constraints.

  • Make it easy for the community to use py-algorand-sdk by minimizing or excluding the need to customize Python installations.
  • Provide maintainers with access to newer language features that produce more robust software.

Given these constraints, the minimum Python version policy is: Target Python version on newest Ubuntu LTS released >= 6 months ago.

The rationale is:

  • If a major Linux OS distribution bumps a Python version, then it's sufficiently available to the community for us to upgrade.
  • The 6 month time buffer ensures we delay upgrades until the community starts using a recently released LTS version.

SDK Development

Install dependencies

  • pip3 install -r requirements.txt

Run tests

  • make docker-test

Set up the Algorand Sandbox based test-harness without running the tests

  • make harness

Format code

  • black .

Update algosdk/__init__.pyi which allows downstream developers importing algosdk and using VSCode's PyLance to have improved type analysis

  • make generate-init

Lint types

  • make mypy (or mypy algosdk)

Check all lints required by the C.I. process

  • make lint

Run non-test-harness related unit tests

  • make pytest-unit

We use cucumber testing for all of our SDKs, including this one. Please refer to algorand-sdk-testing for guidance and existing tests that you may need to update. Depending on the type of update you wish to contribute, you may also need to have corresponding updates in the other SDKs (Go, JS, and Java). Feel welcome to ask for collaboration on that front.

Quick start

Here's a simple example you can run without a node.

from algosdk import account, encoding

# generate an account
private_key, address = account.generate_account()
print("Private key:", private_key)
print("Address:", address)

# check if the address is valid
if encoding.is_valid_address(address):
    print("The address is valid!")
else:
    print("The address is invalid.")

Node setup

Follow the instructions in Algorand's developer resources to install a node on your computer. You can also set up a local Algorand Sandbox with make harness.

Running examples/example.py

Before running example.py, start kmd on a private network or testnet node:

./goal kmd start -d [data directory]

Next, create a wallet and an account:

./goal wallet new [wallet name] -d [data directory]
./goal account new -d [data directory] -w [wallet name]

Visit the Algorand dispenser and enter the account address to fund your account.

Next, in tokens.py, either update the tokens and addresses, or provide a path to the data directory. Alternatively, tokens.py also defaults to the sandbox harness configurations for algod and kmd, which can be brought up by running make harness.

You're now ready to run example.py!

Documentation

Documentation for the Python SDK is available at py-algorand-sdk.readthedocs.io.

License

py-algorand-sdk is licensed under an MIT license. See the LICENSE file for details.

More Repositories

1

go-algorand

Algorand's official implementation in Go.
Go
1,328
star
2

js-algorand-sdk

The official JavaScript SDK for Algorand.
TypeScript
280
star
3

pyteal

Algorand Smart Contracts in Python
Python
280
star
4

sandbox

Algorand node sandbox
Shell
235
star
5

go-algorand-sdk

Algorand Golang SDK
Go
184
star
6

indexer

searchable history and current state
Go
115
star
7

smart-contracts

Example stateful and stateless smart contracts.
JavaScript
69
star
8

java-algorand-sdk

Algorand SDK for Java7+ to interact with the Algorand network
Java
66
star
9

auction-demo

An example smart contract NFT auction on Algorand
Python
57
star
10

bls_sigs_ref

Algorand's reference implementation of bls signature scheme
Python
47
star
11

pointproofs

Rust
46
star
12

go-algorand-doc

Documentation for Algorand's Go implementation
Shell
39
star
13

conduit

Algorand's data pipeline framework.
Go
35
star
14

pyteal-utils

Python
29
star
15

node-ui

Terminal UI for remote Algorand node management.
Go
27
star
16

ledger-app-algorand

C
23
star
17

algorand-sdk-testing

Testing framework for Algorand SDKs
Gherkin
20
star
18

pairing-plus

This is a fork of pairing library with additional efficiency functionality improvement.
Rust
20
star
19

falcon

C
20
star
20

graviton

πŸ§‘β€πŸ”¬ verify your TEAL program by experiment and observation
Jupyter Notebook
18
star
21

pixel

Algorand's implementation of pixel consensus signature
Rust
18
star
22

vrf

Some tools for debugging/testing the VRF
C
13
star
23

tealviewer

JavaScript
11
star
24

reach-auction

Getting Started With Reach
JavaScript
11
star
25

mule

General automation framework
Python
11
star
26

msgp

Go
10
star
27

light-client-poc

Go
9
star
28

code-samples

Code samples tied to tutorials and solutions.
JavaScript
8
star
29

go-sumhash

Go
8
star
30

generator

OpenAPI parser/generator.
Java
7
star
31

symteal

Symteal is an automated verification framework for Algorand
Racket
6
star
32

go-stateproof-verification

Go
6
star
33

avm-abi

ARC-4 ABI Reference Implementation
Go
6
star
34

pointproofs-paramgen

Rust
5
star
35

pixel_param

A rust implementation for parameter generations of Pixel signature scheme
Rust
5
star
36

avm-debugger

Debug Adapter Protocol Debugger for the Algorand Virtual Machine
JavaScript
5
star
37

messagepack-debugger

Visually compare MessagePack objects to assist with debugging.
Kotlin
4
star
38

DerivhackExamples

Examples for the 2019 Derivhack Hackathon
Java
4
star
39

app-service

Java
4
star
40

graphtrace

System for tracing timing and propagation of messages across a mesh network
Go
4
star
41

wallet_addresses

Algorand Inc.'s Wallet Addresses: https://github.com/algorand/wallet_addresses
3
star
42

stateful-teal-auction-demo

A demo of an auction on stateful TEAL.
Shell
3
star
43

conduit-plugin-template

Get started with Algorand streaming APIs with Conduit plugin templates project.
Go
3
star
44

tealsign-demo

Shell
2
star
45

conduit-cockroachdb

Experimental CockroachDB exporter for Conduit.
Go
2
star
46

aardvark-prototype

Aardvark evaluation artifact
Go
2
star
47

tealfuzz

Go
2
star
48

sortition

C++
1
star
49

ledgerfuzz

C
1
star
50

Derivhack-Demo

1
star
51

walletconnect-automation

Automation for deploying walletconnect to eks
Shell
1
star
52

py-exebot

Bot for executing code off-chain.
1
star