Pages:
Author

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

full member
Activity: 224
Merit: 100
January 03, 2014, 03:12:13 AM
(Copied over from the main thread for reference.)

How to find the account that will forge the next block.


1. Do http://localhost:7874/nxt?requestType=getState to get value of "lastBlock"
2. Do http://localhost:7874/nxt?requestType=getBlock&block=10621696942372068326 (assuming 10621696942372068326 is the value of "lastBlock")
3. Convert "generationSignature" into binary and append public key bytes returned by getAccountPublicKey
4. Calculate SHA256(generationSignature, publicKey)
5. First 8 bytes as unsigned long in little-endian notation is HIT
6. Value of "baseTarget" multiplied by effective balance of the account is STATIC_TARGET
7. Do steps 3-6 for each account and find the one with lowest HIT/STATIC_TARGET ratio, this account will forge next block

legendary
Activity: 2142
Merit: 1010
Newbie
January 03, 2014, 02:31:07 AM
Come-from-Beyond
I can not find a way to get a transaction id for an alias. This is not possible?  
I looked at GET & POST APIs. Nothing.

This can be done with getAccountTransactionIds and getTransaction. getTransaction returns transaction data, u should check ones with type == 1 and subtype == 1.
If u don't know the account then u r supposed to scan the whole blockchain.
newbie
Activity: 35
Merit: 0
January 03, 2014, 02:29:25 AM
Come-from-Beyond
I can not find a way to get a transaction id for an alias. This is not possible? 
I looked at GET & POST APIs. Nothing.
newbie
Activity: 20
Merit: 0
January 02, 2014, 12:14:46 PM
When I start 0.4.8, I get 2 blacklisted peers:
95.85.22.142 and 78.46.63.221

Where can I add new peers?
legendary
Activity: 2184
Merit: 1000
January 02, 2014, 12:01:09 PM
are you able to find the thread...it no longer exist?

What thread?

Discendant of bitcoin
legendary
Activity: 2142
Merit: 1010
Newbie
January 02, 2014, 12:00:20 PM
are you able to find the thread...it no longer exist?

What thread?
legendary
Activity: 2184
Merit: 1000
January 02, 2014, 11:58:56 AM
Slightly OT:

If 2680262203532249785 is called the genesis block, what is the account 1739068987193023818 called (the one with the negative balance)?



It's the genesis account. It's used to destroy coins.

are you able to find the thread...it no longer exist?
legendary
Activity: 2142
Merit: 1010
Newbie
January 02, 2014, 11:56:40 AM
Slightly OT:

If 2680262203532249785 is called the genesis block, what is the account 1739068987193023818 called (the one with the negative balance)?



It's the genesis account. It's used to destroy coins.
full member
Activity: 224
Merit: 100
January 02, 2014, 10:41:45 AM
Slightly OT:

If 2680262203532249785 is called the genesis block, what is the account 1739068987193023818 called (the one with the negative balance)?

hero member
Activity: 739
Merit: 500
January 02, 2014, 07:03:47 AM
is there a method for uninstalling this? i had to format my computer to do it.

Good job. You should also smash the HDD with a hammer just to be sure.
legendary
Activity: 1358
Merit: 1093
January 02, 2014, 06:44:50 AM
is there a method for uninstalling this? i had to format my computer to do it.
newbie
Activity: 23
Merit: 0
January 02, 2014, 06:42:21 AM
We could do it for API v2.

Would recommend you guys to do it now. Dont be sorry later. Missing CLI help or api help smells like really bad practise and bad documentation...
legendary
Activity: 2142
Merit: 1010
Newbie
January 02, 2014, 06:19:19 AM
We could do it for API v2.
newbie
Activity: 23
Merit: 0
January 02, 2014, 06:09:31 AM
Can we get a "getCommands" command that returns the list of commands?

It's quite pointless to have this in core soft if we can have it in Wiki.

Just add a help command which gives help and valid commands. After all this is indeed best practise in coding to have an command to get help and/or help to single commands callable. Refusing such a trivial thing is actually not good to get developers on track with you.
full member
Activity: 224
Merit: 100
January 02, 2014, 06:04:02 AM
Can we get a "getCommands" command that returns the list of commands?

It's quite pointless to have this in core soft if we can have it in Wiki.

I would like to write a generic GUI for the API.

My program would call "getCommands", then call each command without a parameter, then look into the error message returned to find the needed parameters and then build a GUI with a command selector and parameter input boxes with their names attached to them.
legendary
Activity: 2142
Merit: 1010
Newbie
January 02, 2014, 05:57:49 AM
Can we get a "getCommands" command that returns the list of commands?

It's quite pointless to have this in core soft if we can have it in Wiki.
full member
Activity: 224
Merit: 100
January 02, 2014, 05:49:14 AM

Current list:

assignAlias
broadcastTransaction
decodeHallmark
decodeToken
cancelAskOrder
cancelBidOrder
getAccountId
getAccountTransactionIds
getAlias
getAliasIds
getAliasURI
getAskOrder
getAskOrderIds
getAsset
getAssetIds
getBalance
getBidOrder
getBidOrderIds
getBlock
getConstants
getMyInfo
getPeer
getPeers
getState
getTime
getTransaction
getTransactionBytes
getUnconfirmedTransactionIds
issueAsset
markHost
placeAskOrder
placeBidOrder
sendMoney
transferAsset

Lock/unlock is for client only, this is not API.

Encoding a token - no such API
Generating account id = getAccountId

PS: This is complete list, some calls r absent in 0.3.20 and will be included into 0.4.0 (related to alias system) or disabled for the time being (related to asset exchange)


Can we get a "getCommands" command that returns the list of commands?
legendary
Activity: 2142
Merit: 1010
Newbie
January 02, 2014, 02:13:21 AM
Does the response of get_alias_ids include the ids of aliases that have been updated since the timestamp?

Yes.
full member
Activity: 168
Merit: 100
IDEX - LIVE Real-time DEX
January 01, 2014, 06:27:54 PM
Does the response of get_alias_ids include the ids of aliases that have been updated since the timestamp?
legendary
Activity: 2142
Merit: 1010
Newbie
January 01, 2014, 04:19:46 PM
Hi,

whenever I try to do the following:

GET http://localhost:7874/nxt?requestType=getAccountTransactionIds&account=18024643391205620992×tamp=0&3.19606338E-8

I get an unknown account response.
Happens in 0.4.8, in 0.4.7e I got an incorrect timestamp error, and before everything was fine.

What am I doing wrong?
Do I need to do an unlockaccount request before this one?

Thanks.

U don't need to unlock the account.
I see
Code:
{"transactionIds":["15085253524419928473","8112176655741647048","9791683000981722521","17260745815379391255","13480409775214063395","7176052155437098924","8756057990016875314"]}
Send me ur blocks.nxt and transactions.nxt files plz.
Pages:
Jump to: