-
Notifications
You must be signed in to change notification settings - Fork 224
node: Cli: Adding Script System for neo-cli #901
base: master
Are you sure you want to change the base?
Conversation
@shargon how do you think about this one, interact with the neo node via script |
Is not the same as |
@shargon it is C# script, where you can write c# code to construct transactions and interact with the neo blockchain, then run the script in the YOU have type system and code suggestions and auto completion~~like you write C# code.... take a look at the example here: neo-cli/template.cs |
Can we avoid to use reflection in that script? |
i am afrait this is how it works. You have security concerns? |
I would not like the user to be able to access to the Storage or internal methods with this script. |
i dont quite understand the reason of your concern, both script and dll exists in the node without particular protection, if you are considering that attackers might use this script to attack the node, well, it can do it anyway since it has hacked into the node. Your concern make sense only if we have strong protection on the executable binary or dll. otherwise a script or an attacker written C# project can basically do the same bad thing. BTW, since reflection namespace is not refered, write reflection code in the script would be Update: |
@shargon how do you think? |
I'm worried about people who make scripts to supposedly do something, and people who don't know how to program execute this code. |
this can be disabled by default tough, only guys who need it and konws how to use it can able it. |
Then, It's better to do it as a module. |
var verificationScript = Contract.CreateSignatureContract(keyPair.PublicKey).Script; | ||
transaction.Witnesses = new Witness[] { new Witness { InvocationScript = invocationScript, VerificationScript = verificationScript } }; | ||
Console.WriteLine($"HASH: {transaction.Hash}"); | ||
Console.WriteLine($"{transaction.Verify(NeoSystem.Settings, snapshot, new(), new Transaction[] { })}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe should be Debug.Assert
?
Attributes = new TransactionAttribute[], | ||
Script = sb.ToArray(), | ||
Signers = new Signer[] { new Signer { Account = scriptHash, Scopes = WitnessScope.CalledByEntry } }, | ||
ValidUntilBlock = blockIndex + 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plus NeoSystem.Settings.MaxValidUntilBlockIncrement
?
This amazing idea is from 17v.
By enabling developers to write and run script in the neo-cli, they are empowerd to directly interact with the leder and smart contract directly with C# code.
What's the benefits?
Newly added commands: