Skip to content

getTransaction

katz edited this page Aug 18, 2020 · 10 revisions

The getTransaction method returns information about a particular transaction. A transaction consists of one or more transfers. A transfer is an amount-address pair. There could be several transfers in a single transaction.

Request Format

JSON-RPC

{  
 "params":{  
      "transactionHash":"495f5944490c0ae76eee4c5634a1f9374d7406e728d45fabc4972f997c5e115d"
   },
   "method":"getTransaction"
 }
```
 
Request Details:

| Argument        | Mandatory | Description                       | Format | Example |
|-----------------|-----------|-----------------------------------|--------|---------|
| transactionHash | Yes       | Hash of the requested transaction | string | example |


### Response Format:

JSON-RPC
```javascript
{
    "jsonrpc": "2.0",
    "result": {
        "transaction": {
            "amount": -1000,
            "blockIndex": 488775,
            "confirmations": 55366,
            "depositCount": 1,
            "extra": "01e3efcba7dba9af50475b23ae5082b0a9ad87c1f094c64dac7a9ce80b9f05ecc4",
            "fee": 1000,
            "firstDepositId": 2,
            "isBase": false,
            "paymentId": "",
            "state": 0,
            "timestamp": 1587386789,
            "transactionHash": "495f5944490c0ae76eee4c5634a1f9374d7406e728d45fabc4972f997c5e115d",
            "transfers": [
                {
                    "address": "ccx7Xh4S7w3RtRbmfv3BaTNMZcbZLu8VShwvmGGBYovyUvhRHiWE4K7K174vDU5hw2eXjGwyiC8JfT3vPaUSmg9g1utGShBrGS",
                    "amount": -7000000,
                    "message": "",
                    "type": 0
                },
                {
                    "address": "ccx7Xh4S7w3RtRbmfv3BaTNMZcbZLu8VShwvmGGBYovyUvhRHiWE4K7K174vDU5hw2eXjGwyiC8JfT3vPaUSmg9g1utGShBrGS",
                    "amount": 6999000,
                    "message": "",
                    "type": 0
                }
            ],
            "unlockTime": 0
        }
    }
}
```

Response Details:

| Argument    | Description                                                                                          | Format | Example   |
|-------------|------------------------------------------------------------------------------------------------------|--------|-----------|
| transaction | Contains (see table below)                                                                           | array  | See below |                                                                                        

| Argument          | Format  | Description                                                                |
|-------------------|---------|----------------------------------------------------------------------------|
| transactionHash   | string  | hash of the transaction                                                    |
| blockIndex        | uint32  | number of the block that contains a transaction (optional)                 |
| depositCount         | uint64  | Number of deposits in the transactions                       |
| firstDepositId        | uint64  | The depositId of the first deposit in the transaction                    |
| isBase            | boolean | shows if the transaction is a coinbase transaction or not                  |
| unlockTime        | uint64  | height of the block when transaction is going to be available for spending |
| amount            | int64   | amount of the transaction                                                  |
| fee               | uint64  | transaction fee                                                            |
| extra             | string  |                                                                            |
| paymentId         | string  | payment_id of the transaction (optional)                                   |
| transfers         | array   | contains `address` - string; `amount` - int64                              |

### Possible Errors:
Clone this wiki locally