Pages:
Author

Topic: [Nxt] API of Nxt - page 8. (Read 37374 times)

legendary
Activity: 1240
Merit: 1001
Thank God I'm an atheist
January 16, 2014, 05:47:30 AM
When Nxt price will skyrocket we'll have to change the APIs to allow fee expressed in Nxt-cents or transactions will cost too much.

I think it's easier make now such an incompatible change than later when there will be a larger userbase...

It might be useful add more decimals than just 2.
full member
Activity: 224
Merit: 100
January 15, 2014, 09:22:36 AM
It would be cool if getBalance would accept a timestamp parameter so that you could get an account balance at a certain point in time.
legendary
Activity: 2142
Merit: 1010
Newbie
January 15, 2014, 09:14:03 AM
There is nothing in the core that prevents me sending NXT or messages from one sender address to the same recipient address.

Is it ok, if I make use of this? Or will this be forbidden in the future?

It's ok.
full member
Activity: 224
Merit: 100
January 15, 2014, 08:29:23 AM
There is nothing in the core that prevents me sending NXT or messages from one sender address to the same recipient address.

Is it ok, if I make use of this? Or will this be forbidden in the future?
legendary
Activity: 2142
Merit: 1010
Newbie
January 15, 2014, 01:31:55 AM
Good idea. We can't change existing API calls, but next API will follow ur proposal.
member
Activity: 112
Merit: 10
January 14, 2014, 06:05:49 PM
I think it is necessary to use the same mode of representing the amounts in API's.

I personally think the right should be getBalance():

URL: http://localhost:7874/nxt?requestType=getBalance&account=9415965710853847055
RETURN: {"balance":217500,"effectiveBalance":217500,"unconfirmedBalance":217500}

217500 / 100 = 2175.00 NXT   All right!

However when we see a transaction with GetTransaction().

URL: http://localhost:7874/nxt?requestType=getTransaction&transaction=7613663286249813916
RETURN: {"sender":"16999902190493953875","fee":1,"amount":1,"timestamp":3150358,"referencedTransaction":"0","confirmations":12580,"subtype":0,
"block":"2365176096112318374", "senderPublicKey":"66538....77a579","type":0,"deadline":1000,
"signature":"e9619.....937639","recipient":"9415965710853847055"}

It this is wrong! should return:

RETURN: {"sender":"16999902190493953875","fee":100,"amount":100,"timestamp":3150358,"referencedTransaction":"0","confirmations":12580,"subtype":0,
"block":"2365176096112318374", "senderPublicKey":"66538....77a579","type":0,"deadline":1000,
"signature":"e9619.....937639","recipient":"9415965710853847055"}

I hope they correct, and then we could soon be able to use decimals!

This problem occurs also in...

* sendMoney() = URL http://localhost:7874/nxt?requestType=sendMoney&secretPhrase=IWontTellYou&recipient=398532577100249608&amount=1500&fee=1&deadline=900&referencedTransaction=...

* getBlock() = RETURN {"transactions":["14664591317056179258"],"blockSignature":"8e679e....5b5333","payloadLength":189,"numberOfTransactions":1,"version":1,
"timestamp":3196925,"previousBlock":"11012395561676092121","payloadHash":"3a4c.....a1e55b","height":29207,"totalFee":1,
"baseTarget":"490243708","generationSignature":"d5fc85......2e08","totalAmount":0,"generator":"4071545868996394636"}

* assignAlias() = URL http://localhost:7874/nxt?requestType=assignAlias&secretPhrase=hola&alias=hola&uri=&fee=1&deadline=1000

* sendMessage() = URL http://localhost:7874/nxt?requestType=sendMessage&secretPhrase=123&recipient=398532577100249608&fee=1&deadline=1440&message=b8a7a5...h381a3
legendary
Activity: 2142
Merit: 1010
Newbie
January 14, 2014, 04:39:46 PM
Yes, "recipient: [0-9-]+" matches all lines containing "recipient" except for the first one (structure definition).

No idea, looks like it doesn't count recipients with "-" sign.
newbie
Activity: 12
Merit: 0
January 14, 2014, 04:17:50 PM
That's what I figured, but a quick check shows only ~7000 unique recipients in transactions.nxt vs. 14,000 accounts in the blockchain explorer:

Code:
$ java -jar jdeserialize-1.2.jar nxt/transactions.nxt | grep -E "recipient: [0-9-]+" | awk '{ print $2 }' | sort | uniq | wc -l
7105

R recipients with negative value included?

