forked from such-gitea/wownero-lws
Port monero-lws to wownero-lws
Adapts monero-lws for Wownero cryptocurrency: - Rename all monero-lws-* binaries to wownero-lws-* - Update submodule to point to official Wownero repo - Use Wownero default ports (RPC: 34568, ZMQ: 34569) - Update data directory to ~/.wownero/light_wallet_server - Adapt next_difficulty() calls for Wownero API signature Key technical changes for Wownero compatibility: - BulletproofPlus (RCTTypeBulletproofPlus, type 8) commitment verification: Wownero stores BP+ commitments in 'divided by 8' form. Must call rct::scalarmult8() on outPk commitment before comparing with computed commitment (mask*G + amount*H). This is essential for amount decryption. - Pass rct_type to decode_amount() for proper commitment handling - Handle Wownero's ZMQ JSON format for ecdhTuple (32-byte mask/amount fields) No fork of Wownero is required - uses official codeberg.org/wownero/wownero.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
# Copyright (c) 2020, The Monero Project
|
||||
# Copyright (c) 2024-2025, The Wownero Project
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
@@ -26,8 +27,8 @@
|
||||
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
set(monero-lws-util_sources blocks.cpp gamma_picker.cpp random_outputs.cpp source_location.cpp transactions.cpp)
|
||||
set(monero-lws-util_headers blocks.h fwd.h gamma_picker.h random_outputs.h source_location.h transactions.h)
|
||||
set(wownero-lws-util_sources blocks.cpp gamma_picker.cpp random_outputs.cpp source_location.cpp transactions.cpp)
|
||||
set(wownero-lws-util_headers blocks.h fwd.h gamma_picker.h random_outputs.h source_location.h transactions.h)
|
||||
|
||||
add_library(monero-lws-util ${monero-lws-util_sources} ${monero-lws-util_headers})
|
||||
target_link_libraries(monero-lws-util monero::libraries monero-lws-db)
|
||||
add_library(wownero-lws-util ${wownero-lws-util_sources} ${wownero-lws-util_headers})
|
||||
target_link_libraries(wownero-lws-util wownero::libraries wownero-lws-db)
|
||||
|
||||
@@ -45,7 +45,7 @@ void lws::decrypt_payment_id(crypto::hash8& out, const crypto::key_derivation& k
|
||||
out.data[b] ^= hash.data[b];
|
||||
}
|
||||
|
||||
boost::optional<std::pair<std::uint64_t, rct::key>> lws::decode_amount(const rct::key& commitment, const rct::ecdhTuple& info, const crypto::key_derivation& sk, std::size_t index, const bool bulletproof2)
|
||||
boost::optional<std::pair<std::uint64_t, rct::key>> lws::decode_amount(const rct::key& commitment, const rct::ecdhTuple& info, const crypto::key_derivation& sk, std::size_t index, const bool bulletproof2, const std::uint8_t rct_type)
|
||||
{
|
||||
crypto::secret_key scalar{};
|
||||
crypto::derivation_to_scalar(sk, index, scalar);
|
||||
@@ -55,7 +55,14 @@ boost::optional<std::pair<std::uint64_t, rct::key>> lws::decode_amount(const rct
|
||||
|
||||
rct::key Ctmp;
|
||||
rct::addKeys2(Ctmp, copy.mask, copy.amount, rct::H);
|
||||
if (rct::equalKeys(commitment, Ctmp))
|
||||
|
||||
// Wownero BulletproofPlus: commitments are stored in "divided by 8" form
|
||||
// Must multiply by 8 (scalarmult8) before comparing
|
||||
rct::key C = commitment;
|
||||
if (rct_type == rct::RCTTypeBulletproofPlus)
|
||||
C = rct::scalarmult8(C);
|
||||
|
||||
if (rct::equalKeys(C, Ctmp))
|
||||
return {{rct::h2d(copy.amount), copy.mask}};
|
||||
return boost::none;
|
||||
}
|
||||
|
||||
@@ -41,5 +41,5 @@ namespace crypto
|
||||
namespace lws
|
||||
{
|
||||
void decrypt_payment_id(crypto::hash8& out, const crypto::key_derivation& key);
|
||||
boost::optional<std::pair<std::uint64_t, rct::key>> decode_amount(const rct::key& commitment, const rct::ecdhTuple& info, const crypto::key_derivation& sk, std::size_t index, const bool bulletproof2);
|
||||
boost::optional<std::pair<std::uint64_t, rct::key>> decode_amount(const rct::key& commitment, const rct::ecdhTuple& info, const crypto::key_derivation& sk, std::size_t index, const bool bulletproof2, const std::uint8_t rct_type);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user