Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
All these experiments and examples are expected to be tried out in ipython command shell. Start the command shell with ipython
Node is the chain with which you wish to interact.
password = "password"
from peerplays import PeerPlays
To create a new wallet
p.newWallet(password)
Unlock the wallet
p.unlock(password)
Add private key / keys
p.wallet.addPrivateKey("5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3")
p.wallet.unlocked() #returns True if wallet is unlocked. Wallet needs to be unlocked to perform operations on the blockchain.
p.wallet.getAccounts() #Lists all the accounts associated with the private key.
vThere are two ways to create an account.
Python-Peerplays way: If you already have an account, that can be used to create another account.
Faucet Way
You need a funded account to create additional accounts. The funded account should be upgraded to create new accounts. To upgrade an account
Once the account is upgraded
p.create_account(account_name="new_account_name", registrar="the_upgraded_account", owner_key='TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV', active_key='TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV', memo_key='TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV')
url =
https://elizabeth-faucet.peerplays.download/api/v1/accounts
requests.post(url, json=params)
Introduction
Its the Python library for communicating with the Peerplays blockchain.
The code is maintained at https://gitlab.com/PBSA/PeerplaysIO/tools-libs/python-peerplays
1.2.x : accounts
1.3.x : assets
p.rpc.get_account_balances("jemshid", [])
p.rpc.get_global_properties
private-key = ["TEST6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"]
The python-peerplays library has following dependencies. Make sure that the above dependencies are installed, if not install with:
Now install python-peerplays as follows:
Ipython is a rich interactive python command shell. It's recommended for trying out python-peerplays library. It can be installed with
pip install ipython
In case Python 2.7 is the default Python for your machine, repalce
pip with pip3
python with python3
ipython with ipython3
Ipython shell can be started with the command
ipython
To work with the latest development version of python-peerplays
git clone git@gitlab.com:PBSA/PeerplaysIO/tools-libs/python-peerplays.git
cd python-peerplays
git checkout develop
To Do
How to install system level from git for develop branch
Non Fungible Tokens
For example
For example
For example
For example
For example
For example
p.rpc.nft_get_balance(owner)
p.rpc.nft_owner_of(token_id)
p.rpc.nft_get_approved(token_id)
p.rpc.nft_is_approved_for_all(owner, operator)
p.rpc.nft_get_name(nft_metadata_id)
p.rpc.nft_get_symbol(nft_metadata_id)
p.rpc.nft_get_token_uri(token_id)
p.rpc.nft_get_total_supply(nft_metadata_id)
p.rpc.nft_token_by_index(nft_metadata_id, token_idx)
p.rpc.nft_token_of_owner_by_index(nft_metadata_id, owner, token_idx)
p.rpc.nft_get_all_tokens()
p.rpc.nft_get_tokens_by_owner(owner)
For examples, refer to tests/test_nft.py