Installation and usage of the platform
REST API: transactions¶
Methods of the transactions
group are provided to work with transactions.
Signing and sending transactions¶
The node REST API uses a JSON representation of a transaction to send requests.
The basic principles of work with transactions are given in the Transactions of the blockchain platform. A description of the fields for each transaction is given in the Description of transactions section.
The POST /transactions/sign method is used to sign transactions. This method signs the transaction with the sender’s private key stored in the keystore of the node. To sign requests with the key from the keystore of the node, be sure to specify the key pair password in the password
field.
Example signature request transaction 3:
The POST /transactions/sign method in the response returns the fields needed to publish the transaction.
Example response with transaction 3:
The POST /transactions/broadcast method is designed to broadcast a transaction. The response fields of the sign method are input to this method. A transaction can also be sent to the blockchain using other tools given in the article Transactions of the blockchain platform.
In addition to separate methods for signing and sending transactions, there is a combined method POST /transactions/signAndBroadcast. This method signs and sends the transaction to the blockchain without intermediate transfer of information between the methods.
Example request and response of the method with transaction 112:
Information about transactions¶
The transactions
group also includes the following methods of obtaining information about transactions in the blockchain:
GET /transactions/info/{id}¶
Obtaining information about a transaction by its {id}
identifier. The transaction identifier is specified in the POST /transactions/sign or POST /transactions/signAndBroadcast methods response.
The method returns transaction data similar to the POST /transactions/broadcast and POST /transactions/signAndBroadcast methods responses.
Response example:
GET /transactions/address/{address}/limit/{limit}¶
The method returns the data of the last {limit}
transactions of the address {address}
.
For each transaction, data similar to the POST /transactions/broadcast and POST /transactions/signAndBroadcast methods responses are returned.
Response example with one transaction:
GET /transactions/unconfirmed¶
The method returns the data of all transactions from the UTX pool of the node.
For each transaction, data similar to the POST /transactions/broadcast and POST /transactions/signAndBroadcast methods responses are returned.
Response example with one transaction:
GET /transactions/unconfirmed/size¶
The method returns the number of transactions in the UTX pool as a number.
Response example:
GET /unconfirmed/info/{id}¶
The method returns the data of the transaction that is in the UTX pool by its {id}
.
The method response contains transaction data similar to the POST /transactions/broadcast and POST /transactions/signAndBroadcast methods’ responses.
Response example:
POST /transactions/calculateFee¶
The method returns the amount of commission for the sent transaction.
The request specifies parameters similar to POST /transactions/broadcast request. The method’s response returns the identifier of the asset where the commission is charged (null
for WAVES).
Response example: