Pages:
Author

Topic: [Nxt] API of Nxt (Read 37320 times)

sr. member
Activity: 294
Merit: 250
October 03, 2014, 04:19:30 AM
the blockchain was corrupt  Angry

?? When?
member
Activity: 84
Merit: 10
October 02, 2014, 12:33:55 PM
the blockchain was corrupt  Angry
sr. member
Activity: 294
Merit: 250
September 16, 2014, 06:10:12 PM
We need stake holder API (AE)  Grin
member
Activity: 105
Merit: 10
September 11, 2014, 01:59:48 AM
I created one, just finishing browser support https://github.com/pocesar/node-nxt-api
sr. member
Activity: 364
Merit: 250
☕ NXT-4BTE-8Y4K-CDS2-6TB82
August 01, 2014, 11:20:03 AM
ah. I backtraced and found where/how I did a copy/paste error.

ok so the system doesnt prevent you from doing anything dumb.  will this be fixed in the future?

And it really would be useful to see the balance of assets, not just of NXT.

Core doesn't prevent from doing dumb things, client soft is supposed to do it.

I'll add asset balance API.
Was this ever done?

Go here: http://localhost:7876/test and look for "getAccount".
sr. member
Activity: 378
Merit: 254
small fry
August 01, 2014, 10:05:09 AM
ah. I backtraced and found where/how I did a copy/paste error.

ok so the system doesnt prevent you from doing anything dumb.  will this be fixed in the future?

And it really would be useful to see the balance of assets, not just of NXT.

Core doesn't prevent from doing dumb things, client soft is supposed to do it.

I'll add asset balance API.
Was this ever done?
member
Activity: 70
Merit: 10
April 28, 2014, 09:13:42 PM
Never mind, found it.It turns out I just had to change the request type to POST, the parameters still travel via URL (this is silly). In case you wonder the full command is:

curl --data-binary '' "http://my-host.com/nxt?requestType=getAccountId&secretPhrase=whatever-is-clever"
member
Activity: 70
Merit: 10
April 28, 2014, 09:08:11 PM
Hey guys, what is the POST equivalent of this call:

curl "http://my-host.com/nxt?requestType=getAccountId&secretPhrase=whatever-is-clever"


I've tried:

curl --data-binary '{"requestType": "getAccountId", "secretPhrase":"whatever-is-clever"}' http://my-host.com/nxt

but it does not work
rlh
hero member
Activity: 804
Merit: 1004
April 24, 2014, 09:38:19 PM
Thank you.  I found the info on the Wiki (doh!)

See here: http://wiki.nxtcrypto.org/wiki/Nxt_API
hero member
Activity: 1110
Merit: 534
April 24, 2014, 07:21:40 PM
Is this the best place for all information associated with the API?  Is there a better resource for all updates and calls to the API?


Hello.

There is also another thread regarding NXT API.
Check this one:
https://bitcointalksearch.org/topic/nxt-api-2-brainstorming-406839

or maybe is better that you go to the nxt forum at
https://nxtforum.org/

Almost all NXT discussion has moved there.


rlh
hero member
Activity: 804
Merit: 1004
April 24, 2014, 03:53:44 PM
Is this the best place for all information associated with the API?  Is there a better resource for all updates and calls to the API?
full member
Activity: 238
Merit: 100
March 14, 2014, 11:26:32 AM
Do you devs yet have any ideas on the APIs that will be involved in leasing effectiveBalance?  In order to assist with remediation, hopefully there will be something more than just leasing and recalling your effectiveBalance.  From the leasee's perspective, upon generating a block and receiving fees, it will be necessary to determine each individual effectiveBalance it is leasing as of 1440 blocks before the pool's generated block, and to then make sure that each effectiveBalance never went down during the next 1440 blocks.

So Ill propose an API to allow an account to request a list of all accounts leased out to it as of a certain block.  Or if you are feeling generous, with this info, also provide the effectiveBalance of each account at that certain block.  Or possibly even something similar to guaranteedBalance that lists a guaranteedEffectiveBalance of 1440 blocks as of a certain block of all effectiveBalance's that you are leasing.  Now that would be IDEAL
legendary
Activity: 1181
Merit: 1018
March 02, 2014, 12:13:08 PM
you have to specifically enable SSL.  and when you do that, you MUST use SSL.  also when you do that, I believe you MUST EITHER create your own self-signed cert or you must purchase a signed cert.  I dont believe the NRS version  comes with the old 2008 SSL cert it used to come with
  look in wiki howto for guide on certs

