web3p / web3.php

A php interface for interacting with the Ethereum blockchain and ecosystem. Native ABI parsing and smart contract interactions.
MIT License
1.15k stars 540 forks source link

Create Wallet #313

Open robinkbr opened 1 year ago

robinkbr commented 1 year ago

Do you know how to make a wallet in php?

Aangelojo commented 1 year ago

`protected $web3;

public function __construct()
{
    //与合约交互需要设置超时
    $this->web3 = new Web3(new HttpProvider(new HttpRequestManager('http://127.0.0.1:8545', 30)));
}

public function createAccount() { $this->web3->personal->newAccount('your_password', function ($err, $account) { if ($err !== null) { // do something return; } echo $account; }); } `

victorratts13 commented 2 weeks ago

`protected $web3;

public function __construct()
{
    //与合约交互需要设置超时
    $this->web3 = new Web3(new HttpProvider(new HttpRequestManager('http://127.0.0.1:8545', 30)));
}

public function createAccount() { $this->web3->personal->newAccount('your_password', function ($err, $account) { if ($err !== null) { // do something return; } echo $account; }); } `

Whats is HttpRequestManager?