-
-
Notifications
You must be signed in to change notification settings - Fork 112
Transaction Types
Any transaction in ADAMANT has its type
and purpose. Though all transactions have general structure, there are some particularities between types
.
ADAMANT's transaction types currently in use:
- 0 — Token Transfer Transaction
- 2 — Delegate Registration Transaction
- 3 — Vote for delegate Transaction
- 8 — Chat/Message Transaction
- 9 — Store data in KVS Transaction
Read more about ADAMANT's transaction structure and types in AIP 10: General transaction structure for API calls.
Token Transfer Transaction is for transferring ADM tokens between accounts.
-
type
= 0 -
amount
— set amount to be transferred in 1/10^8 ADM tokens (1 ADM = 100000000) -
fee
= 50000000 (0.5 ADM) -
asset
= none
To get type 0
transactions, use /api/transactions endpoint.
To post new Token Transfer transaction, you can use endpoints:
Example:
{
"success": true,
"nodeTimestamp": 63653372,
"transaction": {
"id": "18403419073955198807",
"height": 3246897,
"blockId": "1696318970118109075",
"type": 0,
"block_timestamp": 23290655,
"timestamp": 23290649,
"senderPublicKey": "cdab95b082b9774bd975677c868261618c7ce7bea97d02e0f56d483e30c077b6",
"senderId": "U15423595369615486571",
"recipientId": "U3589996151080018161",
"recipientPublicKey": "8932a618c01337a02bfd6786aca1daa355e0e6540372596fdef7ccf8b5b948c8",
"amount": 9000000,
"fee": 50000000,
"signature": "c325f8c9d727f42b37451c80d247a3306cfa79f49eb4beae18c5e5ab11be29dc4a137959522b363bf82a5fb0bb91c96001be41ec465a5b68295fe184b673100d",
"signatures": [],
"confirmations": 8000117,
"asset": {}
}
}
Delegate Registration Transaction creates a new delegate in ADAMANT's blockchain. See also: How to Become an ADAMANT Delegate.
-
type
= 2 -
recipientId
= null -
recipientPublicKey
= null -
amount
= 0 -
fee
= 300000000000 (3000 ADM) -
asset
— set delegate's info
To get type 2
transactions, see Delegates and Voting endpoints.
To broadcast a new Delegate Registration Transaction, you can use endpoints:
Example:
{
"success": true,
"nodeTimestamp": 63646785,
"transaction": {
"id": "9970337616987571803",
"height": 9130911,
"blockId": "2640582970042287242",
"type": 2,
"timestamp": 52956148,
"senderPublicKey": "6b99151b0e79146a40ab7f6f065e9e2f354fe1e64af8bc35bfa7f5fa5f510ee3",
"senderId": "U2850997466368415658",
"recipientId": null,
"recipientPublicKey": null,
"amount": 0,
"fee": 300000000000,
"signature": "07180f9934394af1223f607dffb6d4a27229ecadbef5dd1a8bc32f27f8778915ecbe1af052b8bb4e38dc1fb8d62207956e257ad63ec10cd590f4f1ca6f12720a",
"signatures": [],
"confirmations": 2114803,
"asset": {
"delegate": {
"username": "mawi",
"publicKey": "6b99151b0e79146a40ab7f6f065e9e2f354fe1e64af8bc35bfa7f5fa5f510ee3",
"address": "U2850997466368415658"
}
}
}
}
Vote for delegate Transaction used to vote or downvote for delegates. See also: How to vote for ADAMANT delegates.
Transactions of this type intended to describe voting activity of ADAMANT account. Specificity of such transactions is that ) contains same ADAMANT address (public key). Other specified field's values are:
-
type
= 3 -
amount
= 0 -
fee
= 5000000000 (50 ADM) -
asset
— set publicKeys for upvote and downvote
To get type 3
transactions, see Delegates and Voting endpoints.
To broadcast a new Vote for delegate Transaction, you can use endpoints:
Example:
{
"success": true,
"nodeTimestamp": 63585715,
"transaction": {
"id": "9888167852341777698",
"height": 10488572,
"blockId": "16481510969712463150",
"type": 3,
"timestamp": 59782601,
"senderPublicKey": "9560562121cdc41112a0b288101079346d9c67f5bbff1f4d5a29483258c9477a",
"senderId": "U9221911598904803004",
"recipientId": "U9221911598904803004",
"recipientPublicKey": "9560562121cdc41112a0b288101079346d9c67f5bbff1f4d5a29483258c9477a",
"amount": 0,
"fee": 5000000000,
"signature": "fe199a4a5790186c1c482c6f5c0de5b7baa0a66e4b97abcb96f47e197880ea8333dc57e1b497e32eabdb157ac834dbd85d58d7c550e8aabe208af79026279c04",
"signatures": [],
"confirmations": 745088,
"asset": {
"votes": [
"-c0c580c3fb89409f32181fef58935f286f0c1bbf61bd727084ed915b3a4bc95b"
]
},
"votes": {
"added": [],
"deleted": [
"c0c580c3fb89409f32181fef58935f286f0c1bbf61bd727084ed915b3a4bc95b"
]
}
}
}
Chat or Message Transactions are used to send messages, rich text and signals between accounts. Type 8
transactions contains asset.chat
JSON objects with encrypted content. For understanding message transactions structure and message types, see Message Types section.
-
type
= 8 -
amount
— set0
for message only; or integer amount in 1/10^8 ADM tokens (1 ADM = 100000000) for token transfer with comment -
fee
= 100000 (0.001 ADM) per 255 unencrypted symbols for message or 50000000 (0.5 ADM) for ADM token transfer with comment -
asset
— setchat
JSON with encrypted message content
Note: Nodes accept maximum encrypted text length of 20480 hex symbols, so approximate maximum unencrypted text length is about 13000 utf-8 symbols.
To fetch messages from ADAMANT blockchain, use Chats and Chatrooms endpoints.
To send a new message, you can use endpoints:
Example:
{
"id": "9175562912139726777",
"height": 10288885,
"blockId": "10475460465898092643",
"type": 8,
"timestamp": 58773228,
"senderPublicKey": "2ac5eef60303003c90f662d89e60570d8661c8ba569e667296f5c7c97a0413ee",
"requesterPublicKey": null,
"senderId": "U8916295525136600565",
"recipientId": "U2707535059340134112",
"recipientPublicKey": "5a3c1da429ae925422892e69dc4f0ab6d7ac00cef229d2d992242dcfeca27b91",
"amount": 0,
"fee": 100000,
"signature": "287dc2554025d8074d674d50ec785d530588e2b828f2d3f29687a4f05c8afc623e185896abc739ea2af8db199ec6e31c57426937343ff5ec154341cee8f72f0a",
"signSignature": null,
"signatures": [],
"confirmations": null,
"asset": {
"chat": {
"message": "9ae819297240f00bdc3627133c2e41efd27b022fcd0d011dfdda0941ba08399697f3e3bb5c46a43aff714ae1bac616b84617ce446d808523a14f278e5d88909837848e7aa69d9d4f9a95baae56df6ad4c274248d3d01a2cfccae51367dfab265a055d5ce991af654ee418839f94885876638863d172226b0369cd488c5727e6b1a42ba46fed014c1bf586dd2cab3afe7f10cb54864c099a680d5963778c9c4052df305497edc43082a7d60193650c331c6db9c9d9c0c8bbc004e53ac56586331453164b984c57a495810d709c9b984e4f367888d8a8ce1b26f528c1abdec08747e",
"own_message": "6802a9e744aa3ba570d7e48fce5fe0f49184d0ce38ea40f7",
"type": 1
}
}
}
Key-Value Storage (KVS) is a special type of transactions for storing private (encrypted) or public (plain value) data in ADAMANT's blockchain. For understanding KVS, see Storing Data in KVS section.
-
type
= 9 -
amount
= 0 -
fee
= 100000 (0.001 ADM) per 255 unencrypted symbols -
asset
— setstate
JSON with content
To fetch KVS data from ADAMANT blockchain, use /api/states/get
endpoint.
To broadcast a new Store data in KVS Transaction, you can use endpoints:
Example:
{
"success": true,
"nodeTimestamp": 63585642,
"transaction": {
"id": "11325216963059857859",
"height": 3377231,
"blockId": "14121859709526400688",
"type": 9,
"timestamp": 23943500,
"senderPublicKey": "ac903ab58135cd5f0613a929d876953214d224034b73c33e63bc153d669447f4",
"senderId": "U5517006347330072401",
"recipientId": null,
"recipientPublicKey": null,
"amount": 0,
"fee": 100000,
"signature": "4c3bcca1f6c921cef7ce07f4e641f668c5c0660bb6432335d5e2117c7a4d8378b352e7fa4fac3126bd7228f5b9ac5d57100bb161da02f7efc16df9f7e602b10d",
"signatures": [],
"confirmations": 7856415,
"asset": {
"state": {
"value": "0x2391EEaEc07B927D2BA4Fa5cB3cE4b490Fa6fffC",
"key": "eth:address",
"type": 0
}
}
}
}