thanks for the hint - I created a cert according to the wiki, but the most pat is for running a node yourself and how to set up NRS to ACCEPT connections.

So now I am trying to get my requests(POST) to use the cert to connect to the testnet - I'll keep trying


sorry guys - I am not getting anywhere. is the testnet API connect running on port 6876?

do I have to use a local cert that I supply in my local nxtClient folder?

 I don't want to clog up the main thread, so I'll try to posting here - maybe some of you other client devs can give me a few hints:
 
Am I correct with assuming that to connect with the testnet, I have to use and port 6876 ? as in my local net it is http://192.168.178.24:7876/ , but what confuses me is that in the local net it is http - surely that is set in the conf file, and a node open to the net will not

use http - but then again I am stuck with the problem of constructing proper POST requests. Does my requests lib have to provide a user cert? There are hooks for that in the lib..

seems most of my issues were related to the testnet  -  debugging can also be often a learning experience - unpleasant, but now pain no gain  Grin
full member
Activity: 238
Merit: 100
March 02, 2014, 11:16:19 AM
you have to specifically enable SSL.  and when you do that, you MUST use SSL.  also when you do that, I believe you MUST EITHER create your own self-signed cert or you must purchase a signed cert.  I dont believe the NRS version  comes with the old 2008 SSL cert it used to come with
  look in wiki howto for guide on certs
legendary
Activity: 1181
Merit: 1018
March 02, 2014, 10:41:13 AM
hey Guys - I seem to be having an issue with getting proper POST requests to work...

I can connect on localhost, but any remote connect does not work, e.g. on the testnet or on raspi in my local net ...

I know I am missing something obvious here, but as I say, I am a science programmer, and not so much a web programmer

Do I have to use http or https?
 
as far as I understand, the entry '*' in the conf should be enough to connect



#### API SERVER ####

# Accept http/json API requests.
nxt.enableAPIServer=true

# Hosts from which to allow http/json API requests, if enabled.
nxt.allowedBotHosts=*
 
# Port for http/json API requests.
nxt.apiServerPort=7876


In my localnet, I can connect to my raspi at http://192.168.178.24:7876

when I try https I get: requests.exceptions.SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:548)


when I try testnet, the python just dies - what is different on the testnet???




member
Activity: 83
Merit: 10
March 02, 2014, 12:38:24 AM
Does a javascript transactions lib exist, ala bitcoinjs?
full member
Activity: 236
Merit: 100
full member
Activity: 224
Merit: 100
March 01, 2014, 09:14:30 AM
Maybe I am making a false assumption here.

Is there an order defined on the transactionsIDs returned by

getAccountTransactionIds&account=×tamp=

?

If so, always, even with =0?
full member
Activity: 224
Merit: 100
March 01, 2014, 08:47:13 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.

I am caching existing transactions with more than 720 confirmations. The problem I described is only with getting transactions for the first time.

The solution you describe is more of a workaround. I would need to define how many transactions to fetch for the user and then use

getAccountTransactionIds&account=×tamp=

with varying timestamps to get roughly as many transactionIDs as I want and then fetch the details for these IDs. There is no order defined in the list of transactionsIDs returned with getAccountTransactionIds, so I can't just fetch the details for the first X transactions.

The timestamp parameter is more for getting new transactions since the last fetch.

Again, this is a workaround and I suggest to look at how all the exchanges implemented their APIs. They make no separation between getting IDs first and then fetching trade/order details, but you simply specify index values and/or timestamp values and receive all details in one batch reply with one call. This does scale nicely.

full member
Activity: 236
Merit: 100
March 01, 2014, 08:17:20 AM
bug reports

1. assetid= 9458407878065988264 AuroraCoin ( other tester issued this asset)
quantity=90, price=100 (other tester placed this ask order)

2. i place a bid order
quantity=120, price=100

3. left quantity is ok in bid order
quantity=30, price=100

4. cancel this bid order
quantity=30, price=100

5. but ask order show like this
quantity=30, price=100
i think should show noting


btw, i have trouble getting my balance detail, i don't know how many assets matched from api.
if api can return matched quantity and price, get balance detail may be simple.

there are subtype values in asset  api
type =2
subtype=1 issue asset
             2 ask order
             3 bid order
             4 cancel ask order
             5 cancel bid order


Pages:
Jump to: