Skip to main content

Python library for VIZ blockchain

Project description

Python Library for VIZ

Tests Status Documentation Status

Usage examples

Award someone:

from viz import Client

node = "wss://node.viz.cx/ws"
viz = Client(node=node, keys=["5...your_private_regular_key..."])

initiator = "your_account"
percent = 10.5
viz.award("id", percent, "with love", None, initiator)

Award someone with fixed reward:

from viz import Client

node = "wss://node.viz.cx/ws"
viz = Client(node=node, keys=["5...your_private_regular_key..."])

initiator = "your_account"
reward_amount = 3.5 # "3.50 VIZ"
max_energy = 30 # 30%
viz.fixed_award("id", reward_amount, max_energy, "with fixed reward", None, initiator)

Send a custom operation:

from viz import Client

node = "wss://node.viz.cx/ws"
viz = Client(node=node, keys=["5...your_private_regular_key..."])

account = "your_account"
protocol = "color.place"
json = {"x":35, "y":70, "color":"#e50000"}
viz.custom(protocol, json, None, [account])

Get account with custom protocol latest block:

from viz import Client
from viz.account import Account
from viz.block import Block
from viz.instance import set_shared_blockchain_instance

viz = Client('wss://node.viz.cx/ws')
set_shared_blockchain_instance(viz)

protocol = "V"
account = Account('id', viz, protocol)
counter_inside_protocol = account["custom_sequence"]
last_used_in_block = account["custom_sequence_block_num"]
block = Block(last_used_in_block)

Any direct RPC call:

from viz import Client

viz = Client('wss://node.viz.cx/ws')
viz.rpc.get_dynamic_global_properties()

Installation

Current published version could be installed via

pip install viz-python-lib

Manual installation:

Install poetry

cd viz-python-lib/
poetry install

Development

Dependencies

Linux dependencies

sudo apt-get install libffi-dev libssl-dev python-dev

Windows dependencies

Install regular version of OpenSSL (not Light) suitable for your core processor.

MacOS dependencies

Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries. This means that you will need to install and export some OpenSSL settings yourself, before you can install viz-python-lib:

brew install openssl

and then use the following commands:

export CFLAGS="-I$(brew --prefix openssl)/include"
export LDFLAGS="-L$(brew --prefix openssl)/lib"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

viz_python_lib-1.1.0.tar.gz (30.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

viz_python_lib-1.1.0-py3-none-any.whl (37.6 kB view details)

Uploaded Python 3

File details

Details for the file viz_python_lib-1.1.0.tar.gz.

File metadata

  • Download URL: viz_python_lib-1.1.0.tar.gz
  • Upload date:
  • Size: 30.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for viz_python_lib-1.1.0.tar.gz
Algorithm Hash digest
SHA256 6edf9127979fc59533acca2148a0012203547ccaeea9cd8ed1c28ea4b4d47918
MD5 95902e35fbbbf539253fbcc750f18a9c
BLAKE2b-256 50d2f7d0a01fb3b5607dc549c7a0e17056fc88c258d17387e1d95e986b111c72

See more details on using hashes here.

File details

Details for the file viz_python_lib-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: viz_python_lib-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 37.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for viz_python_lib-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6ed9f6b5f785456135a3e62d9e50fc23334baccc971ba497c17f37fe9986ca63
MD5 fcd59a216a8d52e5353b972279948d77
BLAKE2b-256 02f2a0c134cbde82d769e4e0df8e7335232fb0a4f76a375e3d51d58e66cc3447

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page