elective-stereophonic
elective-stereophonic
Get >100 blocks  
Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest Stable Nxt Client: Nxt 1.12.2

Author Topic: Get >100 blocks  (Read 1889 times)

EmoneyRu

  • Hero Member
  • *****
  • Karma: +31/-2
  • Offline Offline
  • Posts: 537
  • techDevComm
    • View Profile
    • Nxt Kit
Get >100 blocks
« on: February 26, 2015, 01:26:04 pm »

verymuchso

  • Hero Member
  • *****
  • Karma: +118/-2
  • Offline Offline
  • Posts: 549
    • View Profile
    • HEAT Ledger
Re: Get >100 blocks
« Reply #1 on: February 26, 2015, 01:39:57 pm »

Logged
HEAT: DEX | SDK | HOME

EmoneyRu

  • Hero Member
  • *****
  • Karma: +31/-2
  • Offline Offline
  • Posts: 537
  • techDevComm
    • View Profile
    • Nxt Kit
Re: Get >100 blocks
« Reply #2 on: February 27, 2015, 03:56:42 am »

100 is max @see https://github.com/fimkrypto/nxt/blob/master/src/java/nxt/http/GetBlocks.java#L26

It means that there is no easy way to download 200 blocks. Even if I automatically split request to http://localhost:7876/nxt?requestType=getBlocks&firstIndex=0&lastIndex=99 and http://localhost:7876/nxt?requestType=getBlocks&firstIndex=100&lastIndex=199 there is no guarantee that no new block will be generated between these two requests. I will require handling special cases and specially downloading some blocks.

I think it makes difficulties for the exchanges.

Riker

  • Core Dev
  • Hero Member
  • *****
  • Karma: +440/-42
  • Offline Offline
  • Posts: 1796
    • View Profile
Re: Get >100 blocks
« Reply #3 on: February 27, 2015, 07:32:32 am »

Do you need to use the includeTransactions parameter ?
If not perhaps we can increase this number when includeTransactions = false since just reading the blocks without transactions shouldn't bee too stressful.
What would be a reasonable limit ? 1440 ?
Logged
NXT Core Dev
Account: NXT-HBFW-X8TE-WXPW-DZFAG
Public Key: D8311651 Key fingerprint: 0560 443B 035C EE08 0EC0  D2DD 275E 94A7 D831 1651

EmoneyRu

  • Hero Member
  • *****
  • Karma: +31/-2
  • Offline Offline
  • Posts: 537
  • techDevComm
    • View Profile
    • Nxt Kit
Re: Get >100 blocks
« Reply #4 on: February 27, 2015, 08:34:55 am »

Do you need to use the includeTransactions parameter ?
If not perhaps we can increase this number when includeTransactions = false since just reading the blocks without transactions shouldn't bee too stressful.
What would be a reasonable limit ? 1440 ?

Use case: I need to know all generators of blocks from 352330 to 367999. I lack for an API to request blocks from height1 to height2. I even agree for the limit of 100 blocks per request (btw, I includeTransactions = false for me so more blocks will be good).

Riker

  • Core Dev
  • Hero Member
  • *****
  • Karma: +440/-42
  • Offline Offline
  • Posts: 1796
    • View Profile
Re: Get >100 blocks
« Reply #5 on: February 27, 2015, 08:57:01 am »

Do you need to use the includeTransactions parameter ?
If not perhaps we can increase this number when includeTransactions = false since just reading the blocks without transactions shouldn't bee too stressful.
What would be a reasonable limit ? 1440 ?

Use case: I need to know all generators of blocks from 352330 to 367999. I lack for an API to request blocks from height1 to height2. I even agree for the limit of 100 blocks per request (btw, I includeTransactions = false for me so more blocks will be good).

You can use the PeerServlet API (on port 7874) requests getNextBlocks and/or getNextBlockIds. These APIs accept a single parameter blockId and return either the next 720 blocks or 1440 block ids respectively. Start from the blockId of block height 352330 then iterate the blockchain until you reach block 367999.
Logged
NXT Core Dev
Account: NXT-HBFW-X8TE-WXPW-DZFAG
Public Key: D8311651 Key fingerprint: 0560 443B 035C EE08 0EC0  D2DD 275E 94A7 D831 1651

Jean-Luc

  • Core Dev
  • Hero Member
  • *****
  • Karma: +816/-81
  • Offline Offline
  • Posts: 1610
    • View Profile
Re: Get >100 blocks
« Reply #6 on: February 27, 2015, 06:27:43 pm »

I made the restriction more general, but more flexible. All APIs that support pagination using firstIndex, lastIndex parameters will be limited to return at most nxt.maxAPIRecords records (default 100), unless admin password is provided, or is not needed (either disabled or the API is accessible from localhost only, the default).
Logged
GPG key fingerprint: 263A 9EB0 29CF C77A 3D06  FD13 811D 6940 E1E4 240C
NXT-X4LF-9A4G-WN9Z-2R322
 

elective-stereophonic
elective-stereophonic
assembly
assembly