Questions tagged [web3-java]

For the web3j java library and related Java issues

Ethereum client library for Java (web3j). Web3j provides code generation tools for Java and Android applications to deploy and interact with smart contracts on the blockchain.

Documentation: https://docs.web3j.io/latest/

Note - This is NOT for web3js, which is the JavaScript version of the Ethereum client library.

160 questions
0
votes
1 answer

Android Web3j create wallet turns out of memory and other problems with communications TLS (other similar questions did not helped me)

I have this project stopped because there is no way to solve the creating wallet step: https://github.com/EAG-es/crear_wallet_web3j Main code: public class Create_wallet_web3j extends AppCompatActivity { public static final int…
0
votes
0 answers

zksync-era calls smart contracts to show a balance of 0

I did the zksync-era contract access by accessing other evm-based public chains with the following code example: org.web3j.protocol.core.methods.request.Transaction transaction =…
Wren Jiao
  • 1
  • 1
0
votes
1 answer

How get Two-dimensional array in web3j?

1D and 2D arrays generate the same code parameters, Obviously, the resulting code is incorrect. function setOrders(Order[] calldata) external {} function setOrderss(Order[][] calldata) external {} Solidity code: // SPDX-License-Identifier:…
EthanOK
  • 1
  • 1
0
votes
1 answer

How to pass bytes type parameters to a function in java web3

I am trying to deploy a proxy contract and it has the following constructor constructor(address beacon, bytes memory data,string memory assetId) These are the inputs I am trying to pass to this constructor beacon -…
0
votes
1 answer

java.lang.NoClassDefFoundError when deploying to Glassfish application server

I have created a simple demo rest service which queries Ethereum to get basic information. I am using the Web3j library version 5.0.0 https://mvnrepository.com/artifact/org.web3j/core/5.0.0 I have added the library to the project using Maven. Built…
CathalMF
  • 9,705
  • 6
  • 70
  • 106
0
votes
1 answer

How to call tokenURI() function in ERC721 using Web3j library?

I need to view NFT-image with all metadata. I decide to call tokenURI() function like it, but it's ain't working private fun getNFTMetadata() = viewModelScope.launch(Dispatchers.IO){ //tokenURI -- by token ID val web3j: Web3j =…
Vando
  • 11
  • 2
0
votes
0 answers

web3j-maven-plugin fail to deserialize @openzeppelin dependencies

Trying to generate the java objects for the HelloWorld solidity contract below, it was not able to generate all of it: // SPDX-License-Identifier: MIT pragma solidity >= 0.8.17; import "../@openzeppelin/contracts/token/ERC721/ERC721.sol"; import…
b.lopes
  • 435
  • 1
  • 7
  • 17
0
votes
0 answers

java.lang.RuntimeException: Error processing transaction request: insufficient funds for gas * price + value

My contract is already deployed on BSC testnet. val web3j = Web3j.build(HttpService("https://data-seed-prebsc-1-s1.binance.org:8545/")) val keyPair = ECKeyPair.create(BigInteger("1234")) val credential = Credentials.create(keyPair) val…
Pavya
  • 6,015
  • 4
  • 29
  • 42
0
votes
0 answers

Why do I get these compile errors when building Web3j-cli on Windows with Eclipse?

I pulled down the Web3j CLI from Github here: https://github.com/web3j/web3j-cli I then went to Eclipse and selected "File/Import/Gradle/Existing Gradle Project" and imported the project. I get the build errors seen below. Can anyone tell me where…
0
votes
0 answers

What is recommended way to handle ethereum contract events in spring boot?

What is the appropriate way to handle live events (i.e. service/component should keep on listening to events and save it to offchain db (h2/postgres)) How to close event subscription gracefully? Implementation tried so far: @Component public class…
Vineeta
  • 85
  • 1
  • 11
0
votes
2 answers

Web3j - How to get timestamp for contract creation time?

I've successfully deployed a contract using Optional receipt = Contract.deploy(...).send().getTransactionReceipt(); The receipt how ever doesn't return a timestamp. It returns the transaction hash and the blocknumber. How would I…
DIRTY DAVE
  • 2,523
  • 2
  • 20
  • 83
0
votes
0 answers

Change ganache Owner Account in WEB3J from account[0] to account[1]or account[2]

I'm looking for a way to change owner of the smart contracts in java web3j as we do in web3 javascript using from: getMetaskAccountID: function () { web3 = new Web3(App.web3Provider); // Retrieving accounts …
0
votes
0 answers

The term 'web3j' is not recognized as the name of a cmdlet, function, script file, or operable program

Im using web3 in a android project that im developing, but for some reason my computer doesn't recognize the command, the node package is already installed and i also added 'npm' directory to my path, both global and local. I can see the web3…
Ale26
  • 9
  • 3
0
votes
1 answer

How to mint ethereum token from Java\Kotlin?

I have blockchain extension for my project and want to extend android client to work with ethereum directly by using web3j. My current issue is get contract instance to execute mint function. Contract has been deployed by using Remix IDE and…
Joe Dow
  • 583
  • 1
  • 3
  • 12
0
votes
1 answer

java.util.concurrent.ExecutionException: org.web3j.tx.exceptions.ContractCallException: Unable to convert response

I'm having some trouble with web3j and calling getter functions for structs in java. As per the title, whenever I call the function in web3j, e.g.: Metadata _metadata = complianceContract.getDocMetadata(hash).send(); I would get the error (for this…
Zi Hang
  • 26
  • 5