Pages:
Author

Topic: [Nxt] API of Nxt - page 2. (Read 37336 times)

sr. member
Activity: 308
Merit: 250
March 01, 2014, 07:15:12 AM
yes, I concur with the &state=1 modification to the getPeers API.  IF only to support light-clients.

Well, peers are nice to look at, but not vital. Transactions, orders and trades are.

Just like a new user, I've just added an existing account in my client and retrieving the ~6000 acount transactions for the first time took like 20 minutes... This is not going to fly...

I've tried this with a nextbase node running 0.7.6 and my own remote node on 0.8.2e with roughly the same result. Getting these transactions from a local node takes around 14 seconds.  Shocked

Load on demand, you need not get all 6000 transactions at once. Only if the user scrolls to the end of the table, you can fetch new ones. So limit to 100 transactions at start or something. You can also cache transactions with more than > 1440 ?  confirmations.
full member
Activity: 224
Merit: 100
February 26, 2014, 11:33:11 AM
yes, I concur with the &state=1 modification to the getPeers API.  IF only to support light-clients.

Well, peers are nice to look at, but not vital. Transactions, orders and trades are.

Just like a new user, I've just added an existing account in my client and retrieving the ~6000 acount transactions for the first time took like 20 minutes... This is not going to fly...

I've tried this with a nextbase node running 0.7.6 and my own remote node on 0.8.2e with roughly the same result. Getting these transactions from a local node takes around 14 seconds.  Shocked
full member
Activity: 238
Merit: 100
February 26, 2014, 09:54:39 AM
API, Latency and batch mode:

I've been rewriting my client to do client-side signing and connect to a random public node and I am now running into latency problems.

E.g. for showing a detailed list of peers I need to call getPeers and the cycle over all returned peers and call getPeer&peer=PEERNAME.

For long running public nodes like nodeX1.nxtbase.com getPeers returns 1000, 2000 or more peers and my client has to do that many back and fourth requests. This was no problem when running NRS locally, but it is a problem with remote hosts.

This might not be a a huge problem for peers (I could simply drop the peer list in my client), but it will be a problem for getting account transactions, asset trades and asset orders. This will simply not scale.

Proposal:

Offer batch mode API calls, e.g.:

getPeersDetail returning

{"peers":
  [{"shareAddress":true,"platform":"PC","application":"NRS","weight":0,"state":2,"announcedAddress":"199.217.117.152","downloadedVolume":379,"version":"0.7.3","uploadedVolume":12647},
  ...
  ]
}

For peers it might make sense to add a filter option like "state=1" to only get the connected peers.

Similiar batch calls would make sense for getting account transactions, orders and trades, probably together with startIndex/endIndex or startDate/endDate where applicable.


yes, I concur with the &state=1 modification to the getPeers API.  IF only to support light-clients.
full member
Activity: 224
Merit: 100
February 26, 2014, 02:41:40 AM
API, Latency and batch mode:

I've been rewriting my client to do client-side signing and connect to a random public node and I am now running into latency problems.

E.g. for showing a detailed list of peers I need to call getPeers and the cycle over all returned peers and call getPeer&peer=PEERNAME.

For long running public nodes like nodeX1.nxtbase.com getPeers returns 1000, 2000 or more peers and my client has to do that many back and fourth requests. This was no problem when running NRS locally, but it is a problem with remote hosts.

This might not be a a huge problem for peers (I could simply drop the peer list in my client), but it will be a problem for getting account transactions, asset trades and asset orders. This will simply not scale.

Proposal:

Offer batch mode API calls, e.g.:

getPeersDetail returning

{"peers":
  [{"shareAddress":true,"platform":"PC","application":"NRS","weight":0,"state":2,"announcedAddress":"199.217.117.152","downloadedVolume":379,"version":"0.7.3","uploadedVolume":12647},
  ...
  ]
}

For peers it might make sense to add a filter option like "state=1" to only get the connected peers.

Similiar batch calls would make sense for getting account transactions, orders and trades, probably together with startIndex/endIndex or startDate/endDate where applicable.
hero member
Activity: 750
Merit: 500
www.coinschedule.com
February 24, 2014, 05:58:31 PM
Is there a limit on how many accounts can forge on the same NRS using the http://localhost:7876/nxt?requestType=START_OR_STOP&secretPhrase=SECRET?
legendary
Activity: 2142
Merit: 1010
Newbie
February 24, 2014, 11:31:25 AM
Bug in 0.8.0e:

http://127.0.0.1:7876/nxt?requestType=getPeer&peer=node45.nxtbase.com

returns:

{"platform":"22k.io","application":"NRS","weight":78879,"hallmark":nxt.peer.Hallmark@1e85e47e,"state":1,"announcedAddress":"node45.nxtbase.com","downloadedVolume":3084,"version":"0.7.6","uploadedVolume":7320}

This is malformatted json, due to the hallmark value.

I'm not sure if Jean-Luc reads this thread. U should point him to this bug, coz I don't work on experimental builds.
full member
Activity: 224
Merit: 100
February 24, 2014, 10:21:55 AM
Bug in 0.8.0e:

http://127.0.0.1:7876/nxt?requestType=getPeer&peer=node45.nxtbase.com

returns:

{"platform":"22k.io","application":"NRS","weight":78879,"hallmark":nxt.peer.Hallmark@1e85e47e,"state":1,"announcedAddress":"node45.nxtbase.com","downloadedVolume":3084,"version":"0.7.6","uploadedVolume":7320}

This is malformatted json, due to the hallmark value.

Edit: Also in 0.8.1.e.
full member
Activity: 224
Merit: 100
February 24, 2014, 06:49:35 AM
NRS returns a transaction ID, so it's not "Not enough funds".

I can only run this in testnet, so I don't see the debugging output...

NRS would return id in any case. Well, let's wait for the update and check again.

Got it to work.

The assetID 18018524522923576964 maps to these bytes in the transaction: 844e865d96a80efa

I had to typecast the uInt64 asset ID to int64 to get this hex representation.
legendary
Activity: 2142
Merit: 1010
Newbie
February 23, 2014, 05:05:29 PM
NRS returns a transaction ID, so it's not "Not enough funds".

I can only run this in testnet, so I don't see the debugging output...

NRS would return id in any case. Well, let's wait for the update and check again.
full member
Activity: 224
Merit: 100
February 23, 2014, 04:42:10 PM
Bytes:
020134467800A0055AE68D12CEC8065BED3B2502EDBF41D6FE0C05CD106C8607C637F94FB69E433 DA0860100000000000000000001000000000000000000000053CE6520A8C3B1DD03640106564166 662BD514C1B2B421E3378A56BE9C11BF0DE73E819021C7EDBDA6D391354ECB44F166D90E5914484 3B63BEBA4D288D25C2B844E865D96A80EFA02000000



Maybe "Not enough funds" error? What debuging shows?

NRS returns a transaction ID, so it's not "Not enough funds".

I can only run this in testnet, so I don't see the debugging output...
legendary
Activity: 2142
Merit: 1010
Newbie
February 23, 2014, 04:33:20 PM
Bytes:
020134467800A0055AE68D12CEC8065BED3B2502EDBF41D6FE0C05CD106C8607C637F94FB69E433 DA0860100000000000000000001000000000000000000000053CE6520A8C3B1DD03640106564166 662BD514C1B2B421E3378A56BE9C11BF0DE73E819021C7EDBDA6D391354ECB44F166D90E5914484 3B63BEBA4D288D25C2B844E865D96A80EFA02000000



Maybe "Not enough funds" error? What debuging shows?
legendary
Activity: 2212
Merit: 1199
February 23, 2014, 02:56:32 PM
Is the broadcastTransaction API call functional?

I've implemented the client-side signing. My transaction verifies successfull against my Curve code, and it is accepted by NRS:

Code:
[2014-02-22 21:03:50.839] DEBUG: Broadcasted new transaction 5198035352813641840

However, the transaction never shows up in my client or in BC Explorer online.



What r the bytes?

Found the problem. The signature bytes were all zero. It now works and I just sent my first client signed transaction. :-)

solved ! Great!
full member
Activity: 224
Merit: 100
February 23, 2014, 06:57:38 AM
Can you point me to the transaction format for the asset exchange transactions (issueAsset, transferAsset, placeAskOrder, placeBidOrder, cancelAskOrder and cancelBidOrder)?

