CityOfZion / neon-wallet-react-native

MIT License
12 stars 8 forks source link

Validate NEP5 implementation against latest changes #4

Closed ixje closed 6 years ago

ixje commented 6 years ago

The NEP5 proposal has changed since my last implementation. Validate if it's still correct and update where needed.

See changes here

chrismpalmer commented 6 years ago

Not sure the nep5 transfer call is working. I do the call and actually get back "false" in the result. Of course this assumes my setup data is correct. I can fetch the nep5 smart contract balance deployed on my private net.

ixje commented 6 years ago

@chrismpalmer I'm spinning up a private network as I'm writing this to test the function. Strange enough I didn't get notified about this comment and just happen to stumble on it. It might be best to tag me in the future if you have a question to make sure I won't miss them.

edit: I'm experiencing the same 'false' response as you report. I have not yet figured out the cause. Will look more into it the coming days (I have time tomorrow and then Saturday again).

ixje commented 6 years ago

So this became interesting. I worked on it again today and I couldn't reproduce the false RPC response anymore. It now just works 🤔

img

I modified the homescreen code for testing as shown here

What I can say at least is that I compared the output of this function https://github.com/CityOfZion/neon-wallet-react-native/blob/2dd019350ce277cb4beb879e09234f2d40437768/app/api/crypto/nep5.js#L62 with the equivalent of neo-python and the results are identical. So if for whatever reason the RPC calls start failing again I would probably continue and double check the results of these lines https://github.com/CityOfZion/neon-wallet-react-native/blob/2dd019350ce277cb4beb879e09234f2d40437768/app/api/network/index.js#L227-L230

For now I kind of have to conclude it's working because I can't reproduce it anymore. If you figure out how to reproduce it, let me know and I'd be happy to re-open and investigate further!

chrismpalmer commented 6 years ago

Hi @ixje Thanks for being so thorough... I created a quick node js project and I can do every transaction against my privnet.... for some reason the transaction comes back but its false. You can test the rpc end point at : https://neo-privnet-rpc.ngrok.io and https://neoscan-privnet.ngrok.io. There are a few changes Attached is a quick patch of trunk. It should run enough... you can open this dummy wallet using its privateKey KzGnppHL8hfE5deorkcn25rs6sGEzHRvxd3wWnvcpRxnxc7Qi9qZ QuickTest.txt

I am really at a loss... perhaps on TestNet this all works. I am running the Docker Scanner Net image?

ixje commented 6 years ago

@chrismpalmer I would like to also connect using neo-python (a node client) so I can run some tests, but I need a bit more details. Can you link me to the "Docker Scanner Net" image you're referring to? I don't know which one that is. I'm in particular looking for information contained in this file as well as the RPC port numbers.

I tried guessing the most common used ones (10333-10336, 20332-20336, 30332-30336) but without luck. If you can provide the above information and validate that those ports are exposed to the outside world then I can give it another try.

PS: I was also running a private network, so shouldn't matter. We can figure it out no worries :)

chrismpalmer commented 6 years ago

@ixje thanks, https://github.com/CityOfZion/neo-privatenet-docker is the project my rpc node is port 30333.

ixje commented 6 years ago

@chrismpalmer still doesn't seem to work.

(venv) Eriks-Air:neo-python erik$ curl -X POST https://neo-privnet-rpc.ngrok.io:30333 -H 'Content-Type: application/json' -d '{ "jsonrpc": "2.0", "id": 5, "method": "getversion", "params": [] }'
curl: (7) Failed to connect to neo-privnet-rpc.ngrok.io port 30333: Operation timed out

where as

(venv) Eriks-Air:neo-python erik$ curl -X POST http://seed2.cityofzion.io:8080 -H 'Content-Type: application/json' -d '{ "jsonrpc": "2.0", "id": 5, "method": "getversion", "params": [] }'
{"jsonrpc":"2.0","id":5,"result":{"port":10333,"nonce":1478959039,"useragent":"\/NEO:2.7.4\/"}}

If you're up for it we can try to resolve it a bit more realtime using the NEO Discord. Just DM me at the same username. I'll be on for at least the next 3 hours and perhaps longer.

chrismpalmer commented 6 years ago

@ixje you don’t need the port it’s auto mapped

chrismpalmer commented 6 years ago

@ixje thanks for the offer I’m at a surf contest with my son I can’t get it till another day. Sounds like the plan though.

ixje commented 6 years ago

@chrismpalmer no port for the RPC server worked! The only thing where that trick doesn't work is for connecting neo-python via P2P. That really needs a port. I'll see how far I can get using just the available RPC server.

Wish him good luck on the contest and cheer hard! 🏄

chrismpalmer commented 6 years ago

@ixje ok, I can expose the p2p just have to do it when I get home

ixje commented 6 years ago

@chrismpalmer can you also give me the contract hash of the NEP5 token you've deployed on your privatenet? thanks.

ixje commented 6 years ago

Going to assume my Discord feedback solved the issue, haven't heard anything anymore for a week.

chrismpalmer commented 6 years ago

@ixje Hi Erik! Left you some notes on Discord. I am really sorry I didn't get back to you quick. We just got assigned this again so I am back on it.