CIYAM (OP)
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
February 14, 2014, 07:20:01 PM |
|
Well that's fine that the message can be seen. If I am wasting your time please ignore me.
Am not ignoring you as you may have a very good idea (am just not sure yet). Certainly a script should be able to have its "own account" so it should be possible for X people to send funds to that account (and in fact the script could possibly even decide who those should be). So assuming we have such a script - what does it then *do* with its balance? Is the idea that other txs will *instruct* it how to disperse its balance (maybe you could just tell me the "point" rather than the procedure)?
|
|
|
|
BaiMangal
Member
Offline
Activity: 111
Merit: 10
|
|
February 14, 2014, 07:34:22 PM |
|
So assuming we have such a script - what does it then *do* with its balance?
Is the idea that other txs will *instruct* it how to disperse its balance (maybe you could just tell me the "point" rather than the procedure)?
Yes. We can instruct how the balance will be disperse. The accounts that will decide how the balance will be managed will be fixed account addresses in the script and a condition if all accounts must "agree" or a % of them must agree or for certain transaction amount say 100nxt it will require X% to instruct" but for amounts higher it will require 100% to instruct. So we have such an account that holds 10000NXT. Then we have in the script that only 4 accounts can instruct, these 4 accounts will be listed in the script. For transfers less than 100 we need 70% of the accounts to instruct for transfers above 100nxt we need 100% to instruct. Then account 1, 2, 3 send instruction to the holding account to Send 50nxt To account Z and that's enough to complete a transaction for 50nxt from our main account to account Z. I am sorry I suck in explanation!!! Maybe should write code in pseudo code to demonstrate it but programming all day drains me and would like to try talking haha Edit: Sorry I just saw that you asked for the point. The point is that I am trying to make an account controlled by more than 1 person. So we can get as close to decentralized exchange as possible. Also if we can have an account controlled by instructions from other accounts we can have community funds controlled by few people etc..
|
|
|
|
CIYAM (OP)
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
February 14, 2014, 07:37:55 PM |
|
I am sorry I suck in explanation!!! Maybe should write code in pseudo code to demonstrate it but programming all day drains me and would like to try talking It's okay - I think I *get* your idea now but let me just check - it is basically an "escrow" account which requires a majority vote to move funds?
|
|
|
|
BaiMangal
Member
Offline
Activity: 111
Merit: 10
|
|
February 14, 2014, 07:38:28 PM |
|
I am sorry I suck in explanation!!! Maybe should write code in pseudo code to demonstrate it but programming all day drains me and would like to try talking It's okay - I think I *get* your idea now but let me just check - it is basically an "escrow" account which requires a majority vote to move funds? yes do we have escrow accounts implemented?! wow I didn't know
|
|
|
|
CIYAM (OP)
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
February 14, 2014, 07:40:09 PM |
|
yes
Okay - am glad I worked that out - but am not sure if "scripts" are the right answer to that (as I think multi-sig txs are planned down the track).
|
|
|
|
BaiMangal
Member
Offline
Activity: 111
Merit: 10
|
|
February 14, 2014, 07:41:06 PM |
|
yes
Okay - am glad I worked that out - but am not sure if "scripts" are the right answer to that (as I think multi-sig txs are planned down the track). true!! yeah no patience here to wait haha
|
|
|
|
CIYAM (OP)
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
February 14, 2014, 07:42:47 PM |
|
true!! yeah no patience here to wait haha
Understood - but I think proper multi-sig txs would end up being "cheaper" than scripts (which is why I need better "use cases" for scripts).
|
|
|
|
|
greatwolf
|
|
February 15, 2014, 12:17:05 AM |
|
Okay - let's get "stuck into it" (warning - this topic is going to include a lot of "technical" discussion).
So first and foremost we have the problem of "what kind of scripting language should we use"?
In considering this we have to understand that we don't wont Nxt nodes wasting large amounts of CPU cycles on scripts when there most important function is of course to process Nxt transactions.
... So - is there an existing "low-level" language (close to if not assembly) that is suitable or do we need to "roll our own"?
I am not sure of the answer to this question and look forward to your input.
IMO, this isn't a new problem and its been solved many times before. I suggest checking out some of the scripting VM implementations out there first before reinventing the wheel -- unless you have an itch to scratch Given the above constraints and desired properties, I definitely recommend checking out and researching Lua as per Jack's suggestion -- it's lightweight, more performant than alternatives (eg. ruby, python), allows for a great deal of control and there's a very strong community behind it. Since you're looking for some way to "instrument" opcode execution, maybe start with Lua as a base and modify its main interpreter loop. From there you can add hooks for whichever instruction that needs to be charged a fee. Lua also has a debug library that provides functions for hooking into the vm script execution. These primitives are used to implement debuggers and profilers but perhaps it can work for your use-case example too? Another idea is to introduce new opcode primitives on top that better maps to the nxt transactions and actions you want to perform. If you look at Luajit as an example, it augmented its own custom bytecode along with Lua's which allowed it to apply some pretty impressive optimizations.
|
|
|
|
colorfish
Newbie
Offline
Activity: 9
Merit: 0
|
|
February 15, 2014, 02:50:42 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. Thank u for ur answer. I think I know what is nxt script that u want to create a host (like V8)to execute some customized code(any protocols or rules) that user write. Am I right?
|
|
|
|
CIYAM (OP)
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
February 15, 2014, 04:27:33 AM |
|
to execute some customized code(any protocols or rules) that user write
That is a key part - also the idea is to have such code exist in the blockchain and to perhaps be run periodically. Another use case we are considering is what is often called a "dead man's switch" - it would be a script whose purpose would be to move funds from one account to another (in case its owner has disappeared or forgotten their pass phrase).
|
|
|
|
Fry
Newbie
Offline
Activity: 45
Merit: 0
|
|
February 15, 2014, 05:29:18 AM |
|
Would it be possible to do the Following with these Scripts? Forgers, Stakholders or some other trusted entitys post regulary what they think the current USD value of NXT is to the Blockchain. The script Calculates somehow an average USD price. The Script now uses its own funds to Buy and Sell an NXT Asset called USD at that price. Which results in having an Asset USD that has a stable USD value without having a Counterparty Risks (at least as long as the Script has enough NXT to buy that USD Asset).
|
|
|
|
Zahlen
Member
Offline
Activity: 98
Merit: 10
|
|
February 15, 2014, 05:51:16 AM |
|
Crowdfunding could be done via Xtnd . Anon and I had a convo about it here: https://bitcointalk.org/index.php?topic=460343.msg5113720#msg5113720There's one big piece missing though, can this be done? Once account control is implemented, I wonder if smart contracts can automatically lock and unlock the holding account, without revealing the key to anyone? Without something like this, you'd still have to trust the people seeking the funds to not run off with them without issuing tokens, or some 3rd party to be in charge of the account.
|
|
|
|
jongameson
Member
Offline
Activity: 84
Merit: 10
|
|
February 15, 2014, 05:57:49 AM |
|
dogecoin version of peercoin. with scrypt and everything. cause i'm cool
|
|
|
|
CIYAM (OP)
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
February 15, 2014, 06:23:51 AM |
|
There's one big piece missing though, can this be done? Once account control is implemented, I wonder if smart contracts can automatically lock and unlock the holding account, without revealing the key to anyone? Without something like this, you'd still have to trust the people seeking the funds to not run off with them without issuing tokens, or some 3rd party to be in charge of the account.
Although I'd probably need to know more details it would certainly be the kind of thing this would be able to handle (it could not have keys but instead would be presumably be "granted" control over the account of its issuer).
|
|
|
|
hostmaster
|
|
February 15, 2014, 06:25:57 AM |
|
Good luck for the project everyone. This will definitely kill most of competitors.
agreed
|
|
|
|
CIYAM (OP)
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
February 15, 2014, 03:29:06 PM |
|
Well - one big snag with a "use case" that I think a few had hoped we would be able to do.
We were thinking of something like a Nxt "lottery" where you would send amounts to the "script" and after x amount of time it would pay out its balance to a "winner".
The problem is that it doesn't seem possible to get "random" data in Nxt. People can change txid's (due to malleability) and forgers can simply omit transactions including those that run the script making it impossible for such a lottery to be actually "fair". Also TF means that you can actually predict some hashes even in the future (was BCNext trying to tell us "not to gamble"?).
Perhaps there is something we haven't thought of yet to still make this possible so if anyone has a great idea about that please let us know!
|
|
|
|
jubalix
Legendary
Offline
Activity: 2632
Merit: 1022
|
|
February 15, 2014, 04:30:05 PM |
|
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. no I know what you mean by "script" I was just wondering independently could you write most of the nxt client in javascript
|
|
|
|
CIYAM (OP)
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
February 15, 2014, 04:39:46 PM |
|
I was just wondering independently could you write most of the nxt client in javascript
Of course that "could be done" as JavaScript is "Turing complete" but it is not an exercise that I would be interested in doing (debugging such scripting languages is a real PITA).
|
|
|
|
Fry
Newbie
Offline
Activity: 45
Merit: 0
|
|
February 15, 2014, 10:36:45 PM |
|
The problem is that it doesn't seem possible to get "random" data in Nxt. People can change txid's (due to malleability) and forgers can simply omit transactions including those that run the script making it impossible for such a lottery to be actually "fair". Also TF means that you can actually predict some hashes even in the future (was BCNext trying to tell us "not to gamble"?).
My proposal to solve this issue: Add a field to every block in the blockchain. This field contains the ECDSA signature of the same field in the previous block (calculated with the forgers private Key). Use this signature to seed the random function.
|
|
|
|
|