Create and submit a transaction to vote for a delegate in ARK.
View delegation statistics
Use BlockchainData to determine the voting fee:
Using the preceding statistics, use Quantity to set an appropriate fee for voting for a delegate:
- The “FeeStatistics” property of BlockchainData for ARK can be used to decide the “Fee”.
- The workflow uses the devnet blockchain for these examples. To use the mainnet blockchain, specify .
Create the transaction object
Use BlockchainTransaction to build the transaction object with the chosen fee and the delegate's username. Specify "Vote" as the transaction "Type":
- The public key can be used in place of the delegate’s username.
- The transaction exists locally until it is submitted to the ARK blockchain with BlockchainTransactionSubmit.
- The sender is not part of the transaction until the transaction is signed.
Examine the delegate information
Use an address with enough balance to vote with and vote for the chosen delegate:
- The “VotedFor”, “Votes” and “Voters” fields are empty until the transaction is submitted.
Sign the transaction
Use BlockchainTransactionSign to sign the transaction with the private key of the voter:
This will also add the corresponding public key to the transaction.
- The transaction is now signed but not yet submitted to the blockchain. It only exists locally.
Submit the transaction
Use BlockchainTransactionSubmit to send the transaction to the blockchain:
- After the transaction is submitted, you must wait for it to be included in a block. The block can then be forged and added to the blockchain.
Re-examine the delegate information
Use BlockchainAddressData to view the updated delegate information.
View the specific fields updated from the recent transaction:
- The amount showed in “Votes” is the sum of the balance of all of the voters.