provider, $testAbi); $web3->eth->accounts(function ($err, $accounts) use ($contract, $testBytecode) { if ($err === null) { if (isset($accounts)) { $accounts = $accounts; } else { throw new RuntimeException('Please ensure you have access to web3 json rpc provider.'); } $fromAccount = $accounts[0]; $toAccount = $accounts[1]; $contract->bytecode($testBytecode)->new(1000000, 'Game Token', 1, 'GT', [ 'from' => $fromAccount, 'gas' => '0x200b20' ], function ($err, $result) use ($contract, $fromAccount, $toAccount) { if ($err !== null) { throw $err; } if ($result) { echo "\nTransaction has made:) id: " . $result . "\n"; } $transactionId = $result; $contract->eth->getTransactionReceipt($transactionId, function ($err, $transaction) use ($contract, $fromAccount, $toAccount) { if ($err !== null) { throw $err; } if ($transaction) { $contractAddress = $transaction->contractAddress; echo "\nTransaction has mind:) block number: " . $transaction->blockNumber . "\n"; $contract->at($contractAddress)->send('transfer', $toAccount, 16, [ 'from' => $fromAccount, 'gas' => '0x200b20' ], function ($err, $result) use ($contract, $fromAccount, $toAccount) { if ($err !== null) { throw $err; } if ($result) { echo "\nTransaction has made:) id: " . $result . "\n"; } $transactionId = $result; $contract->eth->getTransactionReceipt($transactionId, function ($err, $transaction) use ($fromAccount, $toAccount) { if ($err !== null) { throw $err; } if ($transaction) { echo "\nTransaction has mind:) block number: " . $transaction->blockNumber . "\nTransaction dump:\n"; var_dump($transaction); } }); }); } }); }); } });