Download the PHP package viz-blockchain/viz-php-lib without Composer

On this page you can find all versions of the php package viz-blockchain/viz-php-lib. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package viz-php-lib

viz-php-lib

Native PHP class for VIZ Keys, Transaction, JsonRPC

Features

Dependencies

One PHP extension from the list:

Most hosting providers have it turned on already, but if not found, check your control panel.

Thanks to third-party class developers:

Examples

Some examples have placeholders for private keys or accounts. Change them for successfull test.

Keys: init from hex, encode to wif, get public key from private, get encoded version, verify signature.

JsonRPC: init with endpoint, api method without parameters, change endpoint, get account, turn on all json result, request a non-existent account.

Transaction: init with endpoint and private key in wif, build simple transaction with award operation and execute it.

Init with endpoint and private key in wif, activate queue mode and add 2 operations, end queue and get result array. Execute transaction json from array. Add additional signature for multi-sig example (can be false if canonical signature was not found).

Create new private key, get public key from it, execute transaction with create_invite operation.

Find shared key from two sides. Simple string encrypt and decrypt with AES-256-CBC. Encode and decode memo with viz-js-lib compability structure for encrypted memo.

Generate data and signature for passwordless authentication and check it for domain auth action with active authority.

Make transaction with custom operation.

Make transaction with account create operation.

Make transaction with proposal operations as array (need to use build_ prefix). Approve that proposal with other account active key.

Utils method for post text object to Voice protocol. Method attributes (* - is optional):

Attribute Description
text Simple text note.
reply* Link to replied context in viz:// url scheme.
share* Link to shared context in any url scheme.
beneficiaries* Array of objects [] contains ["account"=>"committee","weight"=>100] for awarding beneficiaries details.
loop* Block num. Ability to make loop for previous objects, exclude from personal activity feed.

Utils method for post publication object to Voice protocol. Method attributes (* - is optional):

Attribute Description
title Publication title.
markdown Publication text with voice markdown.
description* Publication short description for preview.
image* Link to publication image for preview thumbnail.
reply* Link to replied context in viz:// url scheme.
share* Link to shared context in any url scheme.
beneficiaries* Array of objects [] contains ["account"=>"committee","weight"=>100] for awarding beneficiaries details.
loop* Block num. Ability to make loop for previous objects, exclude from personal activity feed.

Create Voice text object, hide it with Voice Event.

Create Voice text object, check transaction size, split it for add Voice Event.

Agent access (HF15)

HF15 added set_agent_permission (op 105): a principal may hand a key an explicit, frozen list of its operations — an agent. An agent is not an account and never appears in any authority, so the old check ("get_account and look at active_authority.key_auths") silently rejects agent keys. The recipe is now authority OR agents, and VIZ\Agent::check() does both in one call.

Rules the helper mirrors from the node (agent_evaluator.cpp::usable_agent_row):

check($account, $key, $operation) returns ['allowed', 'source' => 'authority'|'agent'|'none', 'role', 'agent', 'operation']; find() returns the raw row, has() a bool. Pass the wire operation name (transfer, pm_place_bet, ...) to check a specific operation — with no operation an agent key is only answered as "this is a live agent key", because its grants are per-operation. A key that is only in a nested authority (account_auths) is not resolved here: use verify_authority with a signed transaction for the full recursive check. On a node without HF15 the method is unknown, agents are skipped, and the check degrades to authorities only.

Agent::poisoned($row) and Agent::addon_matches($row, $scope) are the two pure row predicates the verdicts are built from, exported for callers that already hold a row (and mirrored by viz.agent in the JS lib).

The write side is build_set_agent_permission() on VIZ\Transaction. The raw read method is get_agent_permissions, mapped to database_api like any other.

Domain auth (VIZ\Auth) also accepts an agent

VIZ\Auth::check() is the signature check a service runs against a signed domain:action:account:authority:unixtime:nonce string. It used to look at the account's authority only, so an agent key was refused — an agent is not an account and never appears in any authority. Now it tries the authority first and then the agents, gated on the addon: pass the service's own scope as the 6th constructor argument (or set $auth->addon later).

Domain auth is not a chain operation, so the row's operation list is not what a service matches on — the addon is the grant (compare Agent::grants() for the operation side). The usual agent gates still hold: an agent never answers a master requirement, the row must be alive, and a row the node refuses as poisoned grants nothing at all, addons included. With no addon configured the branch is off and check() behaves exactly as it did before HF15.

Prediction Markets (Onix, HF14)

The library ships all 23 signed prediction-market operations and all 29 prediction_market_api read methods. Operation builders follow the usual convention (build_ prefix for queued/proposed operations, no prefix to build-and-sign a standalone transaction) and every op takes an empty extensions vector automatically. Object ids (market_id, bet_id, liquidity_id, position_id, commit_id) are the bare integer instance of the on-chain object.

Percent fields are basis points (10000 = 100%) unless a builder note says otherwise. Assets are VIZ strings ("10.000 VIZ"); share_type/min_tokens args are raw milli-VIZ integers (VIZ×1000).

Operation builders

pm_oracle_register · pm_oracle_update · pm_create_market · pm_oracle_accept_market · pm_place_bet · pm_commit_bet · pm_reveal_bet · pm_cancel_bet · pm_add_liquidity · pm_withdraw_liquidity · pm_resolve_market · pm_no_contest · pm_dispute_create · pm_dispute_vote (regular auth) · pm_dispute_resolve · pm_transfer_position · pm_lazy_deposit · pm_lazy_withdraw · pm_leverage_open · pm_leverage_close · pm_leverage_convert · pm_dispute_oracle_respond · pm_unban.

Optional fields on pm_oracle_update accept null to leave a field unchanged (insurance_delta is a signed asset — "-5.000 VIZ" to withdraw):

Commit–reveal betting

pm_commitment(...) builds the byte-exact SHA-256 commitment the node re-checks on reveal (a wrong preimage forfeits the escrow). amount/min_tokens are milli-VIZ integers:

Read methods (prediction_market_api)

Called via execute_method like any other API. Pagination is (...key..., from, limit) with limit <= 1000.

Full method set: get_market, list_markets, list_markets_by_oracle, list_markets_by_creator, get_market_outcomes, get_market_weight_sums, get_market_bets, get_account_positions, get_market_liquidity, get_market_full, get_account_leverage_positions, get_market_leverage_positions, get_creator_ban, get_leverage_quote, get_leverage_close_preview, get_leverage_convert_preview, get_oracle, list_oracles, get_dispute, get_dispute_votes, get_lazy_pool, get_lazy_deposit, get_lazy_allocations, get_market_lazy_allocation, get_pm_chain_properties, get_market_meta, list_markets_by_category, get_market_categories, get_market_kline.

May VIZ be with you.

HF16 compatibility

Committee request limits are checked by the node: from HF16 the maximum is 1% of current_supply at creation, rounded down to the smallest VIZ unit. The operation fields and transaction encoding are unchanged. JSON-RPC returns QC, timeout and equivocation header extensions without decoding their binary format. This library does not sign or serialize block headers; validator_equivocation is a virtual operation and must not be broadcast as a transaction.


All versions of viz-php-lib with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package viz-blockchain/viz-php-lib contains the following files

Loading the files please wait ...