svanas / delphereum

web3 implementation for the Delphi programming language
Other
132 stars 48 forks source link

Hi, guru, I failed in "transferring-ether-with-delphi" with an exception of “Invalid signature v value”, please give me a hand,thank you. #55

Closed gneowing closed 1 year ago

gneowing commented 1 year ago

Hi, guru,

My environment:

  1. Embarcadero® Delphi 10.4 Version 27.0.38860.1461 (10.4 Update 1)
  2. Windows 7 Service Pack 1(Version 6.1, Build 7601 64-bit Edition)
  3. Ganche UI v2.7.1 from github
  4. Latest(2 weeks ago) code from https://github.com/svanas/delphereum

I tried the tutorials from 1 till 4, all is well (after very small modification of Json and TLS things) and thrilled me. But while running the 5th: https://svanas.medium.com/transferring-ether-with-delphi-b5f24b1a98a4 I did see the confirm dialog of “Your signature is being requested. Network: Ethereum From:0xfEB684 To:0xdc3111 Gas price: 20 GWei Gas estimate: 21000 units Gas fee: $0.80 Do you approve of this request”

But after clicking the “Yes” button, I got an exception of “Invalid signature v value” , it confused me . Please give a hand about it, your generous help will be very appreciated 😊.

svanas commented 1 year ago

Thank you for your bug report. There was an issue with this example, but I couldn't reproduce your error. Please pull the latest source, use the updated example, and try again. Thanks!

svanas commented 1 year ago

Please note I still need to update medium article 8-12. Article 1-7 should be fine. Please let me know if you find any problems with them. Thanks!

gneowing commented 1 year ago

Hi, guru,

Thank you very much for your precious time to reply my issue.

I made a mistake in my initial description of the issue that I said “ I failed in Generating an Ethereum-signed message signature in Delphi “. Sorry for that, in fact, as I corrected finally, I failed in "transferring-ether-with-delphi" with an exception of “Invalid signature v value”. In another word, while following the instruction from https://svanas.medium.com/transferring-ether-with-delphi-b5f24b1a98a4 .

And your reply only refered to the ethereum-signed things. Anyway, yesterday I git-pull all the related repository: delphereum, DelphiBigNumbers, SimpleBaseLib4Pascal, HashLib4Pascal and CryptoLib4Pascal. I recreated the project then added the 55 search pathes, alas, the error of “Invalid signature v value” is still there.

I did modify two files: web3.http.pas and web3.json.pas. [image: 图片1.png]

According to the official doc of Infura, they support TLS 1.2, so I modified the THttpClient’s SecureProtocols as TLS12 in web3.http.pas. [image: 图片2.png] For Delphi10.4.1 does not support TJsonValue.ParseJsonValue anymore, TJSONObject is used instead in web3.json.pas. [image: 图片3.png] My project has combined the first 5 tutorial examples, and the 1~4 are all OK as the following pic shows in the goupbox with caption of “Log”. And after clicking the “Send” button at the middle-end, a “Confirm” dialog will pop up and an “Error” one will pop up after clicking “Yes” button. [image: 图片4.png]

[image: 图片5.png]

And the following pic will show the from-PrivateKey and To-PublicKey are both valid in Ganache. [image: 图片6.png]

And my environment still is : Embarcadero® Delphi 10.4 Version 27.0.38860.1461 (10.4 Update 1) Windows 7 Service Pack 1(Version 6.1, Build 7601 64-bit Edition) Ganche UI v2.7.1 from github

I am fond of Delphi and I am a newer in Ethereum. Hope your further support about this issue😊.

