Get transactions - Bytecoin RPC Wallet API

From Bytecoin Wiki
Jump to: navigation, search

getTransactions() method returns an array of block and transaction hashes.

Transaction consists of transfers. Transfer is an amount-address pair. There could be several transfers in a single transaction.


Input:

Argument Mandatory Description Format Example
addresses No Array of strings, where each string is an address array See below
blockHash Only one of these parameters (blockHash or firstBlockIndex) is allowed. Hash of the starting block string 8fa07712cbf22c263834c0ac9a3f05058856a1fa7fa3d3eda332f63519b23bd1
firstBlockIndex Only one of these parameters (blockHash or firstBlockIndex) is allowed. Starting height uint32 123123
blockCount Yes Number of blocks to return transaction hashes from uint32 20
paymentId No Valid payment_id string somePaymentId


Note: if paymentId parameter is set, getTransactions() method returns transactions that contain specified payment_id. (in the set block range)

Note: if addresses parameter is set, getTransactions() method returns transactions that contain transfer from at least one of specified addresses.

Note: if both above mentioned parameters are set, getTransactions() method returns transactions that contain both specified payment_id and transfer from at least one of specified addresses.


Output:

Argument Description Format Example
items Array that contains:
  • block_hash - string - hash of the block which contains a transaction
  • transactions - array - contains
    • transactionHash - string - hash of the transaction
    • blockIndex - uint32 - number of the block that contains a transaction
    • timestamp - uint64 - timestamp of 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
array See below


Input example:

{  
  'params':{  
     'blockCount':1000,
     'firstBlockIndex':1,
     'addresses':[  
        '22p4wUHAMndSscvtYErtqUaYrcUTvrZ9zhWwxc3JtkBHAnw4FJqenZyaePSApKWwJ5BjCJz1fKJoA6QHn5j6bVHg8A8dyhp',
        '261K6FuYL4vYvLFQx2ene92JNHip8YGyJGHCCNjPwoFE2RsRYwtzPC7aePSApKWwJ5BjCJz1fKJoA6QHn5j6bVHg8DRRpU1',
        '2AVwwZ6Ju6gGeztrtHjsj42xWLavrXPN1PrpnNKGXCMcLACj2WhGqYwaePSApKWwJ5BjCJz1fKJoA6QHn5j6bVHg8A4Z9K8'
     ],
     paymentId:'somePaymentId'
  },
  'jsonrpc':'2.0',
  'id':'test',
  'method':'getTransactions'
}

Output example:

{  
  'jsonrpc':'2.0',
  'id':'test',
  'result':{  
     'items':[  
        {  
           'blockHash':'01bd06ca731914f27e143bbb902ce0bc05bff13d76faa027ea817e68f217488c',
           'transactions':[  
              {  
                 'fee':-70368475742208,
                 'extra':'0127cea59bfadc49aa02ed4a225936671e55607b5241621abca2a5e14405906dbb',
                 'timestamp':1446029698,
                 'blockIndex':1,
                 'state':0,
                 'transactionHash':'06ec210a8359f253f8b2160a0d6040cf89f2a05a553aaa577b7f508ee5d831f9',
                 'amount':70368475742208,
                 'unlockTime':11,
                 'transfers':[  
                    {  
                       'amount':70368475742208,
                       'type':0,
                       'address':'22p4wUHAMndSscvtYErtqUaYrcUTvrZ9zhWwxc3JtkBHAnw4FJqenZyaePSApKWwJ5BjCJz1fKJoA6QHn5j6bVHg8A8dyhp'
                    }
                 ],
                 'paymentId':,
                 'isBase':True
              }
           ]
        },
        {  
           'blockHash':'28aa7d32f4274f6387969d7671bd4db98fd871bf0dd510a1df5e2ef4b1d41a35',
           'transactions':[  
              {  
                 'fee':-70368207307776,
                 'extra':'01a8e6e408282b2ddf343e20d5e9aab283723ba10ab7ab7b3131f6981b02a84431',
                 'timestamp':1446029698,
                 'blockIndex':2,
                 'state':0,
                 'transactionHash':'922d00d2e6eaed63f62d8e3b968cb08b6ea5c555fe0e6af948ab06efe6eb213a',
                 'amount':70368207307776,
                 'unlockTime':12,
                 'transfers':[  
                    {  
                       'amount':70368207307776,
                       'type':0,
                       'address':'22p4wUHAMndSscvtYErtqUaYrcUTvrZ9zhWwxc3JtkBHAnw4FJqenZyaePSApKWwJ5BjCJz1fKJoA6QHn5j6bVHg8A8dyhp'
                    }
                 ],
                 'paymentId':,
                 'isBase':True
              }
           ]
        }
     ]
  }
}
Personal tools
Namespaces

Variants
Actions
Navigation
Tools