Open WAELKASSEM opened 4 years ago
please describe the exact commands you used to build and deploy and to which network (private net, testnet?). It sounds like you're either doing a test invoke without actually permanently deploying the contract to a chain, or your local chain is out of sync.
1- sc build
using private_net.
which exact neo-python
version are you using? You can type np-prompt --version
assuming you followed the default installation instructions. Otherwise try cat neo/__init__.py
I'm using neo-local , it always pulls the latest neo-python. And I've imported neo-boa v 0.6.0 to my python project .
Same issue here, today. It seems everything is fine, but the contract just wont get deployed.
I am using the docker image: docker run --rm -d --name neo-privatenet -v /home/.../mynep5/:/neo-python/sc -p 20333-20336:20333-20336/tcp -p 30333-30336:30333-30336/tcp cityofzion/neo-privatenet
I can run things with sc build_run ....
like:
sc build_run sc/mynep5.py True True False 0710 07 name [] --owners=["myPrivTestnetAddr"]
sc build_run sc/mynep5.py True True False 0710 01 noop [] --owners=["myPrivTestnetAddr"]
sc build_run sc/mynep5.py True True False 0710 01 noopowner [] --owners=["myPrivTestnetAddr"]
(noop and noopowner just return True, noopowner does a checkwitness check before)
But I cannot make neopy
deploy that contract to privtestnet. I can transfer neo and gas from the "generic coz-privkey" to my myPrivTestnetAddr.
One weird thing: I have 32k gas in the privtestnet, but once I deploy twice, any third attempt will fail with "insufficient funds", but checking wallet
there was nothing deducted. Wiping and restarting the container "fixes" it by granting me another 2 deploys.
Unsure how to debug.
Also out of frustration I tried to get my nep5token deployed on public testnet with neo-cli. That worked without any confirmation and I can call unprivileged functions on testnet.
Another issue is: I cant manage to use neo-cli to call functions that use checkWitness
. There is one single example that feeds some scripthashes and some address to a transfer function, but reproducing that with what I think it means (yay docs! -.-) doesnt work.
invoke 0x... noop []
works.invoke 0x... noopowner []
fails and I have not seen any way to turn any debugging features up.This all needs not more examples - there are examples everywhere - but a good written one that explains the non-obvious constraints and assumptions and how to turn on debugging everywhere.
Have you tried attaching extra gas on the deploy transaction? Shouldn't be required but worth a try.
For your checkwitness problem you'll have to add a transaction attribute. See https://github.com/CityOfZion/neo-python/blob/f343df6c50c5bd39eb0d812c8dc011f717a7df93/examples/build_raw_transactions.py#L170-L173
As for the double/triple deploy. I've not heard of that before, but you could try running the wallet rebuild
command
For turning on debugging from the neo-python side type config help
. It can turn on network logging, results from the virtual machine processing etc. Now this will not help you if the transaction is rejected by the consensus nodes in your private net. Honestly the only way to debug why it is rejected by consensus nodes is to debug the consensus node itself. My personal way of doing that would be setup a single consensus node (solo mode) from source and debug from there. There just isn't a friendly way of doing it.
- Have you tried attaching extra gas on the deploy transaction? Shouldn't be required but worth a try.
no. how would I do that with neopy or neo-cli?
- For your checkwitness problem you'll have to add a transaction attribute. See https://github.com/CityOfZion/neo-python/blob/f343df6c50c5bd39eb0d812c8dc011f717a7df93/examples/build_raw_transactions.py#L170-L173
I later managed to do that with neoline on pubtestnet, but I failed to do that with neopy and neo-cli. how would I do that with those?
- As for the double/triple deploy. I've not heard of that before, but you could try running the
wallet rebuild
command
created container, opened wallet, waited 15 min, ran wallet rebuild
, waited 15 min.
still only 2 deploys, that wont actually deploy, the 3. one will fail with insufficient funds.
- Have you tried attaching extra gas on the deploy transaction? Shouldn't be required but worth a try.
no. how would I do that with neopy or neo-cli?
For neo-cli ask on the neo-cli repo. I don't know. For neo-python, use --attach-gas
when invoking (see sc invoke help
).
- For your checkwitness problem you'll have to add a transaction attribute. See https://github.com/CityOfZion/neo-python/blob/f343df6c50c5bd39eb0d812c8dc011f717a7df93/examples/build_raw_transactions.py#L170-L173
I later managed to do that with neoline on pubtestnet, but I failed to do that with neopy and neo-cli. how would I do that with those?
use --tx-attr
when invoking. Again see sc invoke help
it has an example in the help description. the "usage"
value should be 0x20 and the "data" has to be 20 bytes long because it expects to convert it to a UInt160
https://github.com/CityOfZion/neo-python/blob/f343df6c50c5bd39eb0d812c8dc011f717a7df93/neo/Core/TX/Transaction.py#L716-L720
The conversion part is called by this
https://github.com/CityOfZion/neo-python/blob/f343df6c50c5bd39eb0d812c8dc011f717a7df93/neo/SmartContract/StateReader.py#L200
- As for the double/triple deploy. I've not heard of that before, but you could try running the
wallet rebuild
commandcreated container, opened wallet, waited 15 min, ran
wallet rebuild
, waited 15 min.still only 2 deploys, that wont actually deploy, the 3. one will fail with insufficient funds.
Sorry, no idea what is going on there then.
I am using the template provided below : https://github.com/CityOfZion/neo-boa/blob/master/boa_test/example/demo/NEP5.py And neo-local , to create and deploy locally an NEP-5 token. The process of build and deploy using the related commands runs successfully .
However the INVOKE command doesn't ! The command 'show contracts all' doesn't list this smart contract , but it shows my other non NEP-5 smart contracts. I cannot find my contract using its hash. The command 'show assets all' doesn't show my token either.
I can only test its functionality using build_run command, and it works.
Any help would be appreciated.