Pages:
Author

Topic: Nxt :: Automated Transactions (AT) - progress and discussion - page 8. (Read 17307 times)

legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
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!
sr. member
Activity: 266
Merit: 250

Good luck for the project everyone. This will definitely kill most of competitors.

agreed
legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
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).
member
Activity: 84
Merit: 10
dogecoin version of peercoin.  with scrypt and everything.  cause i'm cool
member
Activity: 98
Merit: 10
Crowdfunding could be done via Xtnd  Cool. Anon and I had a convo about it here: https://bitcointalksearch.org/topic/m.5113720

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.
Fry
newbie
Activity: 45
Merit: 0
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).
 
legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
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).
newbie
Activity: 9
Merit: 0
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:

Code:
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?
full member
Activity: 230
Merit: 100
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 Wink

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.
newbie
Activity: 33
Merit: 0
Greetings,

Regarding "scripting" language take a look at the Arduino development language. This is a minimal subset of C which has a designer built in Java and complete tool chain.
http://arduino.cc/en/Reference/HomePage
http://www.nongnu.org/avr-libc/user-manual/index.html

Regarding use cases:
Kind of reminds me the Bitcoin payment protocol:
https://github.com/bitcoin/bips/blob/master/bip-0070.mediawiki
Although I'm not 100% sure at the moment how to tie this together.
legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
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).
member
Activity: 111
Merit: 10
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
legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
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).
member
Activity: 111
Merit: 10
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 Embarrassed
legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
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?
member
Activity: 111
Merit: 10
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..
legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
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)?
member
Activity: 111
Merit: 10
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.

legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
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.
member
Activity: 111
Merit: 10
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?
Pages:
Jump to: