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
2
votes
3 answers

Trying to get balance with web3j (Android), geting nullpointer exception

Struggling getting anything to work in web3j on android, trying this example (I have replaced token and addr) the address I used does have some rinkeby ETH in it. Testing on phone, application crashes when I load up this class/activity, code is in…
2
votes
3 answers

Installing Web3j CLI tools

this question may seem a bit trivial but I can not seem to find how to get it done. I am trying to install web3j CLI tools and I am not sure how to. I have downloaded the latest release from here as a zip file. I have tried installing using windows…
2
votes
1 answer

Sending A Transaction Async | Cannot Resolve Method 'executeTransactionAsync'

I am attemping to send a transaction to the Ethereum blockchain using the Web3j library, I get an error that I must send it with Async. When I send it with Async I get an error that the function does not exist. I am using Android Studio, Java, and…
James
  • 1,928
  • 3
  • 13
  • 30
2
votes
1 answer

Error in generating Java Wrapper in Web3j

I am trying to generate java Wrapper for a smart contract, but it failed because of this error: Exception in thread "main" java.lang.IllegalArgumentException: not a valid name: Main.sol:main at…
sheemar
  • 467
  • 3
  • 13
2
votes
0 answers

ethereum transaction Observable BigInteger out of int range

I added dependency of web3j from https://github.com/web3j/web3j-spring-boot-starter Then created a service and written : @Service public class Web3jServiceImpl { @Autowired private Web3j web3j; public void getBlockNumber() { …
Chandan
  • 85
  • 1
  • 8
1
vote
0 answers

How to generate java wrapper for solidity contract with openzeppelin imports

Suddenly I discovered web3j provides an option to auto-generate the Java contract from solidity contract. Sample case you can find here. Unfortunately it does not recognize the import of openzeppelin contracts: Error: Source…
Joe Dow
  • 583
  • 1
  • 3
  • 12
1
vote
0 answers

web3j is not generating struct inside my solidity contract

I have a struct Question in my smart contract. After generating the java wrapper class of my smart contract using web3j, Inside the wrapper class Question is not recognized, looks like web3j is not generating struct code in the wrapper class. In…
Shoaib Kakal
  • 1,090
  • 2
  • 16
  • 32
1
vote
1 answer

Convert bytecode to opcode using web3j

I can't find any documentation on this, is there a converter from bytecode to opcode inside web3j? Or do I need to build one myself?
Roie Beck
  • 1,113
  • 3
  • 15
  • 30
1
vote
1 answer

Flowable does not recover from exception with onExceptionResumeNext

I am using web3j to listen to live event coming from the blockchain(based on rx-java2 ver 2.2.21 that comes packed with the web3j) it is working ok but I have an issue, I would like to keep the live subscription even on exception, I implemented it…
Roie Beck
  • 1,113
  • 3
  • 15
  • 30
1
vote
1 answer

Web3j CLI generate file location

I'm using web3j CLI to generate java code. My command is as below (i'm in solidity folder currently): web3j generate solidity -b tempFiles/MasterDAO.bin -a tempFiles/MasterDAO.abi -o ../java -p org.web3j And my file structure is as the graph…
Alan K
  • 187
  • 2
  • 15
1
vote
1 answer

How to get a contract by a transaction uising web3j?

I need to check if a transaction is a ERC721/ERC1155 transaction and fetch information like receiving address, token address, value, etc. If I understand correctly, I have to load a contract for the transaction and check if it inherits ERC165 in…
Sasha Shpota
  • 9,436
  • 14
  • 75
  • 148
1
vote
2 answers

Cannot generate .abi and .bin files when Smartcontract contains the Openzeppelin import

I started using web3j and I want to generate smart contract wrapper. According to documentation, it can be done this way: web3j generate solidity -b /path/to/.bin -a /path/to/.abi -o /path/to/src/main/java -p…
1
vote
1 answer

Get hashMessage in Java/Kotlin same like in solidity

I need a function (Java/Kotlin) that returns hashMessage which corresponds to Solidity function: function getMessageHash(address _signer, uint _amount, uint _id) public pure returns (bytes32) { return keccak256(abi.encodePacked(_signer,…
Daguna
  • 141
  • 8
1
vote
1 answer

WARN org.web3j.protocol.core.filters.Filter.reinstallFilter(153) -The filter has not been found. Filter id:

Related Docs: Filters and Flowables http://docs.web3j.io/4.8.7/getting_started/pub_sub/ Filters and Events http://docs.web3j.io/4.8.7/advanced/filters_and_events/ Events https://docs.soliditylang.org/en/develop/contracts.html#events I am trying to…
Paul Verest
  • 60,022
  • 51
  • 208
  • 332
1
vote
1 answer

java.lang.NullPointerException at org.web3j.protocol.core.filters.LogFilter.process(LogFilter.java:46)

I am trying to read blockchain event (in Java) using web3j but getting NPE: java.lang.NullPointerException: null at org.web3j.protocol.core.filters.LogFilter.process(LogFilter.java:46) at…
Paul Verest
  • 60,022
  • 51
  • 208
  • 332