Transactions¶
Hint
The rules for generating node queries are given in module How to use REST API.
GET /transactions/info/{id}¶
Query transaction information by its ID.
Query Parameters:
"id" - Transaction ID
Method Response:
{
"type": 4,
"id": "52GG9U2e6foYRKp5vAzsTQ86aDAABfRJ7synz7ohBp19",
"sender": "3NBVqYXrapgJP9atQccdBPAgJPwHDKkh6A8",
"senderPublicKey": "CRxqEuxhdZBEHX42MU4FfyJxuHmbDBTaHMhM3Uki7pLw",
"recipient": "3NBVqYXrapgJP9atQccdBPAgJPwHDKkh6A8",
"assetId": "E9yZC4cVhCDfbjFJCc9CqkAtkoFy5KaCe64iaxHM2adG",
"amount": 100000,
"fee": 100000,
"timestamp": 1479313236091,
"attachment": "string",
"signature": "GknccUA79dBcwWgKjqB7vYHcnsj7caYETfncJhRkkaetbQon7DxbpMmvK9LYqUkirJp17geBJCRTNkHEoAjtsUm",
"height": 7782
}
GET /transactions/address/{address}/limit/{limit}¶
Returns latest {limit} transactions from address {address}.
Method Response:
[
[
{
"type": 2,
"id": "4XE4M9eSoVWVdHwDYXqZsXhEc4q8PH9mDMUBegCSBBVHJyP2Yb1ZoGi59c1Qzq2TowLmymLNkFQjWp95CdddnyBW",
"fee": 100000,
"timestamp": 1479313097422,
"signature": "4XE4M9eSoVWVdHwDYXqZsXhEc4q8PH9mDMUBegCSBBVHJyP2Yb1ZoGi59c1Qzq2TowLmymLNkFQjWp95CdddnyBW",
"sender": "3NBVqYXrapgJP9atQccdBPAgJPwHDKkh6A8",
"senderPublicKey": "CRxqEuxhdZBEHX42MU4FfyJxuHmbDBTaHMhM3Uki7pLw",
"recipient": "3N9iRMou3pgmyPbFZn5QZQvBTQBkL2fR6R1",
"amount": 1000000000
}
]
]
GET /transactions/unconfirmed¶
Returns all unconfirmed transactions from node utx-pool.
Method Response:
[
{
"type": 4,
"id": "52GG9U2e6foYRKp5vAzsTQ86aDAABfRJ7synz7ohBp19",
"sender": "3NBVqYXrapgJP9atQccdBPAgJPwHDKkh6A8",
"senderPublicKey": "CRxqEuxhdZBEHX42MU4FfyJxuHmbDBTaHMhM3Uki7pLw",
"recipient": "3NBVqYXrapgJP9atQccdBPAgJPwHDKkh6A8",
"assetId": "E9yZC4cVhCDfbjFJCc9CqkAtkoFy5KaCe64iaxHM2adG",
"amount": 100000,
"fee": 100000,
"timestamp": 1479313236091,
"attachment": "string",
"signature": "GknccUA79dBcwWgKjqB7vYHcnsj7caYETfncJhRkkaetbQon7DxbpMmvK9LYqUkirJp17geBJCRTNkHEoAjtsUm"
}
]
GET /transactions/unconfirmed/size¶
Return the number of transactions available in UTX pool.
GET /unconfirmed/info/{id}¶
Query transaction details from UTX pool by its ID.
POST /transactions/calculateFee¶
Calculates fee amount for transferred transaction.
Query Parameters
"type" - Transaction type
"senderPublicKey" - Public key of sender
"sender" is ignored
"fee" is ignored
and all the other parameters appropriate for a transaction of the given type.
Method Query
{
"type": 10,
"timestamp": 1516171819000,
"sender": "3MtrNP7AkTRuBhX4CBti6iT21pQpEnmHtyw",
"alias": "ALIAS",
}
or
{
"type": 4,
"sender": "3MtrNP7AkTRuBhX4CBti6iT21pQpEnmHtyw",
"recipient": "3P8JYPHrnXSfsWP1LVXySdzU1P83FE1ssDa",
"amount": 1317209272,
"feeAssetId": "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
"attachment": "string"
}
Method Response
{
"feeAssetId": null,
"feeAmount": 10000
}
or
{
"feeAssetId": "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
"feeAmount": 10000
}
POST /transactions/sign¶
Signs a transaction with sender’s private key stored in node keystore. After signing, method response must be sent to method input Broadcast.
It is necessary to enter the password into the password
field in order to sign requests with the key from keystore node.
Sample queries
ID |
Transaction type |
---|---|
3 |
|
4 |
|
5 |
Reissue |
6 |
Burn |
7 |
Exchange |
8 |
Lease |
9 |
Lease Cancel |
10 |
|
11 |
Mass Transfer |
12 |
|
13 |
|
14 |
Set Sponsorship |
101 |
Permission (for Genesis block) |
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
3. Issue
{
"type": 3,
"version":2,
"name": "Test Asset 1",
"quantity": 100000000000,
"description": "Some description",
"sender": "3FSCKyfFo3566zwiJjSFLBwKvd826KXUaqR",
"decimals": 8,
"reissuable": true,
"fee": 100000000
}
4. Transfer
{
"type": 4,
"version": 2,
"sender": "3M6dRZXaJY9oMA3fJKhMALyYKt13D1aimZX",
"password": "",
"recipient": "3M6dRZXaJY9oMA3fJKhMALyYKt13D1aimZX",
"amount": 40000000000,
"fee": 100000
}
10. Alias
{
"type": 10,
"version": 2,
"fee": 100000,
"sender": "3N9vL3apA4j2L5PojHW8TYmfHx9Lo2ZaKPB",
"alias": "hodler"
}
12. Data
{
"type": 12,
"version": 1,
"sender": "3N9vL3apA4j2L5PojHW8TYmfHx9Lo2ZaKPB",
"senderPublicKey": "Fbt5fKHesnQG2CXmsKf4TC8v9oB7bsy2AY56CUopa6H3",
"author": "3N9vL3apA4j2L5PojHW8TYmfHx9Lo2ZaKPB",
"data":
[
{
"key": "objectId",
"type": "string",
"value": "obj:123:1234"
}
],
"fee": 100000
}
13. Set Script
{
"type": 13,
"version": 1,
"sender": "3N9vL3apA4j2L5PojHW8TYmfHx9Lo2ZaKPB",
"fee": 1000000,
"name": "faucet",
"script": "base64:AQQAAAAHJG1hdGNoMAUAAAACdHgG+RXSzQ=="
}
102. PermissionTransaction
Sample query
{
"type":102,
"sender":"3GLWx8yUFcNSL3DER8kZyE4TpyAyNiEYsKG",
"senderPublicKey":"4WnvQPit2Di1iYXDgDcXnJZ5yroKW54vauNoxdNeMi2g",
"fee":0,
"proofs":[""],
"target":"3GPtj5osoYqHpyfmsFv7BMiyKsVzbG1ykfL",
"opType":"add",
"role":"contract_developer",
"dueTimestamp":null
}
103. CreateContractTransaction
Sample query
{
"type": 103,
"sender":"3PKyW5FSn4fmdrLcUnDMRHVyoDBxybRgP58",
"image":"localhost:5000/sum-contract-kv",
"params":[],
"imageHash": "930d18dacb4f49e07e2637a62115510f045da55ca16b9c7c503486828641d662",
"fee":500000
}
Sample response
{
"type": 103,
"id": "2sqPS2VAKmK77FoNakw1VtDTCbDSa7nqh5wTXvJeYGo2",
"sender": "3PKyW5FSn4fmdrLcUnDMRHVyoDBxybRgP58",
"senderPublicKey": "2YvzcVLrqLCqouVrFZynjfotEuPNV9GrdauNpgdWXLsq",
"fee": 500000,
"timestamp": 1549443811183,
"proofs": [
"YSomSCKBhQWHKHR8f8ZMp7EzuA6Uouu1oq5WA5VDiZ8o2adL4XMQP3jgccketjGCEpnTnCjm5bABZG486CVR5ZM"
],
"version": 1,
"image": "localhost:5000/sum-contract-kv",
"imageHash": "930d18dacb4f49e07e2637a62115510f045da55ca16b9c7c503486828641d662",
"params": []
}
104. CallContractTransaction
Sample query
{
"contractId": "2sqPS2VAKmK77FoNakw1VtDTCbDSa7nqh5wTXvJeYGo2",
"fee": 10,
"sender": "3PKyW5FSn4fmdrLcUnDMRHVyoDBxybRgP58",
"type": 104,
"version": 1,
"params": [
{
"type": "integer",
"key": "a",
"value": 1
},
{
"type": "integer",
"key": "b",
"value": 100
}
]
}
Sample response
{
"type": 104,
"id": "9fBrL2n5TN473g1gNfoZqaAqAsAJCuHRHYxZpLexL3VP",
"sender": "3PKyW5FSn4fmdrLcUnDMRHVyoDBxybRgP58",
"senderPublicKey": "2YvzcVLrqLCqouVrFZynjfotEuPNV9GrdauNpgdWXLsq",
"fee": 10,
"timestamp": 1549365736923,
"proofs": [
"2q4cTBhDkEDkFxr7iYaHPAv1dzaKo5rDaTxPF5VHryyYTXxTPvN9Wb3YrsDYixKiUPXBnAyXzEcnKPFRCW9xVp4v"
],
"version": 1,
"contractId": "2sqPS2VAKmK77FoNakw1VtDTCbDSa7nqh5wTXvJeYGo2",
"params": [
{
"key": "a",
"type": "integer",
"value": 1
},
{
"key": "b",
"type": "integer",
"value": 100
}
]
}
105. ExecutedContractTransaction
Sample response
{
"type": 105,
"id": "2UAHvs4KsfBbRVPm2dCigWtqUHuaNQou83CXy6DGDiRa",
"sender": "3PKyW5FSn4fmdrLcUnDMRHVyoDBxybRgP58",
"senderPublicKey": "2YvzcVLrqLCqouVrFZynjfotEuPNV9GrdauNpgdWXLsq",
"fee": 500000,
"timestamp": 1549365523980,
"proofs": [
"4BoG6wQnYyZWyUKzAwh5n1184tsEWUqUTWmXMExvvCU95xgk4UFB8iCnHJ4GhvJm86REB69hKM7s2WLAwTSXquAs"
],
"version": 1,
"tx": {
"type": 103,
"id": "2sqPS2VAKmK77FoNakw1VtDTCbDSa7nqh5wTXvJeYGo2",
"sender": "3PKyW5FSn4fmdrLcUnDMRHVyoDBxybRgP58",
"senderPublicKey": "2YvzcVLrqLCqouVrFZynjfotEuPNV9GrdauNpgdWXLsq",
"fee": 500000,
"timestamp": 1549365501462,
"proofs": [
"2ZK1Y1ecfQXeWsS5sfcTLM5W1KA3kwi9Up2H7z3Q6yVzMeGxT9xWJT6jREQsmuDBcvk3DCCiWBdFHaxazU8pbo41"
],
"version": 1,
"image": "localhost:5000/contract256",
"imageHash": "930d18dacb4f49e07e2637a62115510f045da55ca16b9c7c503486828641d662",
"params": []
},
"results": []
}
106. DisableContractTransaction
Sample query
{
"senderPublicKey":"42jj4GA89Z2SncgzpxoocmWZChrpqhDGVKcJUctAGWJB2oSTQrZCQyzbvriDSFu5ZmCBsFutDyg9ES6WqqULyV5e",
"contractId":"Fz3wqAWWcPMT4M1q6H7crLKtToFJvbeLSvqjaU4ZwMpg",
"fee":0,
"timestamp":1549474811381,
"proofs":[
"4Dny2XwkXmoLN7emoqdFdjvvKdgnCBuA3XwGgBiWNkZBFXDpRfz36Cyp2CbpjrLBadCnuobbkK5wyM41FGU6yp6h"
],
"type":106
}
Sample response
{
"type" : 106,
"id" : "BwcVQeC9CdmeYxiWydc5NK1MSgqPqQmWYy4PJ6eqZDtP",
"sender" : "3HhXnbMuZAaCRr9L9hWSKwfNrcDR6CThJVB",
"senderPublicKey" : "42jj4GA89Z2SncgzpxoocmWZChrpqhDGVKcJUctAGWJB2oSTQrZCQyzbvriDSFu5ZmCBsFutDyg9ES6WqqULyV5e",
"fee" : 0,
"timestamp" : 1549474811381,
"proofs" : [ "4Dny2XwkXmoLN7emoqdFdjvvKdgnCBuA3XwGgBiWNkZBFXDpRfz36Cyp2CbpjrLBadCnuobbkK5wyM41FGU6yp6h" ],
"version" : 1,
"contractId" : "Fz3wqAWWcPMT4M1q6H7crLKtToFJvbeLSvqjaU4ZwMpg"
}
110. GenesisRegisterNode
Sample query
{
"type": 110,
"id": "2Xgbsqgfbp5fiq4nsaAoTkQsXc399tXdnKom8prEZqPW2Q7xZKNKCCqpkyMtmJMgYLpvwynbxHPTFpFEfFdyLpJ",
"fee": 0,
"timestamp": 1489352400000,
"signature": "2Xgbsqgfbp5fiq4nsaAoTkQsXc399tXdnKom8prEZqPW2Q7xZKNKCCqpkyMtmJMgYLpvwynbxHPTFpFEfFdyLpJ",
"targetPublicKey": "3JNLQYuHYSHZiHr5KjJ89wwFJpDMdrAEJpj",
"target": "3JNLQYuHYSHZiHr5KjJ89wwFJpDMdrAEJpj"
}
Sample response
{
"signature": "2Xgbsqgfbp5fiq4nsaAoTkQsXc399tXdnKom8prEZqPW2Q7xZKNKCCqpkyMtmJMgYLpvwynbxHPTFpFEfFdyLpJ",
"fee": 0,
"id": "2Xgbsqgfbp5fiq4nsaAoTkQsXc399tXdnKom8prEZqPW2Q7xZKNKCCqpkyMtmJMgYLpvwynbxHPTFpFEfFdyLpJ",
"type": 110,
"targetPublicKey": "3JNLQYuHYSHZiHr5KjJ89wwFJpDMdrAEJpj",
"timestamp": 1489352400000,
"target": "3JNLQYuHYSHZiHr5KjJ89wwFJpDMdrAEJpj",
"height": 1
}
111. RegisterNode
Sample query
{
"type": 111,
"opType": "add",
"sender":"3HYW75PpAeVukmbYo9PQ3mzSHdKUgEytUUz",
"targetPubKey": "apgJP9atQccdBPAgJPwH3NBVqYXrapgJP9atQccdBPAgJPwHapgJP9atQccdBPAgJPwHDKkh6A8",
"nodeName": "Node #1",
"fee": 500000,
"timestamp": 1557239100
}
112. CreatePolicy
Sample query
{
"type":112,
"sender":"3HYW75PpAeVukmbYo9PQ3mzSHdKUgEytUUz",
"description": "Policy for rusal internal nodes",
"policyName": "Policy name",
"timestamp": 1000000000,
"recipients": [ "3HSVTtjim3FmV21HWQ1LurMhFzjut7Aa1Ac", "3HYW75PpAeVukmbYo9PQ3mzSHdKUgEytUUz" ],
"owners": [ "3HYW75PpAeVukmbYo9PQ3mzSHdKUgEytUUz", "3HYW75PpAeVukmbYo9PQ3mzSHdKUgEytUUz" ]
}
113. UpdatePolicy
Sample query
{
"type":113,
"policyId": "45n2BC8TmobhH7zbog8ZsR1mcHSd1uU84UvWEoSbqQBH", // id of the existing policy otherwise it occurs the error "Object with policyId = <reqest id> does not exist"
"sender":"3HYW75PpAeVukmbYo9PQ3mzSHdKUgEytUUz",
"timestamp": 1000000000,
"opType": "add", // or "remove" when removing participants from policy
"recipients": [ "3HSVTtjim3FmV21HWQ1LurMhFzjut7Aa1Ac", "3HYW75PpAeVukmbYo9PQ3mzSHdKUgEytUUz" ],
"owners": [ "3HYW75PpAeVukmbYo9PQ3mzSHdKUgEytUUz", "3HYW75PpAeVukmbYo9PQ3mzSHdKUgEytUUz" ]
}
114. PolicyDataHash
Sample query
{
"type":114,
"sender":"3HYW75PpAeVukmbYo9PQ3mzSHdKUgEytUUz",
"timestamp": 1000000000,
"policyId": "45n2BC8TmobhH7zbog8ZsR1mcHSd1uU84UvWEoSbqQBH",
"hash": "ad2a814482df0dd0d2cf6321f535be720caa7b3aa1289b0575f60d7a5e109631",
}
POST /transactions/broadcast¶
Sends a signed transaction to blockchain.
Method Query
{
"type":10,
"senderPublicKey":"G6h72icCSjdW2A89QWDb37hyXJoYKq3XuCUJY2joS3EU",
"fee":100000000,
"timestamp":46305781705234713,
"signature":"4gQyPXzJFEzMbsCd9u5n3B2WauEc4172ssyrXCL882oNa8NfNihnpKianHXrHWnZs1RzDLbQ9rcRYnSqxKWfEPJG",
"alias":"dajzmj6gfuzmbfnhamsbuxivc"
}
Method Response
{
"type":10,
"id":"9q7X84wFuVvKqRdDQeWbtBmpsHt9SXFbvPPtUuKBVxxr",
"sender":"3MtrNP7AkTRuBhX4CBti6iT21pQpEnmHtyw",
"senderPublicKey":"G6h72icCSjdW2A89QWDb37hyXJoYKq3XuCUJY2joS3EU",
"fee":100000000,
"timestamp":46305781705234713,
"signature":"4gQyPXzJFEzMbsCd9u5n3B2WauEc4172ssyrXCL882oNa8NfNihnpKianHXrHWnZs1RzDLbQ9rcRYnSqxKWfEPJG",
"alias":"dajzmj6gfuzmbfnhamsbuxivc"
}