neo-project / neo

NEO Smart Economy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[**Support**] `verify` method parameters

cschuchardt88 opened this issue · comments

Summary or problem description
Add support for contract verify method parameter to used.

NEP-6 states

script - is the script code of the contract. This field can be null if the contract has been deployed to the blockchain.

parameters - is an array of Parameter objects which describe the details of each parameter of the contract function. For more information about the Parameter object, see the descriptions in NEP-3: NeoContract ABI.

Do you have any solution you want to propose?
Add To:

  1. neo-cli - creating transactions for invoke, update, NEP-17
  2. NEP-6 - be able to save parameter values. May need a new NEP proposal

Where in the software does this update applies to?

  • CLI
  • SDK

I think it's perfectly supported already, maybe except for the neo-cli.

commented

I don't understand it clearly... Do you mean supporting for invoking verify?

I didn't understand it either. What is the relationship between them?

You can pass parameters to a deployed contract's verify method. We current have support for this. But not in neo-cli.

You can pass parameters to a deployed contract's verify method. We current have support for this. But not in neo-cli.

verify does not take parameters.

It could

ContractMethodDescriptor md = cs.Manifest.Abi.GetMethod("verify", -1);

verify does not take parameters.

@Jim8y
It does already take parameters. NEP-6 states that. just need support in neo-cli.

You can pass parameters to a deployed contract's verify method. We current have support for this. But not in neo-cli.

verify does not take parameters.

It could

ContractMethodDescriptor md = cs.Manifest.Abi.GetMethod("verify", -1);

Alright then. -1

There are too many functions like NotValidBefore and Conflict as well as complicated Witness-xxx related things that NEO provided. Not all of them should be supported by every tool.
Even if we support them, I don't think the wallets and dAPPs as well as explorers would support them. Let the proficients utilize them by writing their own codes.

We don't have an official SDK, so we need to support them. Also we need tests to make sure they don't break.

We don't have an official SDK

Yes. We have for each popular language. I bet you know https://github.com/neo-project/neo-devpack-dotnet which is for C#.

That's for building contracts ONLY. This has no control over node. What we are talking about is functionality for creating an transaction on-chain.

In your context, NEO's nuget itself is the SDK. You purely need nothing but the NEO repo itself to create a transaction on-chain. If you are using C#, just import NEO and write like this.

Transaction tx = new()
{
    Version = 0,
    Nonce = 0,
    Script = sb.ToArray(),
    SystemFee = xxxxx,
    NetworkFee = yyyyyyy,
    ValidUntilBlock = zzzzzzzz,
    Signers = new[]
    {
        new Signer() { Account = UInt160.Parse("XXXXXXXXX"), Scopes = WitnessScope.XXXXXXXXX },
    },
    Attributes = Array.Empty<TransactionAttribute>(),
};
tx.Witnesses = new[]
{
    new Witness()
    {
        InvocationScript = new byte[] { xxxxxxxxx ).ToArray(),  // maybe it's a signature signed anywhere
        VerificationScript = YOUACCOUND.SCRIPT // if you need a contract's verify, leave VerificationScript empty here
    },
};

This issue will make all things bigger and hard to maintain. Because there are too many trivial functions here and there.

If you insist, please keep the original API stable. And after the CLI and RPC support them, please push N3-DAPI to support them, too. Otherwise, it will introduce no benefit to normal users.

That's for building contracts ONLY. This has no control over node. What we are talking about is functionality for creating an transaction on-chain.

FYI, I know that neoburger build their own transactions that maintains the votes. How did them come this without a SDK? https://github.com/neoburger/TEE

Every possible tx could be built and serialized locally and send to the RpcServer by this method.

[RpcMethod]
protected virtual JToken SendRawTransaction(JArray _params)
{
Transaction tx = Result.Ok_Or(() => Convert.FromBase64String(_params[0].AsString()).AsSerializable<Transaction>(), RpcError.InvalidParams.WithData($"Invalid Transaction Format: {_params[0]}"));
RelayResult reason = system.Blockchain.Ask<RelayResult>(tx).Result;
return GetRelayResult(reason.Result, tx.Hash);
}

That's for building contracts ONLY. This has no control over node. What we are talking about is functionality for creating an transaction on-chain.

FYI, I know that neoburger build their own transactions that maintains the votes. How did them come this without a SDK? https://github.com/neoburger/TEE

RCPClient