neropay/vendor/monero-integrations/monerophp/docs/cryptonote.md
2025-03-06 14:50:41 -05:00

4.8 KiB

cryptonote class

src/cryptonote.php

Methods

keccak_256

Derive a Keccak256 hash from a string

Parameters:

  • $message <String> Hex encoded string of the data to hash

Return: <String> Hex encoded string of the hashed data

gen_new_hex_seed

Generate a hexadecimal seed

Return: <String> A hex encoded string of 32 random bytes

sc_reduce

Parameters:

  • $input <String>

hash_to_scalar

Hs in the cryptonote white paper

Parameters:

  • $data <String> Hex encoded data to hash

Return: <String> A 32 byte encoded integer

derive_viewKey

Derive a deterministic private view key from a private spend key

Parameters:

  • $spendKey <String> A deterministic private view key represented as a 32 byte hex string

Return: <String>

gen_private_keys

Generate a pair of random private keys

Parameters:

  • $seed <String> A hex string to be used as a seed (this should be random)

Return: <Array> An array containing a private spend key and a deterministic view key

pk_from_sk

Get a public key from a private key on the ed25519 curve

Parameters:

  • $privKey <String> A 32 byte hex encoded private key

Return: <String>

gen_key_derivation

Generate key derivation

Parameters:

  • $public <String> a 32 byte hex encoding of a point on the ed25519 curve used as a public key
  • $private <String> a 32 byte hex encoded private key

Return: <String> The hex encoded key derivation

encode_varint

Parameters:

  • $der <>
  • $index <>

derivation_to_scalar

Parameters:

  • $ <>

stealth_payment_id

A one way function used for both encrypting and decrypting 8 byte payment IDs

Parameters:

  • $payment_id <String>
  • $tx_pub_key <String>
  • $viewkey <String>

Return: <String>

txpub_from_extra

Takes transaction extra field as hex string and returns transaction public key 'R' as hex string

Parameters:

  • $extra <String>

Return: <String>

derive_public_key

Parameters:

  • $der <>
  • $index <>
  • $pub <>

Return: <String>

is_output_mine

Perform the calculation P = P' as described in the cryptonote whitepaper

Parameters:

  • $txPublic <String> 32 byte transaction public key R
  • $privViewkey <String> 32 byte receiver private view key a
  • $publicSpendkey <String> 32 byte receiver public spend key B
  • $index <Number> Otput index
  • $P <String> Output you want to check against P

Return: <Boolean>

encode_address

Create a valid base58 encoded Monero address from public keys

Parameters:

  • $pSpendKey <String> Public spend key
  • $pViewKey <String> Public view key

Return: <String> Base58 encoded Monero address

verify_checksum

Parameters:

  • $address <>

Return: <Boolean>

decode_address

Decode a base58 encoded Monero address

Parameters:

  • $address <String> A base58 encoded Monero address

Return: <Array> An array containing the Address network byte, public spend key, and public view key //: # (TODO example)

integrated_addr_from_keys

Create an integrated address from public keys and a payment ID

Parameters:

  • $public_spendkey <String> A 32 byte hex encoded public spend key
  • $public_viewkey <String> A 32 byte hex encoded public view key
  • $payment_id <String> An 8 byte hex string to use as a payment id

Return: <String> Integrated address

address_from_seed

Derive Monero address from seed

Parameters:

  • $hex_seed <String> Hex string to use as seed

Return: <String> A base58 encoded Monero address