lib/WalletManager.php
/*
     * Generate a Monero address from seed
     *
     * @param string Hex string to use as seed
     *
     * @return string A base58 encoded Monero address
     */
Generate a Monero address from seed
@param string Hex string to use as seed

@return string A base58 encoded Monero address
Generate a Monero address from seed @param string Hex string to use as seed @return string A base58 encoded Monero address
public function wallet_from_seed($hex_seed = null, $ret_mnemonic = true)
    {
        if ($hex_seed === null) {
            $hex_seed = $this->gen_new_hex_seed();
        }
        if (strlen($hex_seed) !== 64) {
            throw new Exception('Error: Incorrect seed length');
        }
        $private_keys = $this->gen_private_keys($hex_seed);
        $private_viewKey = $private_keys["viewKey"];
        $private_spendKey = $private_keys["spendKey"];
        $public_spendKey = $this->pk_from_sk($private_spendKey);
        $public_viewKey = $this->pk_from_sk($private_viewKey);
        $address = $this->encode_address($public_spendKey, $public_viewKey);
        $mnemonic = $ret_mnemonic === true ? $this->mn_encode($hex_seed) : null;
        return array(
            'seed' => $hex_seed,
            'mnemonic' => $mnemonic,
            'address' => $address,
            'view_private' => $private_viewKey,
            'view_public' => $public_viewKey,
            'spend_private' => $private_spendKey,
            'spend_public' => $public_spendKey,
        );
    }
public function wallet_from_seed ( $ hex_seed = null , $ ret_mnemonic = true ) { if ( $ hex_seed === null ) { $ hex_seed = $ this -> gen_new_hex_seed ( ) ; } if ( strlen ( $ hex_seed ) !== 64 ) { throw new Exception ( 'Error: Incorrect seed length' ) ; } $ private_keys = $ this -> gen_private_keys ( $ hex_seed ) ; $ private_viewKey = $ private_keys [ " viewKey " ] ; $ private_spendKey = $ private_keys [ " spendKey " ] ; $ public_spendKey = $ this -> pk_from_sk ( $ private_spendKey ) ; $ public_viewKey = $ this -> pk_from_sk ( $ private_viewKey ) ; $ address = $ this -> encode_address ( $ public_spendKey , $ public_viewKey ) ; $ mnemonic = $ ret_mnemonic === true ? $ this -> mn_encode ( $ hex_seed ) : null ; return array ( 'seed' => $ hex_seed , 'mnemonic' => $ mnemonic , 'address' => $ address , 'view_private' => $ private_viewKey , 'view_public' => $ public_viewKey , 'spend_private' => $ private_spendKey , 'spend_public' => $ public_spendKey , ) ; }
Generate a Monero address from seed
 @param string Hex string to use as seed
Generate a Monero address from seed @param string Hex string to use as seed
// Validate the seed length.