Closed qvanphong closed 2 years ago
hello @qvanphong, thanks for the issue.
when you execute list address
, do you see more than one address in the output? or a single one?
just as background info: the exception message you see is coming from this line. The deploy
method is called every time the smart contract is deployed/updated.
hello @qvanphong, thanks for the issue.
when you execute
list address
, do you see more than one address in the output? or a single one?
Hi @gsmachado, list address
only show 1 address, the problem is happening in NEO GUI too (since NEO GUI using neo-cli).
Also, this address is the same address in contract's owner in contract's code.
just as background info: the exception message you see is coming from this line. The
deploy
method is called every time the smart contract is deployed/updated.
Yes, exactly, neo-cli gonna work without it. But I have no idea why DeployFromFiles example with even with and without with it.
hello @qvanphong, thanks for the issue. when you execute
list address
, do you see more than one address in the output? or a single one?Hi @gsmachado,
list address
only show 1 address, the problem is happening in NEO GUI too (since NEO GUI using neo-cli). Also, this address is the same address in contract's owner in contract's code.
So, I assume you changed this line to include the address of the owner, correct?
Ok, in this case, that's so weird... because if there were more addresses loaded in your wallet (i.e., Neo CLI), there was the possibility that the deploy
command could be considering the wrong address to sign the deploy script -- and, the deploy
command doesn't have the option to specify a fromAddress
param (or something like this).
neo> deploy
You can call this command like this:
deploy <filePath> [manifestPath=null] [data=null]
However, that's not the case since you mentioned there's a single address loaded.
@csmuller: any clues on this issue?
hello @qvanphong, thanks for the issue. when you execute
list address
, do you see more than one address in the output? or a single one?Hi @gsmachado,
list address
only show 1 address, the problem is happening in NEO GUI too (since NEO GUI using neo-cli). Also, this address is the same address in contract's owner in contract's code.So, I assume you changed this line to include the address of the owner, correct?
Ok, in this case, that's so weird... because if there were more addresses loaded in your wallet (i.e., Neo CLI), there was the possibility that the
deploy
command could be considering the wrong address to sign the deploy script -- and, thedeploy
command doesn't have the option to specify afromAddress
param (or something like this).neo> deploy You can call this command like this: deploy <filePath> [manifestPath=null] [data=null]
However, that's not the case since you mentioned there's a single address loaded.
@csmuller: any clues on this issue?
yeah, I changed the owner line to my address that interacting with neo-cli, neo-gui, even I tried with neo-express. Nothing work, if I remove that line and deploy, any further invoke that using Runtime.checkWitness(owner)
after the contract is deployed sould work.
Hey @qvanphong, I've had a look and it seems that this is a witness scope issue in the deployment.
When deploying a contract, you are invoking the method deploy
on the native contract ContractManagement
. This method then deploys your contract with the provided nef and manifest and then calls this contract's deploy
method.
In a deployment, a signer with a witness scope calledbyentry
is only valid on the ContractMangement
contract. So, if there is another witness check outside of the ContractMangement
contract, this scope is not sufficient, and thus the check fails.
As you can see in the DeployFromFiles
example, the signer has a global
scope. In neo-cli, the default scope is calledbyentry
. That is why it worked in the example code and didn't work using neo-cli. Afaik, there is currently no way to specify other scopes using neo-cli unfortunately.
Fyi, there's an issue open concerning the support of witness scopes for the deployment through neo-cli (https://github.com/neo-project/neo/issues/3004).
@qvanphong Can we close this issue?
@qvanphong Can we close this issue?
Yes, thank you for helping :D
Hi, I followed this example: https://github.com/neow3j/neow3j-examples-java/blob/master/src/main/java/io/neow3j/examples/contractdevelopment/contracts/FungibleToken.java
After completing the contract code, I tried to deploy it through DeployFromFiles example and everything is fine. But when I bring complied contract to neo-cli with command:
invoke contract.nef contract.manifest.json
It will causeError: An unhandled exception was thrown. The calling entity is not the owner of this contract
Which is an error message fromthrowIfSignerIsNotOwner()
method. And I have no idea why.FYI: The contract owner's address in the contract code and address that was opened in neo-cli is the same address.