Skip to main content

ergo-python-appkit

This is a wrapper around Ergo's appkit, which is based on scala/java. Jpype is used to map to the JVM and the jar running within. That means that Java needs to be installed for this package to work.

Installation

Installation can be done through pip. Currently the package is not available yet on PyPi so you need to refer directly to the github.

pip install git+https://github.com/ergo-pad/ergo-python-appkit.git

Usage

The ergo appkit can be accessed by importing java classes AFTER importing the appkit, like this:

import ergo_python_appkit.appkit
from org.ergoplatform.appkit import Address

myErgoAddress = Address.create("9gF2wmTWcEX2EZu5QY3dJwURep1HWsXjUZdVavVWESun4Sp8BYj")
#will print the ergotree belonging to the address
print(myErgoAddress.toErgoContract().getErgoTree())

There are also convenience methods created to allow for easier use from Python for appkit functionality that is used often.

An example of a simple intra wallet transaction send from the nodes wallet:

from ergo_python_appkit.appkit import ErgoAppKit
from org.ergoplatform.appkit import Address

appKit = ErgoAppKit("http://myergonode:9053","mainnet","http://api.ergoplatform.org","nodeapikey")
myAddress = "9gF2wmTWcEX2EZu5QY3dJwURep1HWsXjUZdVavVWESun4Sp8BYj"

#collect boxes to spend 1 erg
inputs = appKit.boxesToSpend(address=myAddress,nergToSpend=int(1e9))

#Define output box
outputBox = appKit.buildOutBox(
                value=int(1e9),
                tokens=None,
                registers=None,
                contract=appKit.contractFromAddress(myAddress)
            )

#Build the unsigned transaction
unsignedTx = appKit.buildUnsignedTransaction(
                inputs=inputs,
                outputs=[outputBox],
                fee=int(1e6),
                sendChangeTo=Address.create(myAddress).getErgoAddress()
            )

#Sign the transaction with the node
signedTx = appKit.signTransactionWithNode(unsignedTx)

#Send the transaction
appKit.sendTransaction(signedTx)

Metadata

Release files for ergo-python-appkit 0.3.2

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

Source distribution (sdist)

Source distribution for ergo-python-appkit 0.3.2
File Size Uploaded
ergo_python_appkit-0.3.2.tar.gz 51.5 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for ergo-python-appkit 0.3.2
File Interpreter ABI Platform
ergo_python_appkit-0.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 103.2 MB

Release files / ergo_python_appkit-0.3.2.tar.gz

Download URL ergo_python_appkit-0.3.2.tar.gz
Size 51.5 MB
Tags Source
SHA-256 checksum
How to use checksums
88dd78133dee857f5dd440309465cf5d5cc7430f8231e978f3fab617e1fa6fae
BLAKE2b-256 checksum
How to use checksums
34f2ab3d11898bbf3cd151a953e88c76e6407e0ba726e72f416efe97cfd5800b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.6

Release files / ergo_python_appkit-0.3.2-py3-none-any.whl

Download URL ergo_python_appkit-0.3.2-py3-none-any.whl
Size 51.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
9dc8e6c82c2e3207993bd5a82c2072f4c46e039161dae7ceeee8422d75dba1a9
BLAKE2b-256 checksum
How to use checksums
155a840985fae1f3aad07c5c37fc027a11ad6ef3a1d9ac36866535d024755841
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.6

Release history Release notifications | RSS feed

This release

0.3.2 This release

2 release files

0.3.1

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

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