CIYAM (OP)
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
February 14, 2014, 04:43:54 AM |
|
but, what is a nxt scripts?
A simple example (in fact our first "use case") is a script (or perhaps more correctly termed a "program" as we are not actually going to be using a typical "script" language) that pays a dividend to the shareholders of an Asset. So in pseudo code this might look something like the following: var b = get_Balance( ); var n = get_Number_Of_Account_Users( ); if( n > 0 ) { var s = b / n; if( s > 0 ) { while( true ) { var a = get_Next_Account_User( ); if( a == 0 ) break; send_Amount_To_Account( s, a ); } } }
I hope that isn't too confusing.
|
|
|
|
CIYAM (OP)
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
February 14, 2014, 04:52:20 AM |
|
also could you write a javascript implenentaion of nxt client....?
I think that I shouldn't have used the word "script" (anyone got a better name?). Although we may well add some sort of "higher level" language later (which might look similar to some popular scripting languages) at this stage we are focused on something that will be much more primitive.
|
|
|
|
dylan123
Newbie
Offline
Activity: 32
Merit: 0
|
|
February 14, 2014, 04:56:09 AM |
|
+1
|
|
|
|
CIYAM (OP)
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
February 14, 2014, 04:57:16 AM |
|
Do you mean to say that external calls to something like getLastBlock() will not block until return?
At this stage I would expect function calls "to block" although there may be some special cases for async execution but I think that such cases would be very few (if any at all) as we need to have a "deterministic" system.
|
|
|
|
superresistant
Legendary
Offline
Activity: 2156
Merit: 1131
|
|
February 14, 2014, 08:46:52 AM |
|
A simple example (in fact our first "use case") is a script (or perhaps more correctly termed a "program" as we are not actually going to be using a typical "script" language) that pays a dividend to the shareholders of an Asset. So in pseudo code this might look something like the following: I hope that isn't too confusing. I love it. This would be very useful. Does Nxt Scripts use Nxt fees in order to be used ?
|
|
|
|
CIYAM (OP)
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
February 14, 2014, 09:13:46 AM |
|
Does Nxt Scripts use Nxt fees in order to be used ?
Indeed - basically a transaction to "execute" a script will be charged per "step" of execution (we can't tell how long a script will run as they will be "Turing complete"). If the payer hasn't provided enough fees then the script effectively "stops" at whatever step it is currently on (and can be resumed at a later point in time if a new fee paying tx asks it to). There are also most likely going to be some basic limits as to the max. number of "steps" that a single forger would have to execute otherwise some paying an enormous fee to an "infinite loop" script could bring the network to a grinding halt.
|
|
|
|
superresistant
Legendary
Offline
Activity: 2156
Merit: 1131
|
|
February 14, 2014, 09:55:45 AM |
|
Does Nxt Scripts use Nxt fees in order to be used ?
Indeed - basically a transaction to "execute" a script will be charged per "step" of execution (we can't tell how long a script will run as they will be "Turing complete"). If the payer hasn't provided enough fees then the script effectively "stops" at whatever step it is currently on (and can be resumed at a later point in time if a new fee paying tx asks it to). There are also most likely going to be some basic limits as to the max. number of "steps" that a single forger would have to execute otherwise some paying an enormous fee to an "infinite loop" script could bring the network to a grinding halt. This could make Nxt forging very lucrative.
|
|
|
|
CIYAM (OP)
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
February 14, 2014, 10:50:10 AM |
|
This could make Nxt forging very lucrative.
Certainly the amount of fees cannot be too trivial or the burden on the network would be too great so I'd expect such "scripts" will have to be fairly generous in order to function reasonably.
|
|
|
|
BaiMangal
Member
Offline
Activity: 111
Merit: 10
|
|
February 14, 2014, 01:56:56 PM |
|
I think that I shouldn't have used the word "script" (anyone got a better name?).
instructions
|
|
|
|
CIYAM (OP)
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
February 14, 2014, 02:21:33 PM |
|
instructions
Hmm... don't think the marketing team would be jumping up and down about that. Perhaps something like "Smart Transactions" might be a little "more catchy" (although I am not a marketing guy).
|
|
|
|
Come-from-Beyond
Legendary
Offline
Activity: 2142
Merit: 1010
Newbie
|
|
February 14, 2014, 02:28:39 PM |
|
Scripting or Automation.
|
|
|
|
BaiMangal
Member
Offline
Activity: 111
Merit: 10
|
|
February 14, 2014, 02:33:33 PM |
|
aaa I didn't think we want it as a marketing sounding, I thought it was to be as close as possible to what you will be doing:)
for marketing: Adaptive Layer
|
|
|
|
CIYAM (OP)
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
February 14, 2014, 02:45:14 PM |
|
for marketing: Adaptive Layer
Now that does sound like something you'd hear from marketing.
|
|
|
|
Damelon
Legendary
Offline
Activity: 1092
Merit: 1010
|
|
February 14, 2014, 03:45:01 PM |
|
for marketing: Adaptive Layer
Now that does sound like something you'd hear from marketing. If you like living on the edge these days: "Malleable Operations"
|
|
|
|
CIYAM (OP)
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
February 14, 2014, 04:38:40 PM |
|
If you like living on the edge these days: "Malleable Operations" Indeed - btw - after some consideration the "use case" of the "dividend" doesn't actually seem to be a very good use case for scripting anyway (it could be done more efficiently with a special "pay to many" tx type). So we are interested in some better use cases - a couple of ideas we have so far are: 1) A "lotto" in which the script contains the "hash" of a secret. People send funds to the script and then when the secret is revealed the funds are sent to the tx whose hash (or time stamp or combination) is closest. 2) A "dead man's switch" savings account that will send your funds to another account if you don't instruct it otherwise (say once per year). Perhaps we could come up with something better than these as a more "compelling" use case to justify why we want to create such a script system?
|
|
|
|
BaiMangal
Member
Offline
Activity: 111
Merit: 10
|
|
February 14, 2014, 04:55:15 PM |
|
a use case script: create an account by a number of people sending parts of the passphrase to account A (i.e. someone creates an account address and stores somehow that lets say 3 users will send parts of a passphrase for creating a new account) after account A receives the expected parts of the passphrases (in this case 3) it creates a new account address B (based on the 3 passphrases in the example) when users want to instruct account B to send NXT to another account they have to pass the 3 passphrases and same instruction in between the 3 of them, i.e. passphrase + Transfer 1000NXT to 43214321) stupid? semi stupid?
|
|
|
|
CIYAM (OP)
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
February 14, 2014, 05:07:22 PM |
|
stupid? semi stupid? Well the problem is that a script can't "hide" anything (I am aware of some of the amazing new crypto ideas thanks to James but as of now they are not practical - nor will they be in the foreseeable short term future) so I don't think this is something it could be used for. Another idea that has been suggested is a form of "hedging" where you might bet that Asset A is going to be worth more than Asset B at a certain time (or vice-versa).
|
|
|
|
BaiMangal
Member
Offline
Activity: 111
Merit: 10
|
|
February 14, 2014, 06:05:29 PM |
|
Didn't think about the fact that it cannt hide.
Can an account be setup to be able to send NXT only when it receives same message from a combination of other accounts (3 in my example)? If that's possible then is it possible to create the account with random generation password that password is not saved in the blockchain?
|
|
|
|
CIYAM (OP)
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
February 14, 2014, 06:37:10 PM |
|
Can an account be setup to be able to send NXT only when it receives same message from a combination of other accounts (3 in my example)? If that's possible then is it possible to create the account with random generation password that password is not saved in the blockchain?
The "message" can only be another transaction - so I am not quite sure what you think can be achieved as any tx will be seen by the entire network.
|
|
|
|
BaiMangal
Member
Offline
Activity: 111
Merit: 10
|
|
February 14, 2014, 07:13:23 PM |
|
Can an account be setup to be able to send NXT only when it receives same message from a combination of other accounts (3 in my example)? If that's possible then is it possible to create the account with random generation password that password is not saved in the blockchain?
The "message" can only be another transaction - so I am not quite sure what you think can be achieved as any tx will be seen by the entire network. Well that's fine that the message can be seen. If I am wasting your time please ignore me. What I was thinking is: We create an account with random passphrase, lets say address A.(if that's possible) Create a script to allow the account with address A to transfer NXT when same messages from fixed number of account addresses are sent to that account A. The addresses of these fixed accounts (say B,C,D) are listed in the script so if the account A received a message from an account address that is not part of the list of addresses it does nothing. If account A receives identical message from B and C and D (or maybe we can have a condition to be at least 2 of the accounts) then it does what the message suggests, i.e. Sent 10000 to account Z This way we can have an account controlled from few people.
|
|
|
|
|