Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

draft: Final touches (closes #147, #135, #133, #132, #124, #111, #100, #92, #82, #81, #57, #54) #154

Draft
wants to merge 44 commits into
base: master
Choose a base branch
from

Conversation

recanman
Copy link
Contributor

@recanman recanman commented May 2, 2024

This pull request contains the final changes needed for the package migration.
Package name will be changed to monero-integrations/monero-crypto (namespace MoneroIntegrations\MoneroCrypto)

This will also bump the minimum PHP version to 8.1.
A fork of refring's work. This will be called monero-integrations/monero-rpc (namespace MoneroIntegrations\MoneroRpc).

Tasks left:

  • Finish refactoring the other classes and add unit tests for them
    • Varint
    • Base58
    • Mnemonic
    • Subaddress
    • Ed25519
    • Cryptonote
  • Create a workflow for publishing on Packagist
  • Create a new repository in monero-integrations for the MoneroRpc package
  • Write some documentation/redo the README

Most of my work is usually offline/on my local git server and I may not push to this PR's branch frequently.

I've spent some time with refring's code and tested it (it is very good). Merging it is just a matter of creating a new repository (I will CC serhack at the appropriate time)

@recanman
Copy link
Contributor Author

recanman commented May 10, 2024

An extremely important task is to have tests for these cryptographic operations (to make sure results are consistent of course). If anyone seeing this is willing to give an expected input/output for each function in Cryptonote.php while I'm refactoring, that would be really great (if it isn't done, I'll do it myself. Just in case anyone else wants to speed up the migration process).

@recanman
Copy link
Contributor Author

recanman commented May 16, 2024

Rewriting it with sodium does not seem feasible at the moment as certain functions are not too well-documented. I've decided to add types, tests, and clean up the code for ed25519 and Cryptonote.
The scalarmult function in the ed25519 class is recursive and incredibly slow (15+ seconds). I'll fix that as well.

Here's my progress on Cryptonote.php:

  • keccak_256
  • gen_new_hex_seed
  • sc_reduce
  • hash_to_scalar
  • derive_viewKey
  • gen_private_keys
  • pk_from_sk
  • gen_key_derivation
  • derivation_to_scalar
  • stealth_payment_id
  • txpub_from_extra
  • derive_public_key
  • is_output_mine
  • encode_address
  • verify_checksum
  • decode_address
  • integrated_addr_from_keys
  • address_from_seed
  • generate_subaddr_secret_key
  • generate_subaddress_spend_public_key
  • generate_subaddr_view_public_key
  • generate_subaddress
  • deserialize_block_header

@recanman recanman force-pushed the recanman/refactor branch 3 times, most recently from b6a1c60 to 69b9a6f Compare May 25, 2024 02:44
@recanman
Copy link
Contributor Author

Just added the publishing workflow. I'm about 80% done with the rest of the refactoring, but yet to polish it up and push it here.
@serhack, could you create a new repository under this organization? My name suggestion would be monerophp-rpc.

@recanman
Copy link
Contributor Author

recanman commented May 27, 2024

Ed25519 (public methods in reference implementation:

  • H
  • expmod
  • inv
  • xrecover
  • edwards
  • scalarmult
  • encodeint
  • encodepoint
  • bit
  • Hint
  • publickey
  • signature
  • isoncurve
  • decodeint
  • decodepoint
  • checkvalid

@serhack
Copy link
Member

serhack commented May 27, 2024

@serhack, could you create a new repository under this organization? My name suggestion would be monerophp-rpc.

Sorry, I've missed a point, why shouldn't there be only one repo with all PHP related library?

@recanman
Copy link
Contributor Author

recanman commented May 27, 2024

I don't think Composer can manage a monorepo with multiple packages.
Two packages: one for the cryptography operations, and one for the wallet/daemon RPC client

@recanman
Copy link
Contributor Author

@serhack, any updates?

@serhack
Copy link
Member

serhack commented May 31, 2024

Tomorrow I'll create the second repository :)

@serhack
Copy link
Member

serhack commented Jun 2, 2024

@recanman I created the new repository

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants