Skip to main content

substrate-utils

Substrate utility library providing functionality for exchange management and multi-signature trading, originally built for LocalCoinSwap

Python package PyPI pyversions PyPI version shields.io

The focus of this library is on functionality needed to provide an exchange service, including:

  • Account generation
  • Balance checking
  • Making transfers
  • Creating N/M (2/3) escrow addresses
  • Non-custodial trades
  • Cancellation of trades
  • Administration of trade disputes
  • Verification of transactions
  • Diagnostics for common problems
  • Associated cryptography

For complete examples please review the documentation. If there's any exchange functionality you need which we haven't provided, feel free to raise an issue in Github.


Installation

pip install substrate-utils

Quick start

from substrateutils import Kusama, Polkadot, Kulupu
kusama = Kusama()
polkadot = Polkadot()
kulupu = Kulupu()

Documentation

https://localcoinswap.github.io/substrate-utils/

Local development

Pre-requisites

  • Python 3.8.1 (preferred)

We suggest using pyenv to easily manage python versions. Some of the following commands use pyenv. Use pyenv-installer for easy installation. Then add pyenv-virtualenv plugin to it.

Configure local development setup

  • Install and activate python 3.8.1 in the root directory

    • pyenv install 3.8.1
    • pyenv virtualenv 3.8.1 substrateutils
    • pyenv local substrateutils
  • Install project requirements

    • pip install -r requirements.txt
  • Install precommit hook

    • pre-commit install

You're all set to hack!

Before making changes, let's ensure tests run successfully on local.

Running Tests

  • Run all tests with coverage
    • coverage run -m pytest -v
  • Show report in terminal
    • coverage report -m

Notes

Trade storage calls for 2/3 trades cost:

Polkadot - 40.3040 DOT  
Kusama   - 6.71733331304 KSM  

Metadata

Release files for substrate-utils 1.0.24

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for substrate-utils 1.0.24
File Size Uploaded
substrate-utils-1.0.24.tar.gz 24.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for substrate-utils 1.0.24
File Interpreter ABI Platform
substrate_utils-1.0.24-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 49.6 kB

Release files / substrate-utils-1.0.24.tar.gz

Download URL substrate-utils-1.0.24.tar.gz
Size 24.6 kB
Tags Source
SHA-256 checksum
How to use checksums
cf5c04f677885fb3e89a5077cadcdc83fa652d8a74232bfcd22cbce942d5b751
BLAKE2b-256 checksum
How to use checksums
8c7991a088f4aec0b748f1cf37f31f5f0775ee1760974f74b71ac7084c981445
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.1

Release files / substrate_utils-1.0.24-py2.py3-none-any.whl

Download URL substrate_utils-1.0.24-py2.py3-none-any.whl
Size 25.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
be3f2cd5dbf71b3b5f946444359c686ba780e7b9379e02ca5fbb7358409b5a3d
BLAKE2b-256 checksum
How to use checksums
0b633cbd64e0e19a763f79c244b74c9fcf36410f538744d11476aaa747923df4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.1

Release history Release notifications | RSS feed

This release

1.0.24 This release

2 release files

1.0.23

2 release files

1.0.22

2 release files

1.0.20

2 release files

1.0.19

2 release files

1.0.18

2 release files

1.0.17

2 release files

1.0.16

2 release files

1.0.15

2 release files

1.0.14

2 release files

1.0.11

2 release files

1.0.0

2 release files

0.2.43

2 release files

0.2.42

2 release files

0.2.41

2 release files

0.2.30

2 release files

0.2.27

2 release files

0.2.26

2 release files

0.2.25

2 release files

0.2.24

2 release files

0.2.23

2 release files

0.2.19

2 release files

0.2.18

2 release files

0.2.17

2 release files

0.2.15

2 release files

0.2.11

2 release files

0.2.9

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.11

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page