mirror of
https://github.com/Such-Software/wowcheckout.git
synced 2026-10-17 05:51:45 +02:00
Fork xmrcheckout for Wownero (WOW)
Minimal changes from upstream xmrcheckout to support Wownero: - Rate provider: Nonlogs WOW-BTC via Kraken BTC/USD - Subaddress derivation: Wownero network byte overrides (53/63/54) - Payment URI scheme: wownero: - Dockerfile: Wownero binaries from Codeberg - Display text: Monero→Wownero, XMR→WOW throughout UI - Default daemon: 192.168.88.235:34568 - Added wownero-logo.svg File and folder structure kept identical to upstream for easy sync.
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from binascii import hexlify, unhexlify
|
||||
import struct
|
||||
|
||||
from monero import base58, const, ed25519
|
||||
from monero.address import Address
|
||||
from monero.keccak import keccak_256
|
||||
|
||||
# Override monero library network constants for Wownero
|
||||
from monero import const as _mc
|
||||
_mc.NETS = ('main',)
|
||||
_mc.MASTERADDR_NETBYTES = (53,) # Wownero mainnet address prefix
|
||||
_mc.SUBADDR_NETBYTES = (63,) # Wownero subaddress prefix
|
||||
_mc.INTADDRR_NETBYTES = (54,) # Wownero integrated address prefix
|
||||
|
||||
|
||||
def derive_subaddress(
|
||||
*,
|
||||
payment_address: str,
|
||||
view_key: str,
|
||||
account_index: int,
|
||||
address_index: int,
|
||||
) -> str:
|
||||
address = Address(payment_address)
|
||||
view_key_bytes = unhexlify(view_key)
|
||||
spend_pub_bytes = unhexlify(address.spend_key())
|
||||
|
||||
data = (
|
||||
b"SubAddr\0"
|
||||
+ view_key_bytes
|
||||
+ struct.pack("<II", account_index, address_index)
|
||||
)
|
||||
m = ed25519.scalar_reduce(keccak_256(data).digest())
|
||||
mG = ed25519.scalarmult_B(m)
|
||||
D = ed25519.edwards_add(spend_pub_bytes, mG)
|
||||
C = ed25519.scalarmult(view_key_bytes, D)
|
||||
prefix = const.SUBADDR_NETBYTES[const.NETS.index(address.net)]
|
||||
payload = bytearray([prefix]) + D + C
|
||||
checksum = keccak_256(payload).digest()[:4]
|
||||
return base58.encode(hexlify(payload + checksum))
|
||||
Reference in New Issue
Block a user