Yes, "recipient: [0-9-]+" matches all lines containing "recipient" except for the first one (structure definition).
legendary
Activity: 2142
Merit: 1010
Newbie
January 14, 2014, 01:41:34 PM
That's what I figured, but a quick check shows only ~7000 unique recipients in transactions.nxt vs. 14,000 accounts in the blockchain explorer:

Code:
$ java -jar jdeserialize-1.2.jar nxt/transactions.nxt | grep -E "recipient: [0-9-]+" | awk '{ print $2 }' | sort | uniq | wc -l
7105

R recipients with negative value included?
newbie
Activity: 12
Merit: 0
January 14, 2014, 01:35:29 PM
Is there a way to get a list of all the accounts?

Thanks!

Yes, this can be done via blockchain scanning. Smiley

Let me know if u need a special API call for that.

I'd definitely like an API call that would return all accounts.  For blockchain scanning, what is the process to get all accounts?  A quick look at blocks.nxt (12MB) shows only ~300 unique generatorPublicKey's, and transactions.nxt (also 12MB) has about ~3500 unique accounts.  The blockchain explorer says "Accounts: 13919" and lists lots of new accounts being added though.

Get a unique list of the recipients of all transactions of all blocks.

That's what I figured, but a quick check shows only ~7000 unique recipients in transactions.nxt vs. 14,000 accounts in the blockchain explorer:

Code:
$ java -jar jdeserialize-1.2.jar nxt/transactions.nxt | grep -E "recipient: [0-9-]+" | awk '{ print $2 }' | sort | uniq | wc -l
7105
full member
Activity: 224
Merit: 100
January 14, 2014, 01:02:18 PM
Sending you one through PM for txid: 17352005608016332505

Is it safe to use transactionbytes publicly?

http://localhost:7874/nxt?requestType=getTransactionBytes&transaction=17352005608016332505

Yes. ;-)
hero member
Activity: 566
Merit: 500
January 14, 2014, 12:54:38 PM
Sending you one through PM for txid: 17352005608016332505

Is it safe to use transactionbytes publicly?

We have made a bunch of transactions that have received the transactionbytes. Deadline 7200 minutes, not even near of expiring, yet somehow these transactions are not pushed through even when others are. They receive the same transaction id and transactionbytes every time for days but do not go through. We are wary of resending them before deadline instead of rebroadcasting for the fear of double spending. Any ideas?

Send me one of these transaction bytes, I'll check what is wrong.
legendary
Activity: 2142
Merit: 1010
Newbie
January 14, 2014, 09:07:31 AM
{"errorCode":7,"errorDescription":"Not allowed"}

But i can access the local client from browser

Put * into allowedBotHosts.
sr. member
Activity: 294
Merit: 250
January 14, 2014, 08:58:28 AM
{"errorCode":7,"errorDescription":"Not allowed"}

But i can access the local client from browser
legendary
Activity: 2142
Merit: 1010
Newbie
January 14, 2014, 01:27:11 AM
We have made a bunch of transactions that have received the transactionbytes. Deadline 7200 minutes, not even near of expiring, yet somehow these transactions are not pushed through even when others are. They receive the same transaction id and transactionbytes every time for days but do not go through. We are wary of resending them before deadline instead of rebroadcasting for the fear of double spending. Any ideas?

Send me one of these transaction bytes, I'll check what is wrong.
sr. member
Activity: 294
Merit: 250
January 13, 2014, 08:25:24 PM
what are the Arbitrary Message API?
hero member
Activity: 566
Merit: 500
January 13, 2014, 06:50:07 PM
We have made a bunch of transactions that have received the transactionbytes. Deadline 7200 minutes, not even near of expiring, yet somehow these transactions are not pushed through even when others are. They receive the same transaction id and transactionbytes every time for days but do not go through. We are wary of resending them before deadline instead of rebroadcasting for the fear of double spending. Any ideas?
legendary
Activity: 1181
Merit: 1018
January 13, 2014, 03:11:47 PM
hoi marcus03
- as you mention urlencoder - I am using python 'requests' - works nice. What are you using?

Cheers
full member
Activity: 224
Merit: 100
January 13, 2014, 02:04:40 PM
I'm having  some trouble with the secretPhrase parameter. How should parameters be encoded?

I'm using UTF-8 and URL encoding so, e.g. the secret öäü (german umlaut characters) would be öäü in UTF-8 and that would be urlencoded to %C3%83%C2%B6%C3%83%C2%A4%C3%83%C2%BC resulting in:

http://..../nxt?requestType=sendMoney&secretPhrase=%C3%83%C2%B6%C3%83%C2%A4%C3%83%C2%BC&recipient=...

Anything wrong with that?

Got it to work. Had a problem with in my URL encoder.
Pages:
Jump to: