Python Library for VIZ
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"
receiver = "id"
percent = 10.5 # 10.5%
viz.award(receiver, 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"
receiver = "id"
reward_amount = 3.5 # "3.50 VIZ"
max_energy = 30 # 30%
viz.fixed_award(receiver, 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"
required_regular_auths = [account]
protocol = "color.place"
custom_json = {"x": 35, "y": 70, "color": "#e50000"}
viz.custom(protocol, custom_json, None, required_regular_auths)
Prediction market operations (HF14 / Onix)
All 23 broadcastable pm_* operations are available as serializers in
vizbase.operations. Build the operation and sign it with finalizeOp (the
same low-level path the built-in helpers use), passing the authority the op
requires — active for most PM ops, regular for pm_dispute_vote:
from viz import Client
from vizbase import operations
node = "wss://node.viz.cx/ws"
viz = Client(node=node, keys=["5...your_private_active_key..."])
account = "your_account"
# Place a bet: binary market -> side 0/1, outcome_index -1; multi -> side -1, outcome_index 0..N-1
bet = operations.Pm_place_bet(
account=account,
market_id=42,
side=1,
outcome_index=-1,
amount="1.500 VIZ",
min_tokens=0, # slippage floor (0 = none)
mode=0, # 0 instant, 1 batch
)
viz.finalizeOp(bet, account, "active")
Chain governance uses the versioned variant: versioned_chain_properties_update
serializes variant 3 (chain_properties_hf9), 4 (chain_properties_hf13) or 5
(chain_properties_pm, the HF14 PM params) automatically from the fields you pass.
Agent keys (HF15)
An agent is a label plus a public key that may sign an explicit list of a principal's operations. It never appears in the account's authorities, so check "authority OR agent":
from viz import Client, agent
viz = Client(node="wss://node.viz.cx/ws")
result = agent.check("alice", "VIZ...public_key...", "transfer", blockchain_instance=viz)
# {"allowed": True, "source": "agent", "role": None, "agent": {...row...}, "operation": "transfer"}
# off-chain scope of your own service
row = agent.find("alice", "VIZ...public_key...", viz)
if row and agent.addon_matches(row, "my-service"):
...
Grant or revoke with operations.Set_agent_permission via finalizeOp(op, account, "active").
To broadcast as an agent, sign with the agent key directly: tx.appendWif(agent_wif).
Get data from custom protocol
from viz import Client
from viz.account import Account
from viz.block import Block
from viz.instance import set_shared_blockchain_instance
import json
viz = Client("wss://node.viz.cx/ws")
set_shared_blockchain_instance(viz)
account_name = "id"
protocol = "V"
account = Account(account_name, protocol=protocol)
counter_inside_protocol = account["custom_sequence"]
last_used_in_block = account["custom_sequence_block_num"]
block = Block(last_used_in_block)
for tx in block["transactions"]:
for op_type, op_data in tx["operations"]:
if op_type != "custom":
continue
if op_data.get("id") != protocol:
continue
if account_name not in op_data.get("required_regular_auths", []):
continue
raw_json = op_data.get("json")
try:
json_from_protocol = json.loads(raw_json) if raw_json else None
except json.JSONDecodeError:
json_from_protocol = None
print(json_from_protocol)
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 python3-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"
HF16 compatibility
The block stream reads the current block interval from the node, including the
3-second to 1-second HF16 transition. Block and header API responses retain QC,
timeout and equivocation extensions as JSON; this library does not serialize or
sign block headers. validator_equivocation is virtual operation 106.
committee_worker_create_request uses the existing transaction wire format.
From HF16 the node limits the maximum requested amount to 1% of current_supply
at creation (rounded down to the smallest VIZ unit), rather than a fixed 500,000 VIZ.
Metadata
Release files for viz-python-lib 1.4.2
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 |
|---|---|---|---|---|
| viz_python_lib-1.4.2.tar.gz | 42.8 kB | With provenance | Details for viz_python_lib-1.4.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| viz_python_lib-1.4.2-py3-none-any.whl | Python 3 | none | any | Details for viz_python_lib-1.4.2-py3-none-any.whl |
Total release size: 92.8 kB
Release files / viz_python_lib-1.4.2.tar.gz
| Download URL | viz_python_lib-1.4.2.tar.gz |
|---|---|
| Size | 42.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
962ed38fd3d5410f697c2528c1e62dd37c3dc16b425316a30c6efa671a551e8f
|
|
BLAKE2b-256 checksum How to use checksums |
b1e8e64455207654783cfb8cc67ff905b72b9763e004f909ee4772ed410249d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logRelease files / viz_python_lib-1.4.2-py3-none-any.whl
| Download URL | viz_python_lib-1.4.2-py3-none-any.whl |
|---|---|
| Size | 50.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ceafd6cc5d51b13b4f851b0d77dcca7b31091195bd42bdd6b8b3a54953ffc292
|
|
BLAKE2b-256 checksum How to use checksums |
f7819733fe8a8c59a649558c5b4bfd0be9380ea82839bb01578992c19519194b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logSecurity for viz-python-lib 1.4.2
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for viz_python_lib-1.4.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logA 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.