Continuing our posts for developers, we’d like to introduce you to our tools available to Python developers: our Python SDK and command line tool.
Cloning the SDK to Your Local Machine
To install the SDK on your local machine first make a folder and clone the SDK repo into the folder using the command below:
git clone https://github.com/aeternity/aepp-sdk-python.git
Python Virtual Environments and Packages
The SDK requires Python3. We recommend using Python virtual environments (venv) to handle the Python requirements needed to run the SDK. You can learn more about virtual environments here.
To create a virtual environment use the command below:
python3 -m venv venv
To activate the environment use this command:
source venv/bin/activate
To install the dependencies required to run the SDK run the following command (inside the folder where you cloned the SDK repository):
pip install -r requirements.txt
In the future, when you return to the project you created, don’t forget to run “source venv/bin/activate” again.
Making an Account Via the Command Line Client
Once you have the SDK running you will probably want to make an account (a key pair) and fill up your account with some Testnet tokens from our Token Faucet.
You can create a wallet using our command line tool, like so:
./aecli wallet "*wallet-path-and-name*" create
Where *wallet-path-and-name* is a path and wallet name like “/Users/some-user/projects/aeternity/aepp-sdk-python/wallet-name”
When the wallet is successfully created you will see its address in the print output, like so:
Wallet created
Wallet address________________ ak$2WZwyV3tJWQWd62FAtjKszmZS5oJU3cRHLGdH46KpNU99EVYCq
Getting Tokens
You need the address of your account/wallet to receive Testnet tokens.
To receive tokens, go to https://faucet.aepps.com, paste your address in the input field, and click “Top up!” Once the tokens have been added to your account you can check your account balance using this command (where *wallet-path-and-name* is a path and wallet name like “/Users/some-user/projects/aeternity/aepp-sdk-python/wallet-name”):
./aecli wallet "*wallet-path-and-name*" balance
After you input the command above and enter your account password you will see the available token balance on your screen!
Using the SDK
Incorporating the SDK Into Your Project
To incorporate the SDK into your project code you simply need to import the SDK modules, which you will be using, in your .py files, like so:
from aeternity.epoch import EpochClient
from aeternity.config import Config
Code Examples
In our Python SDK tutorial on dev.aepps.com we have provided code examples for: a simple spend transaction, using the naming system, Oracle operator and Oracle client. You can review or download the code examples here.
Community Tutorials!
We welcome and encourage community members writing developer tutorials like the one above! The æternity forum user imae.one already wrote a tutorial very similar to this one and posted it in the Forum. If you would like to write a tutorial on a dev tools topic of your choice, feel free to contact us stoyan@aeternity.com, with a proposal for a topic (or topics), which you would like to cover. You will be rewarded 🙂
The Future
Up to now we’ve been working on developing the best possible interface for æternity. We’re almost at the point of supporting all of the features of the blockchain, so now we’re going to work on improving the SDK. Ideas that we’re planning for the future include: setting the number of blocks to wait before returning, so as to confirm that the transactions are permanently written to the chain, integration with popular IDEs, better examples and more. If you have feedback on what we should do to improve the SDKs, please email us at aepp-dev@aeternity.com and let us know.
Interested in æternity? Get in touch:
GitHub | Forum | Reddit | Telegram | Twitter | Facebook | Mail
No Comments.