EDIT: Also, with my own Curve implementation, how do I get the account number for a secret, so that I don't have to use "getAccountId&secretPhrase=..." any longer? Is it an operation on the account's publicKey?

EDIT2: found the answer to my 2nd question. PUBLIC KEY -> SHA256 -> (TAKE LOWER 8 BYTES) -> 64bit Account ID


Still need the asset exchange transaction formats. :-)

EDIT3:

Decompiled the Java code and I got issueAsset to work.

transferAsset transaction in the testnet does not show up in the network. Here's an example:

Asset transfer - From Sender: 13266890203335482459 Recipient: 100000 Asset: 18018524522923576964 Quantity: 2 Fee: 1 Deadline: 1440

Bytes:
020134467800A0055AE68D12CEC8065BED3B2502EDBF41D6FE0C05CD106C8607C637F94FB69E433 DA0860100000000000000000001000000000000000000000053CE6520A8C3B1DD03640106564166 662BD514C1B2B421E3378A56BE9C11BF0DE73E819021C7EDBDA6D391354ECB44F166D90E5914484 3B63BEBA4D288D25C2B844E865D96A80EFA02000000



full member
Activity: 224
Merit: 100
February 22, 2014, 04:28:31 PM
Is the broadcastTransaction API call functional?

I've implemented the client-side signing. My transaction verifies successfull against my Curve code, and it is accepted by NRS:

Code:
[2014-02-22 21:03:50.839] DEBUG: Broadcasted new transaction 5198035352813641840

However, the transaction never shows up in my client or in BC Explorer online.



What r the bytes?

Found the problem. The signature bytes were all zero. It now works and I just sent my first client signed transaction. :-)
legendary
Activity: 2142
Merit: 1010
Newbie
February 22, 2014, 04:02:50 PM
Is the broadcastTransaction API call functional?

I've implemented the client-side signing. My transaction verifies successfull against my Curve code, and it is accepted by NRS:

Code:
[2014-02-22 21:03:50.839] DEBUG: Broadcasted new transaction 5198035352813641840

However, the transaction never shows up in my client or in BC Explorer online.



What r the bytes?
full member
Activity: 224
Merit: 100
February 22, 2014, 03:07:23 PM
Is the broadcastTransaction API call functional?

I've implemented the client-side signing. My transaction verifies successfull against my Curve code, and it is accepted by NRS:

Code:
[2014-02-22 21:03:50.839] DEBUG: Broadcasted new transaction 5198035352813641840

However, the transaction never shows up in my client or in BC Explorer online.

hero member
Activity: 750
Merit: 500
www.coinschedule.com
February 20, 2014, 09:26:32 AM
Excellent, thanks.

How do I sign the whole thing (which algo)?

Do u need Java or JavaScript?

Javascript
legendary
Activity: 2142
Merit: 1010
Newbie
February 20, 2014, 09:12:30 AM
Excellent, thanks.

How do I sign the whole thing (which algo)?

Do u need Java or JavaScript?
hero member
Activity: 750
Merit: 500
www.coinschedule.com
February 20, 2014, 09:11:46 AM
The only one I need right now is SEND NXT.

All numbers r little-endian.

01 B - type (00)
01 B - subtype (00)
04 B - timestamp (671e7400)
02 B - deadline (3c00)
32 B - sender public key (b1c9e22befa06aee2eb0ac2d13ad03df02abf7cdd5fb8c9903b74f65819eb84d)
08 B - recipient (252ab2f000b58ef7)
04 B - amount (e8030000)
04 B - fee (01000000)
08 B - referenced transaction (0000000000000000)
64 B - signature (a56d7368c792df694c72fcaf731544c4b710c9de4e906105cdb25b15fc10d1052c9fac66383c553 6500cea0782db28535c25095758029cb4d465b13f8850cf1e)

I used transaction 1360173339660761930 as the example (http://localhost:7874/nxt?requestType=getTransactionBytes&transaction=1360173339660761930)

NB: Before signing u must replace signature with ZEROs and sign the whole 128 bytes.

Excellent, thanks.

How do I sign the whole thing (which algo)?
Pages:
Jump to: