pyvsystems
DEPRECATED. Please use the new Python SDK py-vsys instead.
A python wrapper for vsys api.
For more detail, please refer:
PYVSYSTEMS User Guide Specification (English)
Install
Library can be pulled via pip directly:
git+https://github.com/virtualeconomy/pyvsystems.git
Or:
- clone the repo under you workspace
git clone https://github.com/virtualeconomy/pyvsystems.git - install the package
pip3 install pyvsystems/. - Then you can
import pyvsystemsin your workspace
Usage
chain object
-
For testnet:
import pyvsystems as pv ts_chain = pv.testnet_chain()
-
For default chain:
import pyvsystems as pv main_chain = pv.default_chain()
-
For custom api node:
import pyvsystems as pv # you can set the request timeout custom_wrapper = pv.create_api_wrapper('http://<full node ip>:9922', api_key='', timeout=None) ts_chain = pv.testnet_chain(custom_wrapper)
-
For completely custom chain:
import pyvsystems as pv custom_wrapper = pv.create_api_wrapper('http://<full node ip>:9922', api_key='', timeout=None)) t_chain = pv.Chain(chain_name='testnet', chain_id='T', address_version=5, api_wrapper=custom_wrapper) custom_wrapper2 = pv.create_api_wrapper('http://<full node ip>:9922', api_key='', timeout=None)) m_chain = pv.Chain(chain_name='mainnet', chain_id='M', address_version=5, api_wrapper=custom_wrapper2) custom_wrapper3 = pv.create_api_wrapper('http://<full node ip>:9922', api_key='', timeout=None)) c_chain = pv.Chain(chain_name='mychain', chain_id='C', address_version=1, api_wrapper=custom_wrapper3)
chain api list
-
look up current block height of the chain:
ts_chain.height()
-
look up the last block info of the chain:
ts_chain.lastblock()
-
look up a block info at n in the chain:
ts_chain.block(n)
-
Get a transaction info by transacion id in the chain:
ts_chain.tx(tx_id)
-
Validate an address of the chain:
ts_chain.validate_address(addr)
address object
- constructed by seed
from pyvsystems import Account my_address = Account(chain=ts_chain, seed='<your seed>', nonce=0)
- constructed by private key
from pyvsystems import Account my_address = Account(chain=ts_chain, private_key='<your base58 private key>')
- constructed by public key
from pyvsystems import Account recipient = Account(chain=ts_chain, public_key='<base58 public key>')
- constructed by wallet address
from pyvsystems import Account recipient = Account(chain=ts_chain, address='<base58 wallet address>')
address api list
- Get balance
# get balance balance = my_address.balance() print("The balance is {}".format(balance)) # get balance after 16 confirmations balance = my_address.balance(confirmations = 16) print("The balance is {}".format(balance))
- Send payment transaction
# send payment (100000000 = 1 VSYS) my_address.send_payment(recipient, amount=100000000)
- Send and cancel lease transaction
# send lease (100000000 = 1 VSYS) response = my_address.lease(recipient, amount=100000000) tx_id = response["id"] # cancel lease my_address.lease_cancel(tx_id)
Sample code for Send Transaction for reference
Sample Code for Exchange for reference
Sample Code for Non Fungible Token Contract for reference
Sample Code for Payment Channel Contract for reference
Sample Code for System Contract for reference
Sample Code for Token Contract for reference
Metadata
Release files for pyvsystems 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyvsystems-0.4.0.tar.gz | 33.1 kB | Without provenance | Details for pyvsystems-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyvsystems-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for pyvsystems-0.4.0-py3-none-any.whl |
Total release size: 65.4 kB
Release files / pyvsystems-0.4.0.tar.gz
| Download URL | pyvsystems-0.4.0.tar.gz |
|---|---|
| Size | 33.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
91beefbd6cfa2d1dc58bba892ae904d357f6982bec720e4dc05e83b6520c2db2
|
|
BLAKE2b-256 checksum How to use checksums |
56f1c1e32c420e60cbd4709a51d35f90bcf2c31f11bae77d9550e4c8be26e97b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.10.11
|
Release files / pyvsystems-0.4.0-py3-none-any.whl
| Download URL | pyvsystems-0.4.0-py3-none-any.whl |
|---|---|
| Size | 32.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
43d95e30dccfe21a9915d569cd198f3a195b40a322ad9b0cca7fb581aae13ef2
|
|
BLAKE2b-256 checksum How to use checksums |
12d8db61ef9867d8779c3b0bc09a0d5684570fca61b2ac794d435c1e8d2ffe69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.10.11
|
Security for pyvsystems 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.