-
Notifications
You must be signed in to change notification settings - Fork 8
Node Service
The main service to work with Waves blockchain. This service works with Waves nodes. To get an intuition about how a node works and what is it you can read the documentation. A long story short, miners deploy their nodes, they process requests, store all the data about the network, transactions, and validate incoming transactions against network rules, confirm or reject them.
For users, it looks like a normal Internet service on the client-server principle. Each node is a synchronized, full or partial copy of a chain of blocks.
The full list of node methods is available at Public Nodes Swagger and Testnet Public Nodes Swagger
The source code of the Node Service is available here
/**
* Accounts' Waves balance
* @param address Address
*/
@GET("addresses/balance/{address}")
fun addressesBalance(@Path("address") address: String?): Observable<WavesBalanceResponse>
/**
* Accounts' script
* @param address Address
*/
@GET("addresses/scriptInfo/{address}")
fun scriptInfo(@Path("address") address: String): Observable<ScriptInfoResponse>
/**
* Accounts' balances for all assets by address
* @param address Address
*/
@GET("assets/balance/{address}")
fun assetsBalance(@Path("address") address: String?): Observable<AssetBalancesResponse>
/**
* Accounts' assetId balance by address
* @param address Address
* @param assetId AssetId
*/
@GET("assets/balance/{address}/{assetId}")
fun assetsBalance(
@Path("address") address: String?,
@Path("assetId") assetId: String?
): Observable<AddressAssetBalanceResponse>
/**
* Provides detailed information about given asset
* @param assetId Asset Id
*/
@GET("/assets/details/{assetId}")
fun assetDetails(@Path("assetId") assetId: String): Observable<AssetsDetailsResponse>
/**
* Get list of transactions where specified address has been involved
* @param address Address
* @param limit Number of transactions to be returned. Max is last 1000.
*/
@GET("transactions/address/{address}/limit/{limit}")
fun transactionsAddress(@Path("address") address: String?,
@Path("limit") limit: Int): Observable<List<List<HistoryTransactionResponse>>>
/**
* Get current Waves blockchain height
*/
@GET("blocks/height")
fun blockHeight(): Observable<HeightResponse>
/**
* Active leasing transactions of an account
* @param address Address
*/
@GET("leasing/active/{address}")
fun leasingActive(@Path("address") address: String?): Observable<List<HistoryTransactionResponse>>
/**
* Current node timestamp (UTC)
*/
@GET("/utils/time")
fun utilsTime(): Observable<UtilsTimeResponse>
The Issue transaction adds a new asset in the blockchain.
Issue transaction is used to give the user the possibility to issue his/her own tokens on Waves blockchain. The user can define the exact amount of the issued tokens and he can reissue more tokens later by enabling the reissuable flag (1- true).
A script can be developed with Waves Ride IDE
/**
* Broadcast IssueTransaction (typeId = 3)
* @param transaction IssueTransaction with signature by privateKey
*/
@POST("transactions/broadcast")
fun transactionsBroadcast(@Body transaction: IssueTransaction): Observable<IssueTransactionResponse>
Transfer transaction sends some amount of assets on recipients' address.
It is used to transfer a specific amount of an asset (WAVES by default) to the recipient (by address or alias).
/**
* Broadcast TransferTransaction (typeId = 4)
* @param transaction TransferTransaction with signature by privateKey
*/
@POST("transactions/broadcast")
fun transactionsBroadcast(@Body transaction: TransferTransaction): Observable<TransferTransactionResponse>
The Reissue transaction is used to give the ability to reissue more tokens of an asset by specifying the amount and the asset id. Only quantity and reissuable can be new values
/**
* Broadcast ReissueTransaction (typeId = 5)
* @param transaction ReissueTransaction with signature by privateKey
*/
@POST("transactions/broadcast")
fun transactionsBroadcast(@Body transaction: ReissueTransaction): Observable<ReissueTransactionResponse>
The Burn transaction irreversible deletes amount of some asset
It's impossible to burn WAVES with the burn transaction.
/**
* Broadcast BurnTransaction (typeId = 6)
* @param transaction BurnTransaction with signature by privateKey
*/
@POST("transactions/broadcast")
fun transactionsBroadcast(@Body transaction: BurnTransaction): Observable<BurnTransactionResponse>
Not available now!
Exchange transaction matches a sell
and buy
orders for exchange by specifying the following:
- The asset.
- The price of the asset to sell(1) or buy(0).
- The amount which the user is offering.
- The asset and the amount which the user requests in return.
/**
* Broadcast ExchangeTransaction (typeId = 7)
* @param transaction ExchangeTransaction with signature by privateKey
*/
@POST("transactions/broadcast")
fun transactionsBroadcast(@Body transaction: ExchangeTransaction): Observable<ExchangeTransactionResponse>
The Leasing transaction leases amount of Waves to node operator.
It can be address or alias by Proof-of-Stake consensus.
You always can reverse the any leased amount by [LeaseCancelTransaction]
/**
* Broadcast LeaseTransaction (typeId = 8)
* @param transaction LeaseTransaction with signature by privateKey
*/
@POST("transactions/broadcast")
fun transactionsBroadcast(@Body transaction: LeaseTransaction): Observable<LeaseTransactionResponse>
The leasing cancellation transaction reverses [LeaseTransaction]. Lease cancel transaction is used to cancel and discontinue the WAVES leasing process to a Waves account.
/**
* Broadcast LeaseCancelTransaction (typeId = 9)
* @param transaction LeaseCancelTransaction with signature by privateKey
*/
@POST("transactions/broadcast")
fun transactionsBroadcast(@Body transaction: LeaseCancelTransaction): Observable<LeaseCancelTransactionResponse>
Alias transaction creates short readable alias for address
/**
* Create AliasTransaction. Alias - short name for address (typeId = 10)
* @param transaction AliasTransaction with signature by privateKey
*/
@POST("transactions/broadcast")
fun transactionsBroadcast(@Body transaction: AliasTransaction): Observable<AliasTransactionResponse>
The Mass-Transfer transaction sends a lot of transactions of an asset for recipients set.
MassTransferTransaction is used to combine several ordinary transfer transactions that share single sender and asset ID (it has a list of recipients, and an amount to be transferred to each recipient).
The maximum number of recipients in a single transaction is 100.
The transfers to self are allowed, as well as zero-valued transfers.
In the recipients' list, a recipient can occur several times, this is not considered an error.
Fee depends on transactions count 0.001 + 0.0005 × N, N is the number of transfers inside of a transaction
/**
* Broadcast MassTransferTransaction (typeId = 11)
* @param transaction MassTransferTransaction with signature by privateKey
*/
@POST("transactions/broadcast")
fun transactionsBroadcast(@Body transaction: MassTransferTransaction): Observable<MassTransferTransactionResponse>
Data transaction stores data in account data storage of the blockchain.
The storage contains data recorded using a data transaction or an invoke script transaction.
The maximum length of the data array is 100 elements.
The maximum size of the data array is 140 kilobytes.
Each element of the data array is an object that has 3 fields: key, type, value.
The array of data cannot contain two elements with the same key field.
Fee depends on data transaction length (0.001 per 1kb)
/**
* Broadcast DataTransaction (typeId = 12)
* @param transaction DataTransaction with signature by privateKey
*/
@POST("transactions/broadcast")
fun transactionsBroadcast(@Body transaction: DataTransaction): Observable<DataTransactionResponse>
Script transactions (set script to account) allow you to extend the available functionality of the standard Waves application. The script can be developed with Waves RIDE IDE. An account with the attached script is called a smart account or dApp. To remove the script from the account you have to send a transaction with null
as a script. Before you start, please keep in mind next things.
We do not recommend you submit script transactions unless you are an experienced user.
!!! Errors can lead to permanent loss of access to your account.
SetScriptTransaction is used to set up a smart account or dApp.
/**
* Broadcast SetScriptTransaction, also called account-script (typeId = 13)
* @param transaction SetScriptTransaction with signature by privateKey
*/
@POST("transactions/broadcast")
fun transactionsBroadcast(@Body transaction: SetScriptTransaction): Observable<SetScriptTransactionResponse>
Sponsorship transaction (or so-called Autonomous Assets) moves Waves-fees for a selected asset for all transfer transactions to asset issuers' account.
Sponsorship transaction is used to set a transaction fee nominated in an asset.
More details about Sponsorship Transactions
/**
* Broadcast SponsorshipTransaction (typeId = 14)
* @param transaction SponsorshipTransaction with signature by privateKey
*/
@POST("transactions/broadcast")
fun transactionsBroadcast(@Body transaction: SponsorshipTransaction): Observable<SponsorshipTransactionResponse>
Set asset script transaction (set script to asset)
You can only update the script of an asset, that was issued before by [IssueTransaction].
An asset script is a script that is attached to an asset with a set asset script transaction.
An asset with the attached script is called a smart asset.
You can attach a script to an asset only during the creation of the asset.
The script can be developed with Waves Ride IDE
Smart assets are unique virtual currency tokens that may represent a tangible real-world asset or non-tangible ownership that can be purchased, sold or exchanged as defined by the rules of a script on the Waves blockchain network.
Only the issuer of that asset can change the asset's script.
/**
* Broadcast SetAssetScriptTransaction (typeId = 15)
* @param transaction SetAssetScriptTransaction with signature by privateKey
*/
@POST("transactions/broadcast")
fun transactionsBroadcast(@Body transaction: SetAssetScriptTransaction): Observable<SetAssetScriptTransactionResponse>
InvokeScriptTransaction is a transaction that invokes functions of a dApp.
dApp contains compiled functions developed using RIDE language
You can invoke one of them by name with some arguments. dApp creation Wiki
/**
* Broadcast InvokeScriptTransaction (typeId = 16)
* @param transaction InvokeScriptTransaction with signature by privateKey
*/
@POST("transactions/broadcast")
fun transactionsBroadcast(@Body transaction: InvokeScriptTransaction): Observable<InvokeScriptTransactionResponse>