laravel-ethereum icon indicating copy to clipboard operation
laravel-ethereum copied to clipboard

eth_sendtransaction error

Open halilulker opened this issue 6 years ago • 5 comments

        $params=array(
            'from'      =>'0x410a0cbc08011d65b4ab11b2199534e86a1131fa',
            'to'        =>'0xabe713314023f63b690c02737f079fb0f74a1741',
            "gas"       => "0x76c0", // 30400
            "gasPrice"  => "0x9184e72a000", // 10000000000000
            'value'     =>'0x9184e72a',
            'data'      =>'0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675'
        );
        Ethereum::eth_sendTransaction($params);

i get eror message like:
throw new ErrorException('Transaction object expected');

what am i wrong?

halilulker avatar Sep 13 '18 09:09 halilulker

hi @halilulker, that function expects an EthereumTransaction class, your code should be like this.

$from = '0x410a0cbc08011d65b4ab11b2199534e86a1131fa';
$to = '0xabe713314023f63b690c02737f079fb0f74a1741';
$gas = '0x76c0';
$gasPrice = '0x9184e72a000';
$value = '0x9184e72a';
$data = '0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675';
               
$transaction = new EthereumTransaction($from, $to, $value, $gas, $gasPrice, $data);
return Ethereum::eth_sendTransaction($transaction);

Hope that helped.

Kind regards.

amandiobm avatar Sep 18 '18 18:09 amandiobm

thank you @amandiobm but i get this error now: Class 'EthereumTransaction' not found

halilulker avatar Sep 19 '18 08:09 halilulker

@halilulker did you imported?! After your namespace has those two lines?

use Jcsofts\LaravelEthereum\Facade\Ethereum;
use Jcsofts\LaravelEthereum\Lib\EthereumTransaction;

Just to ensure, my composer.json has this "jcsofts/laravel-ethereum": "dev-master" as the version installed.

amandiobm avatar Sep 19 '18 17:09 amandiobm

Hi there i am getting this error can you help while using the send Transaction Only support send transaction with ipc

danirabbani90 avatar Apr 18 '19 12:04 danirabbani90

How to generate $data value?

$from = '0x410a0cbc08011d65b4ab11b2199534e86a1131fa'; $to = '0xabe713314023f63b690c02737f079fb0f74a1741'; $gas = '0x76c0'; $gasPrice = '0x9184e72a000'; $value = '0x9184e72a'; $data = '0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675';

$transaction = new EthereumTransaction($from, $to, $value, $gas, $gasPrice, $data); return Ethereum::eth_sendTransaction($transaction);

Vikasvekariya avatar Oct 12 '22 05:10 Vikasvekariya