Questions tagged [web3j]

Lightweight Java and Android library for integration with Ethereum clients

Filter by
Sorted by
Tagged with
1
vote
0answers
99 views

Setting balance to an account

After i created a wallet for a user i want to modify his balance, how could i do that without setting the account address' balance in the genesis, I'm using quorum blockchain with web3j. Thank you!
1
vote
1answer
2k views

How to transacting with a smart contract using web3j in Android?

i used web3j to Transacting with a smart contract. this is my Contract function which i want to intertact with. function usersRegister(string _id, string _password){ Equipment e = equipments[msg....
1
vote
2answers
213 views

Pass specific address in Web3J send method

How to pass specific address in send method in Web3J? For example, using web3 javascript library, we can pass from address like below. contract.someMethod().send({ from: this.props.accounts[0] }) ...
1
vote
1answer
606 views

problem when deploy smart contract in Quorum using web3j

I'm using web3J when i try to deploy contract i get Error processing transaction request: Non-200 status code: &{Status:400 Bad Request StatusCode:400 Proto:HTTP/1.1 ProtoMajor:1 ProtoMinor:1 ...
1
vote
4answers
969 views

How to access ethereum smart contract(already deployed) in a Java application via its address using web3j?

I have an existing Smart contract address,abi,binary code. I need to access it from a Java application.Is it possible to do this without creating a java wrapper class?
0
votes
1answer
201 views

How to apply EthFilter to specific address?

In web3.js, we can apply event filter something like below: this.event = this.Contract.events.MyEvent({ filter: { address: "0xAccountAddress" }, }) In Web3J, it is translated to EthFilter ...
0
votes
2answers
674 views

how to get latest block number using web3j java APIs

I ask the network for current balance of the address i want to keep track. after that i want to detect/listen incoming deposits starting at the latest block number at the start of my program/server. ...
0
votes
2answers
73 views

How to prevent unwanted parties pushing data to a private chain?

For example, if a private chain genesis is distributed to a group of approved peers, however a peer makes this genesis block publicly available. How can one prevent unwanted users from joining the ...
0
votes
4answers
955 views

web3j-android error: static interface method calls are not supported at language level 1.7

I get this error static interface method calls are not supported at language level 1.7 when having Web3j web3j = Web3j.build(new HttpService(url)); documentation here says for Android you should ...
0
votes
1answer
207 views

How to use eth_newFilter to get pending incoming transactions to a contract?

I'm trying to get pending transactions to a certain contract using Infura. Is it possible to do that using eth_newFilter? Since apparently these filters only "trigger" from contract events, does that ...
0
votes
1answer
245 views

Where is the ethLogObservable method in Web3j?

I can´t find where is the Web3j ethLogObservable method. I can´t find in GitHub repo
0
votes
1answer
166 views

Recover solidity funcion event in web3j

EthFilter filter = new EthFilter(DefaultBlockParameterName.EARLIEST, DefaultBlockParameterName.LATEST, userContract.getContractAddress().substring(2)); I am trying to recover the event response that ...
0
votes
1answer
661 views

Contract.methods.transfer is a not a function error using web3

Running something simple as this: Contract = new web3.eth.Contract(this.contractABI, this.contractAddress) Contract.methods.transfer(toAccount.address, transfferAmount).encodeABI() Gives me ...
0
votes
2answers
703 views

Create account with web3j

Im trying to create a account using the web3j library. But i can´t find the method that create accounts. My idea is to make this judgment but not in the Geth console, but yes in the Java application ...
0
votes
1answer
282 views

Compatibility between Solidity language and Web3j library

What is the compatibility between solidity and web3j. I don't find any resource about it. Suppose if I generate my java wrapper class of smart contract written in Solidity ^0.4.17 version and taking ...
0
votes
2answers
254 views

Does an ethereum address exist on all networks when created?

When you create a wallet file, can you use the same address on both main net and test net? I understand the same address will have different funds on each network, but does the address exist on both?...
0
votes
1answer
438 views

Getting exception while getting the ethBalance

web3 = Web3j.build(new HttpService()); EthGetBalance ethGetBalance = web3.ethGetBalance("0xb34a5b6a39bceafeb8e23c2cc526889d85bf664e", DefaultBlockParameterName.LATEST).send(); ...
0
votes
1answer
719 views

Interacting with an ethereum smart contract via Java

I am interested in interacting with a smart contract via a Java application. I found that there is a library called web3j (https://docs.web3j.io/) for which this should be possible, however there is ...
0
votes
2answers
615 views

web3j WalletUtils.loadCredentials() works in Java, throws java.lang.OutOfMemoryError on Android

I'm trying to use web3j + Infura to interact with the Rinkeby chain from an android app. I first wrote a simple test in Java and everything worked - transactions, interacting with contracts, you name ...
0
votes
3answers
609 views

How can I let TestRpc reveil the public key of a generated account

I suffer a steep learning curve at the beginning. My current goal is to set up a testing environment with TestRpc, Truffle and Web3j (wow). Web3j worked as expected and generated a Java wrapper for ...
0
votes
1answer
50 views

Not able to generate java wrapper class from solidity smart contract using truffle

I'm trying to generate java wrapper class of solidity smart contract using truffle but not getting wrapperclass.java file Here is an command which i've used to generate abi/Json of that contract ...
0
votes
1answer
87 views

How to create a wallet file for existing account&

I found this way of creating a new ethereum account with web3j. But what if I want to create a wallet file for an already registered account? I need this because most of the web3j functions require a ...
0
votes
2answers
31 views

How to find out if a wallet (an address) contains a token from a contract using web3js?

Is this possible with and without knowing the private key of the wallet.
0
votes
1answer
68 views

Transaction no confirmed and JUnit test assert fail

I have some JUnit test that assert some values returned from the blockchain deployed smart-contract. But the assert return me a error because the assertEqual call is done when the transaction has not ...
0
votes
1answer
164 views

Error generating new account with Web3j

Im using the Web3j library to make transactions with my blockchain (Ganache). I have a method that instantiate a Web3j object and im trying to generate a new account with the given String url = "...
0
votes
1answer
318 views

ethLogFlowable: how to get event args?

I am using ethLogFlowable to subscribe to an event and read the args of the event, in my case an address and a uint256 value. I have followed this answer stackExchangeLink, but I am always getting ...
0
votes
2answers
134 views

transactionHash returned null sometimes when trying to transfer funds using web3j (random behaviour)

I am transferring funds using web3j. However, I was getting transactionHash as null. I checked various posts and found that this issue exist when gas price or gas is bad. I increased both the values, ...
0
votes
1answer
381 views

java.lang.ClassCastException: org.bouncycastle to error while creating wallet using web3j

I am using web3j to create account. String walletFileName = WalletUtils.generateFullNewWalletFile(" <password>",new File("some/path")); But getting this error: java.lang.ClassCastException: ...
0
votes
1answer
677 views

retry mechanism for transactions in web3j

In my Java-web-application I have (with one click) to send about 120 transactions after each other from the same address to the same smartcontract. My question: is there any java libraries or ...
0
votes
1answer
232 views

Converting int to default block parameter

I am using Infura and web3j to query the Ethereum blockchain. My aim is to get information about certain blocks so i'm using the function web3.eth.getBlockByNumber, however it gives me incompatible ...
0
votes
1answer
398 views

Getting contract binary using web3j

I'm using web3J library in my java app. I got an address of a deployed contract and would like to get it's binary or abi from the blockchain using my java app, how can I do that?
0
votes
1answer
525 views

Cannot send ERC20 tokens because user has no ethereum

I have 1 wallet server but have many account address for each user, so when user want to transfer erc-20 token say OMG to another address(user) in the same wallet server, the system said can not ...
0
votes
1answer
713 views

Subscribing to event using web3j

I'm trying to subscribe to a smart contract event from my java app using web3j. I deployed my contract to truffle, here it is: pragma solidity ^0.4.24; contract MyContract { string message; ...
0
votes
1answer
51 views

ethereum javascript webpack smart contract

I'm trying to send the value from html dropdown to the smart contract, the value is extracted from the js function but I'm not able to add it to SetVote function, the execution breaks there. Html: &...
0
votes
1answer
243 views

incorrect transaction count

I am trying to find the transaction count of an address using ethGetTransactionCount method but it's returning 0 value. What the issue over here. I'm using infura mainnet and web3j in maven /Find the ...
0
votes
1answer
60 views

How to return the change to the sender?

In this answer, @pabloruiz55 provides the following code for sending ether. SmartContract.sol function transferToOwner() payable returns (bool) { //Sender should forward at least 1 ether. ...
0
votes
1answer
399 views

How to compute ethereum contract address with java?

I'm looking for the java version of the solution of this question. How is the address of an Ethereum contract computed? Actually I want have a solution of the problem below. I have a master ...
0
votes
1answer
224 views

How to do asynchronous callback in web3j?

My application is dealing with high speed RPC requests, so it cannot reply on synchronous blocking call to process requests. It wants web3j RPC calls to return tx hash immediately without blocking and ...
0
votes
1answer
315 views

Serious problem! web3j-android EckeyPair returning Private Key length of 63 characters, not 64

So this is a pretty huge problem I've run into once before: I'm using web3j-android and I'm going through the process of generating random private keys and public keys using the ECKeyPair class Now ...
0
votes
1answer
75 views

Invoke smart contract by address, from another contract

I'm trying out a publisher-subscriber smart contracts in ganache. Both the publisher and subscriber work independently, but when I try to invoke the subscriber from publisher through the contract ...
0
votes
1answer
544 views

Is there a “gas price oracle” method in Web3j?

I read about the Gas Price Oracle in Geth, but I need to use it outside the Geth client. Is there something similar in Web3j? If not can I call the oracle programatically somehow (in Java)?
0
votes
1answer
607 views

Webj3 erc20 specify nonce for token transfer

How do you specify a nonce when sending erc20 tokens using web3j?
0
votes
1answer
292 views

Web3j - what is <ensName> when using existing contract

I was just beginning my blockchain development by following https://docs.web3j.io/getting_started.html , I saw some 0x<address>|<ensName>, what is the address and ensName consecutively in ...
0
votes
3answers
4k views

Web3j generate new address in a wallet

I'm using Java (web3j). I have some users and I want to give address to each user. How to generate new address in an ethereum wallet? For example I can generate lots of address from bitcoin wallet. Is ...
0
votes
1answer
756 views

how do you check the number off transaction confirmations of an ethereum transaction using web3j?

I looked through the documentation but there doesnt seem to be mention of this. I tried to debug it and look at the status of the transaction receipt but it is always null. Is there any way to do ...
0
votes
1answer
161 views

Gas limit exceeded despite function not being complex

I am writing a function which takes in a bytes32 message and validates it against a signature (this is done without hashing to save gas). I am able to call the recover function and have it execute but ...
0
votes
2answers
462 views

Web3j doesn't observe new blocks/transactions

I'm using Web3j 3.2.0 and Infura to get information about new blocks and transactions in Ethereum. val web3j = Web3j.build(HttpService("https://mainnet.infura.io/<mytoken>")) log.info("...
0
votes
2answers
2k views

Web3j test accounts and Credentials object

I launch the ethereum blockchain by running testrpc. That is creating 10 test accounts with sufficient funds. When I use web3 with node.js to to deploy a new smart contract, I can use: MyContract.new(...
0
votes
1answer
1k views

How to get balanceOf of a deployed ERC20 contract using web3j?

I'm new to Ethereum and I got stuck on trying to call balanceOf on a deployed ERC20 contract. Here is the code I have so far: Web3j web3j = Web3j.build(new HttpService()); RemoteCall<...
0
votes
1answer
71 views

May last block on watch only client become stale?

Let we have an ethereum node which is for a watch purposes only (it doesn't create any transactions, just updates it's replica of the whole chain). To get notifications about top blocks in the chain ...