svanas / delphereum

web3 implementation for the Delphi programming language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

About 'Range check error' on web3.eth.chainlink

clarkzhu2020 opened this issue · comments

Please help me out of the error , When I build the project 'transfer eum with delphi' , I always got the error 'Range check error' with delphi 11, thanks!

I cannot seem to reproduce this error. Did you pull the latest version of this repo? If yes, what target are you compiling for?

I just follow up https://svanas.medium.com/transferring-ether-with-delphi-b5f24b1a98a4, when I compile with delphi 11(alexandria) is ok, but when I run it with click button, It 's always show me 'Range check error', with debug track , I found it stop in web3.eth.chainlink, code as below:
unit Unit1;

interface

uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Mask, Vcl.ExtCtrls, Vcl.StdCtrls,web3;

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

uses web3.eth.tx,web3.eth.utils,Velthuis.BigIntegers;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin

web3.eth.tx.sendTransaction(
TWeb3.Create('http://127.0.0.1:7545'), // Ganache
'bcd96b06b01ff32f3594f4dcd8f4cf5a2fee4aa71240571e55718e7b13b27510', // from private key
'0xa146ce5ef00542D58275C4efb0e477517DdA0f0B', // to public key
web3.eth.utils.toWei('0.01', ether), // 0.01 ether

procedure(tx: TTxHash; err: IError)
begin
  TThread.Synchronize(nil, procedure
  begin
    if Assigned(err) then
      MessageDlg(err.Message, TMsgDlgType.mtError, [TMsgDlgBtn.mbOK], 0)
    else
      MessageDlg(string(tx), TMsgDlgType.mtInformation, [TMsgDlgBtn.mbOK], 0);
  end);
end

);

end;

end.

Thank you for bringing this problem to my attention. There were 2 issues:

  1. Chainlink is not available on Ganache, and
  2. Ganache 2.x does not support EIP-1559.

Please pull the latest version of this repo, and then include transaction type 0 (zero) with your web3 client:

TWeb3.Create('http://127.0.0.1:7545', 0)

I have update this example accordingly.