Attached the code lines: procedure TFormTest.Button_TransactionViaGanache_Click(Sender: TObject); var str_from_private_key:string; str_to_public_key:string; str_qty_send:string; str_ganche_ip_port :string; begin { web3.eth.tx.sendTransaction( TWeb3.Create('http://127.0.0.1:7545', 0), // Ganache pre-London '24622d680bb9d6d80c4d3fb4b4818e738de64b521948b1b1c85616eeeda54ee1', // from private key '0xaDDcedc01C1070bCE0aF7eb853845e7811EB649C', // to public key web3.eth.utils.toWei('0.01', ether).Value, // 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 ); } str_ganche_ip_port := string( 'http://'

end;

Stefan @.***> 于2023年5月4日周四 18:17写道:

Closed #55 https://github.com/svanas/delphereum/issues/55 as completed.

— Reply to this email directly, view it on GitHub https://github.com/svanas/delphereum/issues/55#event-9165572181, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACZRST73Z5ST4KG5YNDKFOTXEN62JANCNFSM6AAAAAAXVJRF7M . You are receiving this because you authored the thread.Message ID: @.***>

svanas commented 1 year ago

@gneowing I find your bug reports very confusing

  1. Your screen shots aren't included. Please include them
  2. You're telling me the example in the medium article doesn't work, but you seem to be running another example
  3. I get the impression you're not running the latest version of Delphereum. Please check your search path. You are probably linking to another version you think you are.
gneowing commented 1 year ago

Hi, guru, Thank you for your amazing quick response. In fact I attached a .docx file in the former mail in case the screen shots gone. I attached here again plus a .csh file I used to git-pull.

Stefan @.***> 于2023年5月6日周六 19:21写道:

@gneowing https://github.com/gneowing I find your bug reports very confusing

  1. Your screen shots aren't included. Please include them
  2. You're telling me the example in the medium article doesn't work, but you seem to be running another example
  3. I get the impression you're not running the latest version of Delphereum. Please check your search path. You are probably linking to another version you think you are.

— Reply to this email directly, view it on GitHub https://github.com/svanas/delphereum/issues/55#issuecomment-1537120404, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACZRSTZUTPV4I6NPDXPGSYLXEYX5NANCNFSM6AAAAAAXVJRF7M . You are receiving this because you were mentioned.Message ID: @.***>

gneowing commented 1 year ago

Hi, guru, In case there is still mis-information in my mails. I attached my project totally in this email, perhaps it will bother you more. Thank you for your patience in advance ^-^

Xindong Guo @.***> 于2023年5月6日周六 20:58写道:

Hi, guru, Thank you for your amazing quick response. In fact I attached a .docx file in the former mail in case the screen shots gone. I attached here again plus a .csh file I used to git-pull.

Stefan @.***> 于2023年5月6日周六 19:21写道:

@gneowing https://github.com/gneowing I find your bug reports very confusing

  1. Your screen shots aren't included. Please include them
  2. You're telling me the example in the medium article doesn't work, but you seem to be running another example
  3. I get the impression you're not running the latest version of Delphereum. Please check your search path. You are probably linking to another version you think you are.

— Reply to this email directly, view it on GitHub https://github.com/svanas/delphereum/issues/55#issuecomment-1537120404, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACZRSTZUTPV4I6NPDXPGSYLXEYX5NANCNFSM6AAAAAAXVJRF7M . You are receiving this because you were mentioned.Message ID: @.***>

svanas commented 1 year ago

I attached a .docx file in the former mail in case the screen shots gone. I attached here again plus a .csh file I used to git-pull.

There are no attachments. Please use the GitHub web interface and do not reply to these messages with attachments.

svanas commented 1 year ago

Reproduced with Ganache 2.7.1

gneowing commented 1 year ago

Oh, sorry, I replied in chrome's gmail directly. Hi guru 230506.docx So, perhaps the bug caused by Ganache?

gneowing commented 1 year ago

BTW, I am doing the https://svanas.medium.com/transferring-erc-20-tokens-with-delphi-bb44c05b295d Found : 1) As a newer, I am not able to get Goerli ETH from https://goerlifaucet.com/ for no real eth in my MetaMask. 2) So Sepolia is more popular than Goerli, so I did get 0.5 Sepolia ETH from https://sepoliafaucet.com/ 3) But I did not know how to get suitable test Token in https://sepoliafaucet.com/ I tried https://sepolia.etherscan.io/address/0xf61fa39fb137710b4383e0f1268bb1b09c6a7e8d#writeContract Please give me a hand, thank you ^-^

svanas commented 1 year ago

@gneowing the bug was with Ganache 2.7.1. Please pull this fix and then try this updated example. Thanks!

svanas commented 1 year ago

I am not able to get Goerli ETH from https://goerlifaucet.com/ for no real eth in my MetaMask.

You can get Goerli ETH but you need to sign up and log into your Alchemy account first.

I did get 0.5 Sepolia ETH

The TST token has not been deployed to Sepolia. Please use Goerli.

gneowing commented 1 year ago

Hi, guru I did have Alchemy account and MetaMask wallet. And now https://goerlifaucet.com/ will show as the attached screen shot shows, " To prevent bots and abuse, the Goerli faucet requires a minimum mainnet balance of 0.001 ETH on the wallet address being used. Join the Ethereum ecosystem migration! Please use the Sepolia faucet instead."

And I have 0 ETH on my wallet address, so it is too difficult for me to use Goerli.

lalala

gneowing commented 1 year ago

Hi, guru, I git pull all the stuff and modify the code lines, the bug is fixed, admire you.

" TWeb3.Create(Ganache), // Ganache 2.7.1".

svanas commented 1 year ago

To prevent bots and abuse, the Goerli faucet requires a minimum mainnet balance of 0.001 ETH on the wallet address being used.

Yeah, Goerli ETH is in high demand. Here is a bridge where you buy some Goerli ETH, if you must

gneowing commented 1 year ago

Hi,guru I googled and found a URL: https://www.reddit.com/r/ethdev/comments/12ecdqm/bridge_sepolia_to_goerli/ and some good guy gave an amazing URL: https://bigoerlifaucet.com/ So, Goerli ETH now is solved. ^-^

svanas commented 1 year ago

some good guy gave an amazing URL: https://bigoerlifaucet.com/

Thank you for bringing this resource to my attention. I have updated the medium article. Please note I still need to update medium article 8-12. These articles are using the (now deprecated) Ropsten testnet but they should get updated to the Sepolia testnet.

gneowing commented 1 year ago

You are welcome. Got it.

Stefan @.***> 于2023年5月10日周三 18:32写道:

some good guy gave an amazing URL: https://bigoerlifaucet.com/

Thank you for bringing this resource to my attention. I have updated the medium article. Please note I still need to update medium article 8-12. These articles are using the (now deprecated) Ropsten testnet but they should get updated to the Sepolia testnet.

— Reply to this email directly, view it on GitHub https://github.com/svanas/delphereum/issues/55#issuecomment-1541893546, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACZRST5QKYBYMKVN7QRJFTDXFNVCFANCNFSM6AAAAAAXVJRF7M . You are receiving this because you were mentioned.Message ID: @.***>