monero-ecosystem / monero-python

A comprehensive Python module for handling Monero cryptocurrency
BSD 3-Clause "New" or "Revised" License
246 stars 80 forks source link

Wownero fork #69

Closed lalanza808 closed 4 years ago

lalanza808 commented 4 years ago

Hi Michał,

I was wondering if you could give me some pointers on refactoring this library to operate with the Monero fork, Wownero.

I've forked the repo here: https://git.wownero.com/lza_menace/wownero-python

I've made some adjustments in monero/const.py just from evaluating diffs in the C++ code bases cryptonote_config.h (prefixes), but am having difficulty in trying use the library to generate new accounts:

ValueError: Invalid address netbyte 10. Allowed values are: 18, 24, 35, 3f, 1032, 2fb0

From evaluating the code it seems like the only places to change are the constants stored which are hardcoded Monero values and then the string slices in address generation. I would like some help/pointers in understanding those slices as I think they are where the problems lie and I'm not familiar enough with the underlying cryptography to know how to position them.

Any assistance or pointers would be greatly appreciated.

lalanza808 commented 4 years ago

Also:

Nice.

emesik commented 4 years ago

Hi,

First of all, the error message shows there could be something wrong with the netbytes, as the last two values are more than 8 bits. If that's the case and Wownero uses longer addresses (e.g. using 2 netbytes instead of one), you must do some extra work and ensure proper endianness.

The official doc describes address structure: https://monerodocs.org/public-address/standard-address/ What it doesn't mention is the fact the first byte of the address is netbyte and it has different values not only for each network, but for each address class (base, subaddress, integrated). That's exactly what's in the const.py file.

Subaddress generation may also differ in Wownero (https://monero.stackexchange.com/questions/10674/how-are-subaddresses-and-account-addresses-generated-from-master-wallet-keys/10676#10676)

Here's a tool that could help you, even though it doesn't support Wownero: https://xmr.llcoins.net/addresstests.html

lalanza808 commented 4 years ago

Thanks so much for the pointers, it is much appreciated! I will spend some more time investigating and debugging.