0

I want to send a transaction in BSC network. I already set this params for sending

Array
(
    [nonce] => 0
    [address] => 0xb7a2565fa170b8b5b2bf5035665f169066a5c7fb
    [toaddress] => 0xF355320a7d4F2aF95a43C64CD2e76bBE266286Aa
    [gaslimit] => 21000
    [gasprice] => 5
    [value_wei] => 0.01
    [web3ChainId] => 97
)

which is calles from this code

    $transactionparams = array(
      "nonce" => $gettransactioncount,
      'address' => $address,
      'toaddress' => $toaddress,
      'gaslimit' => 21000,
      'gasprice' => 5,
      'value_wei' => 0.01,
      'web3ChainId' => 0x61
    );

Then I try to send it to BSC network and set these params

function bcdechex($dec){
    $hex = '';
    do {
        $last = bcmod($dec, 16);
        $hex = dechex($last) . $hex;
        $dec = bcdiv(bcsub($dec, $last), 16);
    } while ($dec > 0);
    return $hex;
}

    $transactionParams = [
        'nonce' => "0x" . dechex($nonce),
        'from' => strtolower($address),
        'to' =>  strtolower($toaddress),
        'gasLimit' =>  '0x' . dechex($gaslimit),
        'gasPrice' =>  '0x' . hexdec(dechex($gasprice)),
        'value' => '0x' . bcdechex($value_wei),
        'chainId' => strval($web3ChainId)
    ];

but always return insufficient funds for gas * price + value I already try to reduce the amount of sending also try to increase the gas price and limit but no luck. Anyone know this?

3
  • Do you allow spend of your token ? "Approve" , toAddress need have function check the smart contract and for buy token its a path [tokenA,tokenB], your address 0xF355320a7d4F2aF95a43C64CD2e76bBE266286Aa don't have function this is not a smart contract
    – forexmp45
    Mar 20, 2023 at 1:42
  • I'm not saying that I send a token from smart contract? By the way I already found the solution thanks Mar 20, 2023 at 3:41
  • Ok cool if you find solution can you please add it for other please its important for this community here :)
    – forexmp45
    Mar 20, 2023 at 22:29

1 Answer 1

1

found a fix change the request to a higher gasprice since the last previous transac will be replace by it

Array
(
    [gasprice] => 10
)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.