Signature and Broadcast Steps
Introduction
The Vision network has offical API calls to allow users to interact with the blockchain. These API calls can be found in the API reference page, which lists API calls from Full Node, Solidity Node, and VisionWeb. While some of the API calls serve as stand-alone requests to get individual pieces of information, there are also many API calls which modify the user VS wallet, resulting in a need to sign and broadcast the transaction. This guide walks the user through a VS Balance staking example to show the API signature and broadcast process flow.
Stake Balance Example
One of the most commonly used APIs is the /wallet/freezebalance
call. This API call stakes your VS balance within a user-specified wallet address, and provides either photon OR entropy to the wallet owner. This API call takes in the four input parameters of owner_address
, frozen_balance
, frozen_duration
, and resource
:
owner_address
is the VS wallet's address in string format.frozen_balance
is the amount of VS staked in denominations of VDT, in integer format.frozen_duration
is the duration in days to be staked, in integer format.resource
is the type of resource staking for. This can be eitherENTROPY
orPHOTON
, in string format.
Make a Transaction: stake balance by making the API call to get the JSON data:
Below is the sample JSON output. It lists the various attributes associated with the stake balance transaction. This JSON output will be used to sign the transaction.
Sign the Transaction: The
/wallet/gettransactionsign
API call takes in two parameters. One is thetransaction
parameters, which takes in the JSON output from the previous step. The other is theprivateKey
parameter, which requires the private key associated with the staked VS address to sign the transaction.
Below is the sample JSON output, with the signature ID:
Broadcast Transaction: The
/wallet/broadcasttransaction
API call takes in one parameter, which is the JSON output data from signing the transaction.
Below is the sample JSON Output, confirming successful transaction broadcast.
Last updated