0

I have imported all web3J library and using tried using java_version 16,17 and 20. Every time I am facing issue. When I compiled that script in VSCode. I am facing the same issue. Can someone please help me with groovy script?

import org.web3j.protocol.Web3j
import org.web3j.protocol.core.DefaultBlockParameterName
import org.web3j.protocol.http.HttpService
import org.web3j.tx.RawTransactionManager
import org.web3j.tx.Transfer
import org.web3j.utils.Convert
import org.web3j.protocol.core.methods.response.TransactionReceipt
import org.web3j.crypto.Credentials

       def web3 = Web3j.build(new HttpService("API_URL"))
       String PRIVATE_KEY = 'b33ccb143751577968f32575ee690eb3873e49f27935708dbdea52fe36b6ba76'
       RawTransactionManager rawTransactionManager = new RawTransactionManager(web3, Credentials.create(PRIVATE_KEY))
       Transfer transfer = new Transfer(web3, rawTransactionManager)
       println "transfer: ${transfer}"


       TransactionReceipt receipt = transfer.sendFunds("0x7de3280c66ecee8f4cbd8fb78850229d8f10d22f", (Convert.toWei("1", Convert.Unit.ETHER).toBigInteger()), Convert.Unit.WEI, 30000, 1000000108).send()

       println("Transaction Hash: ${receipt.transactionHash}")
       println("Block Hash: ${receipt.blockHash}")
       println("Block Number: ${receipt.blockNumber}")
       println("Gas Used: ${receipt.gasUsed}")
       println("Contract Address: ${receipt.contractAddress}")
      

Error message Error while compiling in VSCode

1 Answer 1

0

I don't think it's connected with web3j, I'm getting the same error using simple code like:

log.info('Hello from java: ' + System.getProperty('java.version'))

JMeter 5.5 comes with Groovy 3.0.11 and Groovy 3.0.11 doesn't support Java 20.

Java 17 should work just fine

enter image description here

For the error you're getting in VSCode it's SSL/TLS protocol versions mismatch between the server and the client, use a tool like OpenSSL to see what protocol(s) does server support and amend your client configuration accordingly.

1
  • I am using Java 17.0.7 and it is working fine and also web3JS is also connected. However, I am getting issue at TransactionReceipt receipt = transfer.sendFunds("0x7de3280c66ecee8f4cbd8fb78850229d8f10d22f", (Convert.toWei("1", Convert.Unit.ETHER).toBigInteger()), Convert.Unit.WEI, 30000, 1000000108).send()
    – Nitish
    Jun 27, 2023 at 18:53

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.