0

I am creating an ERC Token selling website. When a user signs up on the website, there should be generated an eth wallet automatically for that user and to store in db. After that when ever the user purchase coins from our website, the coin amount should be transferred to the user's created eth wallet.

I've tried this code with web3 within laravel:

use Web3\Web3;
use Web3\Providers\HttpProvider;
use Web3\RequestManagers\HttpRequestManager;

public function createETHWallet()
{

$web3 = new Web3('http://localhost:8012');
$personal = $web3->personal;
$newAccount = '';

$personal->newAccount('123456', function ($err, $account) use (&$newAccount) {
    if ($err !== null) {
        echo 'Error: ' . $err->getMessage();
        return;
    }
    $newAccount = $account;
    echo 'New account: ' . $account . PHP_EOL;
});
}

But it is giving me an error, which is:

First parameter must either be an object or the name of an existing class

What is the issue?

Note: I am working on laravel app using web3 package.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Muhammad Noman
  • 155
  • 1
  • 5
  • 12
  • The error message is related to PHP native function [property_exists()](https://www.php.net/manual/en/function.property-exists.php), which is not used directly in your snippet. Please update your question with the error trace, so that it's possible to see where in your code this error originates. It's possibly caused just by a misconfiguration. – Petr Hejda Jul 01 '21 at 08:59
  • full code is included in the question and the error i received, I've included it already. cant you see plz? – Muhammad Noman Jul 01 '21 at 09:24

0 Answers0