kesar / ethereum-php

Ethereum Client in PHP
103 stars 50 forks source link

How to send a transaction ? #1

Closed JellyBool closed 6 years ago

JellyBool commented 6 years ago

Hi, can I send a transaction between to accounts using this package?

btw, does it support ETC ?

kesar commented 6 years ago

Not sure if it works with ETC, I was doing it for ETH.

If you want to send a transaction you should write something like:

        $this->client->personal()->unlockAccount($youradrress, $yourpassword, 15);

        $transaction = new \EthereumPHP\Types\Transaction(
            $youraddress,
            $otheraddress,
            null,
            null,
            new Wei(1),
            $amountToSend
        );

        $transactionHash = $this->client->eth()->sendTransaction($transaction);

I hope it helps!