Bitcoin Forum
May 10, 2024, 12:11:00 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: 1 2 3 [All]
  Print  
Author Topic: [NXT] API 2 Brainstorming  (Read 5017 times)
ferment (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100


IDEX - LIVE Real-time DEX


View Profile
January 09, 2014, 02:01:28 PM
Last edit: January 09, 2014, 04:23:22 PM by ferment
 #1

We r planning to create other API. Old API will be called Legacy API and become obsolete. New API will be split to 2 parts - Low-level API and High-level API. If u r planning to write a client software u could start a thread to discuss what LL and HL API calls u need.


Before starting with APIs, here's what I understand to be the abstractions in NXT. I've tried to normalize the attributes as much as possible.

Abstractions

Block
- has many transactions
- has a generator account
- has a timestamp
- can be an orphan

Transaction
- has a type/subtype:
   Payment: subtypes: Ordinary Payment
   Messaging: subtypes: Arbitrary message, Alias assignment
   Colored coins: subtypes: Asset issuance, Asset transfer, Ask order placement, Bid order placement, Ask order cancel, Bid order cancel
- has a sender account
- has a recipient account
- has attachments
- has a timestamp
- has fee
- has amount
- has confirmations

Account
- has a secret phrase
- "created" in blockchain by receiving a transaction
- send transactions
- receive transactions
- generates blocks and receives fees (transparent forging)
- generates hallmarks/tokens
- balance defined by transactions and received block generation fees

Peer
- has an address
- has state: non-connected, connected, disconnected
- optionally hallmarked by an account

Alias
 -has a name and URI
 -assigned by a type of transaction using attachment
 -uri updated through a type of transaction using attachment

Asset
-assigned by a type of transaction using attachment?
[not released]

Arbitrary Message
-assigned by a type of transaction using attachment?
[not released]

Exchange
-has AskOrder
-has BidOrder
[not released]

So before brainstorming/designing an API, anything above incorrect?

Any more details on Asset, AM, Exchange, and TF attributes (deadline, etc)?

1715299860
Hero Member
*
Offline Offline

Posts: 1715299860

View Profile Personal Message (Offline)

Ignore
1715299860
Reply with quote  #2

1715299860
Report to moderator
1715299860
Hero Member
*
Offline Offline

Posts: 1715299860

View Profile Personal Message (Offline)

Ignore
1715299860
Reply with quote  #2

1715299860
Report to moderator
1715299860
Hero Member
*
Offline Offline

Posts: 1715299860

View Profile Personal Message (Offline)

Ignore
1715299860
Reply with quote  #2

1715299860
Report to moderator
If you want to be a moderator, report many posts with accuracy. You will be noticed.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715299860
Hero Member
*
Offline Offline

Posts: 1715299860

View Profile Personal Message (Offline)

Ignore
1715299860
Reply with quote  #2

1715299860
Report to moderator
1715299860
Hero Member
*
Offline Offline

Posts: 1715299860

View Profile Personal Message (Offline)

Ignore
1715299860
Reply with quote  #2

1715299860
Report to moderator
Come-from-Beyond
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
January 09, 2014, 02:06:41 PM
 #2

I'd like to add that everything can be done by using only one API - Low-level or High-level. Low-level requires a developer to understand internals of blockchain and transactions. High-level API is for casual programmers. They'll add a lot of overhead to server part, so the owner of a node may decide to switch High-level API support off.
EmoneyRu
Hero Member
*****
Offline Offline

Activity: 600
Merit: 500

Nxt-kit developer


View Profile
January 09, 2014, 02:17:52 PM
 #3

Quote
Time from last block API request (add to getState)
Useful for stop-on-fork-chain monitoring

Come-from-Beyond
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
January 09, 2014, 02:20:33 PM
 #4

Low-level API won't have Accounts. This data is recovered via blockchain analysis.
marcus03
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
January 09, 2014, 02:37:49 PM
 #5

In the terminology of the v1 API:

  • Unconfirmed transactions included in getAccountTransactionIds (or a second method for getting these)
  • Include the next forging account as a return value of the getBlock and getState call
  • Get the AliasID for an alias

That's all for now... :-)
marcus03
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
January 09, 2014, 03:28:43 PM
 #6

One more regarding orphan cleanup:

Right now my approach to clean up orphans on the client side would be like this:

  • Make a list of all blocks ids
  • Walk down the chain from the highest block and remove these blocks in the chain from my list
  • The remaining blocks in the list would be the orphan blocks and would need to be deleted, together with their transactions

Is there a better approach? Like is there or could there been an API call that would return all block ids that NRS knows are orphans?
ferment (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100


IDEX - LIVE Real-time DEX


View Profile
January 09, 2014, 04:04:25 PM
 #7

Low-level API won't have Accounts. This data is recovered via blockchain analysis.

Is that the same for AM, Alias, and Assets since they are just transaction types?

Come-from-Beyond
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
January 09, 2014, 04:08:49 PM
 #8

Low-level API won't have Accounts. This data is recovered via blockchain analysis.

Is that the same for AM, Alias, and Assets since they are just transaction types?

Yes. Low-level API will be just getBlock and getTransactions, maybe a few other requests.
ferment (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100


IDEX - LIVE Real-time DEX


View Profile
January 09, 2014, 04:12:42 PM
Last edit: January 09, 2014, 04:23:50 PM by ferment
 #9

Updated:

Block:
- Can be orphaned

Transaction types:
  Payment: subtypes: Ordinary Payment
  Messaging: subtypes: Arbitrary message, Alias assignment
  Colored coins: subtypes: Asset issuance, Asset transfer, Ask order placement, Bid order placement, Ask order cancel, Bid order cancel


Peer states: non-connected, connected, disconnected

joefox
Full Member
***
Offline Offline

Activity: 210
Merit: 100


View Profile WWW
January 09, 2014, 04:23:39 PM
 #10

reserved!

I admin the Nxt Wiki at http://wiki.nxtcrypto.org/ Please support my work by donating to Nxt account #1234567740944417915
ferment (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100


IDEX - LIVE Real-time DEX


View Profile
January 09, 2014, 04:46:45 PM
Last edit: January 09, 2014, 08:53:56 PM by ferment
 #11

Low level API Ideas draft 1

Please note that I'm not super interested in exact names right now, but gathering functionality. I'll use existing names or similar.

My approach is to look at the 3 fundamental low level abstractions (block, transaction, and peer) and present APIs for handling CRUD type operations. For this pass, I'll leave out parameters and also specifics of return value (object vs id vs bytes).

NRS:
getVersion
getTime

Blocks:
getGenesisBlockDate
getLastBlock
getFirstBlock
getBlock
generateBlock
getOrphanBlocks
getNextGenerateTime/getNextGenerator (or something similar) - help?

Transactions:
createTransaction
getTransaction
getUnconfirmedTransactions
broadcastTransaction

Peers:
getPeers
getPeer
connectPeer
disconnectPeer
getLastFeedingPeer? (lastBlockchainFeeder)

With these calls, I think you can do everything essential.

What did I miss?

Come-from-Beyond
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
January 09, 2014, 05:17:03 PM
 #12

Ok, let's continue brainstorming.
marcus03
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
January 09, 2014, 05:26:41 PM
 #13

As you said - just brainstorming:

What takes most of the time is when my client updates from NRS is getting the updated confirmation counts for transactions with less than 720 confirmations, because there are lots of back and forth calls since you have to call getTransaction again and again over a lot of transactions.

Would be nice to have some kind of batch mode, so e.g. send me all transactions (or just the confirmations counts) that are in block x. Or block x to y. Or block x,y,z, etc. with just one request.

It's probably enough to just get the updated confirmations counts, not everything that is returned in getTransaction, since the rest stays the same.
ferment (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100


IDEX - LIVE Real-time DEX


View Profile
January 09, 2014, 05:54:49 PM
Last edit: January 09, 2014, 08:04:24 PM by ferment
 #14

High level API Ideas draft 1

Please note that I'm not super interested in exact names right now, but gathering functionality. I'll use existing names or similar.

NRS:
getState

Account:
getAccount
getAccountPublicKey
getBalance
encodeToken
decodeToken

Blocks:
getAccountGeneratedBlocks
getBlockTransactions
getNextBlock(current)
getPreviousBlock(current)
getBlocks(start, end)

Transactions:
getAccountTransactions - this is a mid-level call since it returns raw transactions.

Payments:
sendMoney (or sendPayment)
getPayment
getAccountPayments

Alias:
getAlias
getAliasByName
assignAlias
transferAlias
updateAlias (yes, I know its the same as assign, but hide that at high level)
getAccountAliases
searchAlias
searchAliasURI

Arbitrary Message:
The use of the term "message" is somewhat confusing in this context. Maybe just Document or Data?

getMessage
createMessage
updateMessage
getAccountMessages

Colored Coins:
*Need help here*

issueAsset
getAsset
getAssets
updateAsset
transferAsset
getAccountAssets

sendAsset
getAssetBalance
getAssetOwners

placeAskOrder
placeBidOrder
cancelAskOrder
cancelBidOrder
executeAskOrder (better verb?)
executeBidOrder (better verb?)

getAskOrder
getBidOrder
getAskOrders
getBidOrders
getAccountAskOrders
getAccountBidOrders
getAssetAskOrders
getAssetBidOrders
getLastAssetPrice

What did I miss?

ferment (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100


IDEX - LIVE Real-time DEX


View Profile
January 09, 2014, 05:57:44 PM
 #15

On the low level side, it might be nice to have some kind of streaming api for blocks and transactions.

streamBlocks?
streamTransactions?

ferment (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100


IDEX - LIVE Real-time DEX


View Profile
January 09, 2014, 05:58:42 PM
 #16

As you said - just brainstorming:

What takes most of the time is when my client updates from NRS is getting the updated confirmation counts for transactions with less than 720 confirmations, because there are lots of back and forth calls since you have to call getTransaction again and again over a lot of transactions.

Would be nice to have some kind of batch mode, so e.g. send me all transactions (or just the confirmations counts) that are in block x. Or block x to y. Or block x,y,z, etc. with just one request.

It's probably enough to just get the updated confirmations counts, not everything that is returned in getTransaction, since the rest stays the same.

Added getBlockTransactions to high level

ferment (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100


IDEX - LIVE Real-time DEX


View Profile
January 09, 2014, 06:02:23 PM
 #17

One more regarding orphan cleanup:

Right now my approach to clean up orphans on the client side would be like this:

  • Make a list of all blocks ids
  • Walk down the chain from the highest block and remove these blocks in the chain from my list
  • The remaining blocks in the list would be the orphan blocks and would need to be deleted, together with their transactions

Is there a better approach? Like is there or could there been an API call that would return all block ids that NRS knows are orphans?

Added getOrphanBlocks() to the low level.

ferment (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100


IDEX - LIVE Real-time DEX


View Profile
January 09, 2014, 06:15:33 PM
 #18

While we're at high level stuff... how about some blockchain walking calls?

getNextBlock
getPreviousBlock

Come-from-Beyond
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
January 09, 2014, 06:23:48 PM
 #19

While we're at high level stuff... how about some blockchain walking calls?

getNextBlock
getPreviousBlock


How the server will know what the current block is?
ferment (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100


IDEX - LIVE Real-time DEX


View Profile
January 09, 2014, 06:34:24 PM
 #20

While we're at high level stuff... how about some blockchain walking calls?

getNextBlock
getPreviousBlock


How the server will know what the current block is?

Pass it in. So you could walk with this pseudo code:

Code:

last = getLastBlock
while last
  last = getPreviousBlock(last)
end

next = getFirstBlock
while next
 next = getNextBlock(next)
end


ferment (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100


IDEX - LIVE Real-time DEX


View Profile
January 09, 2014, 06:37:25 PM
 #21

While we're at high level stuff... how about some blockchain walking calls?

getNextBlock
getPreviousBlock


How the server will know what the current block is?

Another set of cool ones would be getting a range:

getPreviousBlocks(start, end)
getNextBlocks(start, end)

ferment (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100


IDEX - LIVE Real-time DEX


View Profile
January 09, 2014, 06:51:12 PM
 #22

For the high level, batch payments?

sendMultiplePayments via POST with json.

Personally I think sendMoney and anything involving creating transactions should be POST.

ferment (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100


IDEX - LIVE Real-time DEX


View Profile
January 09, 2014, 07:08:17 PM
 #23

Another thing that would be nice is REST urls for the api instead "nxt?requestType". This helps simplify movement to a new api while supporting the old for a while.

Examples:

GET /api/block/2680262203532249785
GET /api/block/list?start=2680262203532249785&end=3705873229391760257

GET /api/account/id?secret=SECRET
GET /api/account/balance
GET /api/account/aliases

GET /api/hallmark/encode?secret=SECRET&weight=100&date=2014-1-9&host=nxt.awesome.is

POST /api/payment/send
POST /api/alias/assign

This style would also make the list of API calls much smaller by condensing them.

marcus03
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
January 09, 2014, 07:53:46 PM
 #24

Would a public/private key encryption for the SECRET make sense? Since we'll never have valid SSL certificates?

-Client requests public key from server
-Server send public key to client
-Client enrcrypts SECRET with servers public key. SECRET -> ESECRET
-Client can send commands with parameter SECRET or ESECRET
-Server decrypts ESECRET to SECRET and does the sendMoney, etc.




Come-from-Beyond
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
January 09, 2014, 07:59:37 PM
 #25

getPreviousBlocks(start, end)
getNextBlocks(start, end)

Can't it be replaced with just

getBlocks(start, end)

?
Come-from-Beyond
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
January 09, 2014, 08:00:10 PM
 #26

Would a public/private key encryption for the SECRET make sense? Since we'll never have valid SSL certificates?

-Client requests public key from server
-Server send public key to client
-Client enrcrypts SECRET with servers public key. SECRET -> ESECRET
-Client can send commands with parameter SECRET or ESECRET
-Server decrypts ESECRET to SECRET and does the sendMoney, etc.


Clients must sign transactions by themselves.
ferment (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100


IDEX - LIVE Real-time DEX


View Profile
January 09, 2014, 08:02:56 PM
 #27

getPreviousBlocks(start, end)
getNextBlocks(start, end)

Can't it be replaced with just

getBlocks(start, end)

?

oh yeah, it can get the timestamp of each block to determine direction. smart...

ferment (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100


IDEX - LIVE Real-time DEX


View Profile
January 09, 2014, 08:06:32 PM
 #28

getPreviousBlocks(start, end)
getNextBlocks(start, end)

Can't it be replaced with just

getBlocks(start, end)

?

We could do something similar with:
getNextBlock(current)
getPreviousBlock(current)

getBlock(offset) - where offset is plus/minus.

Although for APIs I like the literal stuff like getNextBlock(current).

Come-from-Beyond
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
January 09, 2014, 08:08:43 PM
 #29

oh yeah, it can get the timestamp of each block to determine direction. smart...

Not smart, just lazy. Smiley
marcus03
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
January 09, 2014, 08:31:04 PM
 #30

Would a public/private key encryption for the SECRET make sense? Since we'll never have valid SSL certificates?

-Client requests public key from server
-Server send public key to client
-Client enrcrypts SECRET with servers public key. SECRET -> ESECRET
-Client can send commands with parameter SECRET or ESECRET
-Server decrypts ESECRET to SECRET and does the sendMoney, etc.


Clients must sign transactions by themselves.

I was looking for a way to get the plain text secret off the communcation channel between client and server.

If you currently use sendMoney, assignAlias, getAccountId, etc. the SECRET is in plain text and my idea was to prevent this. Won't these calls be available in API v2?

When the client signs the transaction, there is no need to send the SECRET, right?
Come-from-Beyond
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
January 09, 2014, 08:32:53 PM
 #31

Right
ferment (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100


IDEX - LIVE Real-time DEX


View Profile
January 09, 2014, 08:45:54 PM
 #32

When the client signs the transaction, there is no need to send the SECRET, right?

Right

So, all of the APIs that currently have a secretPhrase need a variation that assumes the client does their own crypto.

It seems like a bounty project in itself to implement NXT client libraries that do the crypto in different languages.

Come-from-Beyond
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
January 09, 2014, 09:16:23 PM
 #33

So, all of the APIs that currently have a secretPhrase need a variation that assumes the client does their own crypto.

It seems like a bounty project in itself to implement NXT client libraries that do the crypto in different languages.

Seems so. Anyway, Legacy API will be supported too. For the time being.
marcus03
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
January 09, 2014, 09:22:05 PM
 #34

So, all of the APIs that currently have a secretPhrase need a variation that assumes the client does their own crypto.

It seems like a bounty project in itself to implement NXT client libraries that do the crypto in different languages.

Seems so. Anyway, Legacy API will be supported too. For the time being.

What is the advantage of moving the crypto from server to client?
On the contrary, wouldn't it be better to even have the secret input dialog in the core, so that clients don't even get access to it?
Come-from-Beyond
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
January 09, 2014, 09:23:18 PM
 #35

What is the advantage of moving the crypto from server to client?
On the contrary, wouldn't it be better to even have the secret input dialog in the core, so that clients don't even get access to it?

Service Providers will earn money by working as public nodes. And casual users won't need to install Java and NRS server part.
^[GS]^
Member
**
Offline Offline

Activity: 112
Merit: 10


View Profile
January 10, 2014, 05:11:30 AM
 #36

I think it would need to have an API to see if an account is or not forging.

isForging(ACCOUNTID) = Boolean(True/False)
wesleyh
Sr. Member
****
Offline Offline

Activity: 308
Merit: 250


View Profile
January 10, 2014, 08:57:19 AM
 #37

Api call to see number of peers that accepted a transaction. This allows us to set a good value for pushTreshold.
ferment (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100


IDEX - LIVE Real-time DEX


View Profile
January 10, 2014, 12:30:09 PM
 #38

I think it would need to have an API to see if an account is or not forging.

isForging(ACCOUNTID) = Boolean(True/False)

Forging is an interesting issue as I think it's technically in what I refer to as the Client supporting servlet (lock and unlock) and not the api. So, I'm not sure how forging will be handled.

I put generateBlock and a placeholder for a call to determine when an account could try to generate a block.

C-f-B?

ferment (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100


IDEX - LIVE Real-time DEX


View Profile
January 10, 2014, 12:36:35 PM
 #39

Api call to see number of peers that accepted a transaction. This allows us to set a good value for pushTreshold.

This would be new functionality since right now Peer.sendToAllPeers (called by broadcastTransaction) doesn't keep any responses.

Come-from-Beyond
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
January 10, 2014, 02:57:38 PM
 #40

I put generateBlock and a placeholder for a call to determine when an account could try to generate a block.

C-f-B?

Shouldn't we leave block forging for clients? Coz it's the same as signing transactions, u have to use ur secret key.
ferment (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100


IDEX - LIVE Real-time DEX


View Profile
January 10, 2014, 04:00:55 PM
 #41

I put generateBlock and a placeholder for a call to determine when an account could try to generate a block.

C-f-B?

Shouldn't we leave block forging for clients? Coz it's the same as signing transactions, u have to use ur secret key.

Yes, that's the purpose of generateBlock, but we also need an API for determining when a client can generate blocks like the response that is used to update the timer in the current client. Basically, an API that encapsulates the TF logic to suggest when a client can attempt to generate a block.


hiksush2
Newbie
*
Offline Offline

Activity: 12
Merit: 0


View Profile
January 12, 2014, 04:28:48 AM
 #42

For High-level:

getAllAccounts() - possibly with filtering parameters and sort/limit

I'm not sure what the Account object provides currently, but these would be useful:

getBalance()
getTotalTransferAmounts() - returns total amount of NXT transferred.  filter by in/out
getTransactions() - filter by activity type (in/out/alias creation/etc.)
getTimeFirstActivity() - filter by activity type (in/out/alias creation/etc.)
getTimeLastActivity() - filter by activity type (in/out/alias creation/etc.)
getBlocksGenerated() - correct term?
getFeeEarned() - correct term?
getAliases()
wesleyh
Sr. Member
****
Offline Offline

Activity: 308
Merit: 250


View Profile
January 12, 2014, 08:59:31 PM
 #43

Is it possible to have an api that searches for incoming account transactions with a specific description?  (payment with attached description)

This would be good to verify payments.. Sort of like the system with bank transfers can have a message attached to it.
wesleyh
Sr. Member
****
Offline Offline

Activity: 308
Merit: 250


View Profile
January 13, 2014, 09:23:17 AM
 #44

API call to get peers that have public bot access enabled.
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1078


Ian Knowles - CIYAM Lead Developer


View Profile WWW
January 13, 2014, 09:33:48 AM
 #45

An API call to get the AM size limit (currently 1000) would be helpful (in order to chop up data and send it in max. size chunks efficient).

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
wesleyh
Sr. Member
****
Offline Offline

Activity: 308
Merit: 250


View Profile
January 13, 2014, 10:29:31 AM
 #46

Enable jsonp so that javascript can call peer via bot access like so: (to get around same origin policy)

?...&callback=myCallback

Can also implement CORS: http://enable-cors.org/server.html
wesleyh
Sr. Member
****
Offline Offline

Activity: 308
Merit: 250


View Profile
January 13, 2014, 10:33:25 AM
 #47

add server date to getState as well as lastBlockDate.
oliviern
Newbie
*
Offline Offline

Activity: 17
Merit: 0


View Profile
January 16, 2014, 09:28:27 AM
 #48

Hello,

I have two main api addons to ask, because I'm faced with a few limitations in my mobile app :

- forged blocks statistics for a given account :
I've been said I have to crawl blocks to know who has computed each, and sum the coins for each account number (I may be wrong...). If it sounds possible, a api call giving forging stats for a nxt account would be relevant

- tokens to replace the passphrase into api calls :
To send money, one has to send his own passphrase through http. This is truly not secured, because communications can be listened, and modified 'reliable' nodes can store passphrases using a api proxy for example... I'd rather have a solution to use api without any passphrase. To do so, one may imagine the following services :

     getAppToken(application_name, application_secretkey) : returns a token (token_app), used to identify application provider. this token can be given publicly to the users who want to give the app access to their accounts

     allowApp(token_app,account_passphrase, array of allowed functions) : returns a token (token_account_app), which certifies that the account owner allows the app to access to a list of api calls (send money, send message, ...)

The token_account_app is sent by the user to the app owner, who can use it to sign secured API calls, with his own application_secretkey. The called node has to verify the matching between application_secretkey, token_account_app, and allowed api services. The application_secretkey allows to certify it is called from the application owner. (this is close to app_ID+app_secretkey used into google,fb,twitter apis for example).

Doing so, the user does not have anymore to send his passphrase to send money, for example. He can also call a disallowApp(token_app,account_passphrase), which returns the same token_account_app, but remove all allowed functions. Doing so, the application can not call anymore any API functions. The allowed functions list could be stored into the blockchain, or even locally on the application dedicated node (ie the user allows a specified node to do API calls).

I've tried to keep it simple, and this is certainly not perfect. This is a very first proposal, in order to talk about with nxt teams. Maybe we could also use aliases to identify applications, or even hack the messages process to validate transactions... Whatever solution is used, I do think it is relevant not to send user's passphrase into the api calls made from external services.

Feedbacks welcome. Thanks,

Olivier

PS : another subject... Wouldn't it be possible to imagine an API call made to check a nxt node code has not been modified (in order to hack accounts for example) ? I know... this function could be modified by the node owner, to return the good checksum... so, this should be made externally, by a external peer. For example, the API service returns the server local main files, calling an external peer hashing service (hashing algorithm being secret, and peer dependent). If it matches, one can say the node uses not modified files. To hack this, one should have to modify hashing algorithm on all peers, which sounds quite difficult. The tested node could also send fake files, but maybe there is a solution to hash running code (and not local files) ?... don't know... this is just a thought.
ferment (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100


IDEX - LIVE Real-time DEX


View Profile
January 16, 2014, 01:23:48 PM
 #49


- forged blocks statistics for a given account :
I've been said I have to crawl blocks to know who has computed each, and sum the coins for each account number (I may be wrong...). If it sounds possible, a api call giving forging stats for a nxt account would be relevant

Try getAccountBlockIds in current API.

oliviern
Newbie
*
Offline Offline

Activity: 17
Merit: 0


View Profile
January 17, 2014, 12:45:12 PM
 #50

Can't wait either... Smiley
ferment (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100


IDEX - LIVE Real-time DEX


View Profile
January 17, 2014, 04:06:40 PM
 #51


I'd rather have a solution to use api without any passphrase.

The best way to do this is to have the client do all of the signing and transmit transaction data to the server. No secret phrases would ever leave the client.

wesleyh
Sr. Member
****
Offline Offline

Activity: 308
Merit: 250


View Profile
January 17, 2014, 05:08:22 PM
 #52

Ability to set timestampend so that it returns transactions BEFORE the timestamp. Good for pagination.

As well as a way to set a limit.
wesleyh
Sr. Member
****
Offline Offline

Activity: 308
Merit: 250


View Profile
January 22, 2014, 02:12:06 PM
 #53

Ability to get transactions where sender = x and recipient = Y. Especially useful for Arbitrary messaging instead of having to loop through potentially thousands of transactions.
l8orre
Legendary
*
Offline Offline

Activity: 1181
Merit: 1018


View Profile
January 23, 2014, 09:04:59 AM
 #54


Ability to get all assets owned by an account. CFB already mentioned including a call for this.
l8orre
Legendary
*
Offline Offline

Activity: 1181
Merit: 1018


View Profile
January 23, 2014, 09:30:46 AM
Last edit: January 23, 2014, 08:14:31 PM by l8orre
 #55

Ability to get transactions where sender = x and recipient = Y. Especially useful for Arbitrary messaging instead of having to loop through potentially thousands of transactions.

Do I understand correctly that atm it is neccessary to query ALL transactions and then filter the list in the client? yup. looks like it. I am actually catching up here...
l8orre
Legendary
*
Offline Offline

Activity: 1181
Merit: 1018


View Profile
January 24, 2014, 01:36:02 PM
 #56


heyhey, I made some experiments - my raspi needs TWO SECONDS to answer a query - while the testnet has a replytime of ~150ms

My concern is the following: when you have to resolve a chain of queries, like when going from block ->transactions -> transaction detail  -- 2 seconds per query does become a factor - you get to resolve 10 or 20 queries, get stuck for 20 to 40 seconds ?!?!?! Think about fast messaging ?!

BaiMangal
Member
**
Offline Offline

Activity: 111
Merit: 10


View Profile
January 24, 2014, 03:53:04 PM
 #57


Ability to get all assets owned by an account. CFB already mentioned including a call for this.

yeah this one is important!
wesleyh
Sr. Member
****
Offline Offline

Activity: 308
Merit: 250


View Profile
February 08, 2014, 09:17:20 PM
 #58

Account statistics; number of messages / aliases / assets owned, number of transactions done, number of forged blocks, forged block fees, creation date of account, etc..
Pages: 1 2 3 [All]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!