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
26
votes
4 answers

Unable to call contract function from web3 with big number as parameter

I am trying to call a custom function of a contract that expects a parameter of unit256. I'm calling this function from web3 with this value as parameter: 10000000000000000000 (10 with 18 zeros) As soon as this call is hit by web3, I faced following…
Fariha Abbasi
  • 1,212
  • 2
  • 13
  • 19
8
votes
2 answers

Rinkeby Authenticated Faucet is not working?

I need test ethereum for my pet project. I go to https://faucet.rinkeby.io/ , put a link with my tweet with my Ethereum address in MetaMask, choose 3 Ethers / 8 hours. The request was accepted, but 17 hours past and I haven't my test ethers. Did I…
Roman Matviichuk
  • 141
  • 1
  • 1
  • 7
8
votes
4 answers

Web3j how to get transaction status

I am using web3j to query the Ethereum blockchain. Now I want to check if a transaction was mined or just sent to the network. How can I achieve this?
D. Muff
  • 183
  • 1
  • 1
  • 9
7
votes
1 answer

Generate Ethereum addresses in HD Wallet using public key only (bitcoinj/web3j)

I trying to generate Ethereum addresses for the HD Wallet keys implemented with bitcoinj library, but I got confused: DeterministicSeed seed = new DeterministicSeed("some seed code here", null, "", 1409478661L); DeterministicKeyChain chain =…
Andrew
  • 179
  • 2
  • 9
6
votes
1 answer

Web3j: Getting last events from a smart contract

I am using org.web3j (4.8.4) and Java 11. I have a smart contract deployed on Kovan network. I want to subscribe to all new events emitted after I call subscribe(...). I am not interested in events that were emitted before. This is my current…
Sam Carlson
  • 1,891
  • 1
  • 17
  • 44
6
votes
1 answer

Web3j: How to get Ethereum transaction information (Java not JS)

I've just started using Web3j and am having some basic trouble. I've successfully figured out how to get an EthBlock and retrieve all of the information inside of it. I'd like to see the list of transactions in the block, but I can't figure out…
Sander Smith
  • 1,371
  • 4
  • 20
  • 30
5
votes
1 answer

Web3j Transfer.sendFunds() returns Error "insufficient funds for gas * price + value"

When using the web3j lib for blockchain transaction in my private test blockchain I'm currently running into the titled response error: *insufficient funds for gas * price + value* The account from which I want to transfer some ether has a balance…
ArgV
  • 175
  • 3
  • 13
4
votes
1 answer

How to check if transaction is NFT using Web3j?

I'm using Web3j library to work with the blockchain. I want to resolve what tokens are transferred during specific transactions. What I have already tried: Call Function with the name supportsInterface to check whether it supports NFT standards…
wollenS
  • 67
  • 5
4
votes
1 answer

Problem with WEB3J Maven Plugin, it cant find the solidity compiler

I use the web3j maven plugin to auto generate the Smart Contract Java Proxies. But I have the problem, that the solidity compiler version couldn't be found. [INFO] [INFO] --- web3j-maven-plugin:4.8.2:generate-sources (default) @ web3j-client-lib…
4
votes
1 answer

How to sign a erc20 token transaction using web3j java

I want to transfer erc20 tokens from one account to another. I know that I can use transfer or transferFrom function of smart contract wrapper class. But in my case, erc20 token transaction is needed to be signed at client side. And there is no way…
Jayendra Singh
  • 147
  • 2
  • 10
4
votes
3 answers

How to encode tuple as input parameter to function using web3j

I am attempting to call a solidity function that looks something like the following: function fillOrder( Order memory order, uint256 takerAssetFillAmount, bytes memory signature ) Using web3j I would create the function similar to…
dneo
  • 63
  • 1
  • 5
4
votes
1 answer

Use ganache accounts in web3j

When trying to use https://github.com/web3j/sample-project-gradle I encounter this code: // We then need to load our Ethereum wallet file // FIXME: Generate a new wallet file using the web3j command line tools…
MrKadek750
  • 55
  • 6
4
votes
1 answer

Web3j java function call returns empty list on solidity contract

I'm trying to call the function getPrice from this solidity contract pragma solidity ^0.4.0; contract DataExchangeOfferContract { uint price; constructor(uint _price) public { price = _price; } function getPrice()…
transgressoft
  • 155
  • 2
  • 13
4
votes
1 answer

Checking balance in ERC20 contract using web3j

I want to check user's balance of a couple of ERC20 compliant tokens using web3j. Is there a generic way of doing that (generic for every ERC20 contract) or should I get ABI for each of the contracts and generate java classes from it?
user5783821
  • 319
  • 4
  • 9
3
votes
2 answers

Web3J | Source "@openzeppelin/contracts/token/ERC721/ERC721.sol" not found: File not found

I'm trying create a simple NFT using Java Spring Boot with Web3J dependency. When I'm trying to generate the .abi file and .bin file using Solc compiler, I'm receiving this error: Source "@openzeppelin/contracts/token/ERC721/ERC721.sol" not found:…
Seby Galan
  • 31
  • 2
1
2 3
10 11