Using this library you can easily create and sign transactions for Waves blockchain. It also allows you to multi-sign existing transactions or create them without signature at all.
Transactions are created via transaction creating functions. There are 15 of them:
You can provide seed or private key to transaction creating function to sign it. If you do, senderPublicKey can be omitted.
Type LONG represents string or number. Strings are allowed since max js int is 2**53
Present in all transactions
Issue transaction. Type 3
Transfer transaction. Type 4
Reissue transaction. Type 5
Burn transaction. Type 6
Exchange transaction. Type 7
Exchange transactions are used by DEX mather. If you want to create your own exchange transaction, there is no params. You need to construct it by hand(see interface below, IOrder is described in Order section)
Lease transaction. Type 8
CancelLease transaction. Type 9
Alias transaction. Type 10
MassTransfer transaction. Type 11
Data transaction. Type 12
SetScript transaction. Type 13
Sponsorship transaction. Type 14
SetAssetScript transaction. Type 15
InvokeScript transaction. Type 16
UpdateAssetInfo transaction. Type 17
If you want to create the minimum you need to provide is amount and recipient as defined in Transfer params:
const transfer =const seed = 'some example seed phrase'const signedTranserTx =// or using aliasconst signedTranserTx =
Output will be a signed transfer transaction:
id: '8NrUwgKRCMFbUbqXKQAHkGnspmWHEjKUSi5opEC6Havq'type: 4version: 2recipient: '3P6fVra21KmTfWHBdib45iYV6aFduh4WwC2'attachment: undefinedfeeAssetId: undefinedassetId: undefinedamount: 1fee: 100000senderPublicKey: '6nR7CXVV7Zmt9ew11BsNzSvVmuyM5PF6VPbWHW9BHgPq'timestamp: 1536917842558proofs:'25kyX6HGjS3rkPTJRj5NVH6LLuZe6SzCzFtoJ8GDkojY9U5oPfVrnwBgrCHXZicfsmLthPUjTrfT9TQL2ciYrPGE'
You can also create transaction, but not sign it:
const unsignedTransferTx =
Now you are able to POST it to Waves API or store for future purpose or you can add another signature from other party:
const otherPartySeed = 'other party seed phrase'const transferSignedWithTwoParties =
So now there are two proofs:
id: '8NrUwgKRCMFbUbqXKQAHkGnspmWHEjKUSi5opEC6Havq'type: 4version: 2recipient: '3P6fVra21KmTfWHBdib45iYV6aFduh4WwC2'attachment: undefinedfeeAssetId: undefinedassetId: undefinedamount: 1fee: 100000senderPublicKey: '6nR7CXVV7Zmt9ew11BsNzSvVmuyM5PF6VPbWHW9BHgPq'timestamp: 1536917842558proofs:'25kyX6HGjS3rkPTJRj5NVH6LLuZe6SzCzFtoJ8GDkojY9U5oPfVrnwBgrCHXZicfsmLthPUjTrfT9TQL2ciYrPGE''CM9emPzpe6Ram7ZxcYax6s7Hkw6698wXCMPSckveFAS2Yh9vqJpy1X9nL7p4RKgU3UEa8c9RGXfUK6mFFq4dL9z'
Order is created the same way as transaction
const broadcast = ;const nodeUrl = '';
You can send tx to any waves node you like:. E.g.:
- https://nodes-testnet.wavesnodes.com - waves TESTNET nodes hosted by Wavesplatform
- https://nodes.wavesplatform.com - waves MAINNET nodes hosted by Wavesplatform
Most transactions require chainId as parameter, e.g: IBurnParams. By default chainId is 'W', which means MAINNET. To make transaction in TESTNET be sure to pass chainId if it is present in params interface and then send it to TESTNET node
This library uses
@waves/ts-lib-crypto for cryptography and
@waves/node-api-js for interacting with node.
You can access them this way: