web3p / web3.php

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

issues in creating account #174

Open katoyi120 opened 4 years ago

katoyi120 commented 4 years ago

When I create an account using the 'personal_newaccount' method, the blockchain is created successfully, but the page cannot get the address of the account. The error message is' connection timeout '.

SilvanAbuse commented 4 years ago

Same cURL error 28: Operation timed out after 1000 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)

SilvanAbuse commented 4 years ago
        use Web3\Providers\HttpProvider;
        use Web3\RequestManagers\HttpRequestManager;
        $timeout = 30;

        $web3 = new Web3(new HttpProvider(new 
        HttpRequestManager('host', $timeout)));

resolved it

agustind commented 3 years ago

Also If you want to interact with a contract, you can set the timeout like this:

$timeout = 30;
$contract = new Contract( new HttpProvider(new HttpRequestManager('http://localhost:8545', $timeout)) , $abi);
alvinChristianto commented 2 years ago

Also If you want to interact with a contract, you can set the timeout like this:

$timeout = 30;
$contract = new Contract( new HttpProvider(new HttpRequestManager('http://localhost:8545', $timeout)) , $abi);

this works for me, to connect to some ropsten just do this : $contract = new Contract(new HttpProvider(new HttpRequestManager("https://ropsten.infura.io/v3/790551957e7d483a932d0b1a3f6e7xxx", $timeout)) , $abi);