Questions tagged [web3j]

Lightweight Java and Android library for integration with Ethereum clients

125 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
7
votes
1answer
865 views

Deploy contract in web3j quorum problem

I'm trying to deploy a smart contract (7 nodes sample from Quorum) using web3j. It fails at get() to get the contract wrapper object. If I check the logs, a new transaction will show up, but if I call ...
3
votes
2answers
1k views

How to use mnemonic to recovery my ethereum wallet

I use web3j to create my ethereum wallet.the Code just like down import org.web3j.crypto.Bip39Wallet; import org.web3j.crypto.Credentials; import org.web3j.crypto.ECKeyPair; import org.web3j.crypto....
3
votes
1answer
829 views

Recover address from signature using web3j

I have signed a data string using the following code snippet in web3js var data = "hello world"; web3.personal.sign(web3.fromUtf8(data), web3.eth.accounts[0], function(error, result) { if (!...
3
votes
2answers
3k views

Web3j - sending erc20 token

I would like to ask how to correctly send ERC20 Token from a wallet to another wallet , followings are my codes : public static void main(String[] args) throws Exception { Web3j web3 = Web3j....
3
votes
1answer
460 views

Ethereum - how to get merkle proof

I'm trying to figure out the check of existence and the immutability of the transaction in the Ethereum block, but I do not know how to get mercle branch. With the help of web3j I can get the block ...
2
votes
1answer
155 views

Can I send data (e.g. text) in a Transaction with Web3J?

I need to send a transaction from an account to another one via Web3J that includes not only the value field but also the data field (in particular, I need to send text). Is it possible?
2
votes
0answers
493 views

JsonParseException while generating java wrapper object with web3j

so a few weeks ago I created a java wrapper object with web3j for a smart contract and was able to work with it with no problems. following exactly what I did a few weeks ago I keep getting a ...
2
votes
2answers
431 views

How do I use filter EVM log events by an indexed field in web3j?

I've looked through the documentation, but there doesn't seem to be this scenario listed. What I want to do is filter the Ethereum event log of a specific contract by an indexed field with Web3j. ...
2
votes
1answer
53 views

Unable to print event without JSONstringify

I am trying to understand the difference among following cases while printing the event: At web3.js listenToEvent: function(){ Contract.deployed().then(function(instance){ instance....
2
votes
1answer
273 views

Why would Ganache behave differently depending on geth, web3j, web3js and web3.py?

I have a smart contract token deployed in a Ganache instance. My dapp written with React and web3.js shows the same 10 accounts for eth.accounts as running the same command in the geth console. If I ...
2
votes
0answers
2k views

How to integrate smart contracts with android app using web3j

I want to integrate smart contracts with the android app. I wrote a simple smart contract and I want to call that smart contract from android app. For example, in UI part of Android, I put one ...
2
votes
0answers
395 views

Noob having trouble connecting to the Infura Mainnet

I've been attempting to run a script from my terminal, and have been getting this error: Error: CONNECTION ERROR: Couldn't connect to node https://mainnet.infura.io. I've installed Web3j on my ...
2
votes
0answers
300 views

web3j make raw call to deployed contract which checks transaction sender

I have deployed contract to rinkeby. Contract method refuses any call except a call from contract owner (aka contract deployer). I can't use Java bindings. I'm trying to use Function API but it ...
2
votes
1answer
351 views

How to do batch transaction in Ethereum using web3j

I want to do batch transaction using the web3j,So how can I do it? Is there any way or feature web3J provides
1
vote
1answer
113 views

How to get contract object using ABI json and address with web3j?

I worked with web3js(JavaScript) and used web3.eth.Contract with 2 params (json, address) and successfully got contract object. Now I started to work with web3j(Java) and don`t understand how I have ...
1
vote
1answer
26 views

transaction receipt was not generated after 600 seconds for transaction

I am running private ethereum blockchain using geth and I am using web3j to send transactions. Since yesterday I am not able to deploy my contract, In my java console I am getting "transaction ...
1
vote
0answers
21 views

Simple way to balance web3j connections between nodes

Context: I have a client that can connect to 3 local-network nodes to distribute query-loads and be more resilient to network/software issues. I have managed to create a -simple- watch-dog with a ...
1
vote
0answers
56 views

Transaction receipt was not generated after 600 seconds for contract transaction

I use SimpleMultiSig to generate java code with web3j. When I call the execute() function after 600s throw the error org.web3j.protocol.exceptions.TransactionException: Transaction receipt was not ...
1
vote
0answers
22 views

Not able to fetch custom token after mint from Infura

I am using web3j library with an Infura Websocket connection. I set up a subscribe method where I listen to transfer events of my custom ERC20 Token. When a transfer event occurs on the blockchain I ...
1
vote
1answer
84 views

org.web3j.abi.datatypes.Utf8String cannot be cast to java.lang.String

I have a problem when get string value from smart contact: pragma solidity >=0.4.22 <0.7.0; pragma experimental ABIEncoderV2; contract Election { // Model a Candidate struct Candidate {...
1
vote
0answers
71 views

Not able to decode the input data from transaction using web3j (Java)

I am creating transactions using web3j and passing some private data in that transaction. The transaction is also getting mined . I have subscribed to the mined blocks, where I am fetching the ...
1
vote
1answer
178 views

How to decode InputValue of ethereum using java web3j

**I'm trying to decode the inputValue of an transaction using web3j without using any contract abi and wrapper class,Im loading the contract using its contract address ,is there any way/inbuilt ...
1
vote
2answers
191 views

Unable to invoke smart contract function from Web3j contract wrapper

I've been learning about interacting with smart contracts through Android and the Web3j framework but have run into an issue. I'm trying to mint an ERC721 token and send it to an address but it doesn'...
1
vote
1answer
41 views

how can i fetch all the tokens from ethereum network to my wallet ?using web3js(nodejs) or web3j(java)?

I'm trying to fetch all the available tokens from ethereum network into my android wallet but could not able to find an suitable solution other than web scrapping
1
vote
1answer
433 views

How estimate GAS from a contract call with Web3j

I'm trying to estimate gas cost of a contract call, i need to send a string to a contract, but i need to see if i overtook the GAS limit. I'm trying like this: Transaction t = Transaction....
1
vote
0answers
58 views

Web3J - how to perform two identical transactions in a row?

I have a contract being an ERC-20 token. I want to perform two idendical transfers (sender, receiver and amounts are the same). I am using the contract objects from Web3j: MyToken token = MyToken....
1
vote
1answer
81 views

How to get events on android with infura?

I am developing an app on Android, but Web3j does not support events on infura ( Should I use Infura with Web3j for Event filter? ) . What are the options, I did not find any alternative library?
1
vote
0answers
63 views

How to achieve inheritance support using web3j wrapper?

I have two types of smart contracts. One parent contract to store the type and other child contracts which inherits the parent contract. The problem is, I can't generate java wrapper class (...
1
vote
1answer
89 views

getWeb3ClientVersion() returns null

I'm trying to create an android Dapp by using the web3j library. I'm using connection to a local private Ethereum blockchain. When I'm trying to display the Client version it returns null. This is the ...
1
vote
1answer
48 views

Using contract to create Child contracts (web3j Java wrapper)

I have a simple Parent contract that creates child contracts and stores their address. contract Parent { address[] public registry; function createChild () public { address newChild =...
1
vote
0answers
105 views

Using web3j with infura returns null

I've used web3.js to handle my contracts, and it worked very well. But web3j is pretty hard for me since the beginning. I'm using android studio, infura, web3j. Since I don't know very much about ...
1
vote
0answers
91 views

Extra mining fees added in etherbase account

1st scenario - I have set miner.setEtherbase(eth.accounts[1]) and gasPrize is 0. 1 coin Transaction - And done transaction from 0th account to one random account. I expect 0 mining fees will add ...
1
vote
0answers
39 views

Trouble with personalUnlockAccount,web3j

I am creating android dapp for votings I am trying to check if user's credentials are right,so i use object of PersonalUnlockAccount class and function accountUnlocked().So the problem is that when i ...
1
vote
1answer
100 views

Could someone explain to me the use of the FastRawTransactionManager class?

int pollingInterval = 3000; FastRawTransactionManager fastRawTxMgr = new FastRawTransactionManager(web3j, credentials, new PollingTransactionReceiptProcessor(web3j, pollingInterval, 40)); From what I ...
1
vote
0answers
330 views

Transaction receipt was not generated after 600 seconds for transaction:

I am sending a transaction through this code: txhash = careercertificate .createCertificate(id, fecha, nombre, rutalumno, instituto, rutinstituto, titulo, totalhash, ...
1
vote
0answers
135 views

Subscribe to changes in contract balance (Web3j)

Using web3j I would like to subscribe to changes in a contract balance i.e deposits and withdraws. I would like to base this subscription over transactions (and not events) since the contract does ...
1
vote
0answers
377 views

How to decode the input data in java?

I receive the input data as the image shows. And when I try to decode it with the method: String inputdata = null; Optional<Transaction> tx = web3.ethGetTransactionByHash(txHash).send()....
1
vote
0answers
104 views

[RuntimeException: java.lang.NoSuchMethodException: SmartContract using web3j

I am following this tutorial for deployment of contract https://www.youtube.com/watch?v=ibAh04Csp0M&index=33&list=PL16WqdAj66SCOdL6XIFbke-XQg2GW_Avg but i am getting [RuntimeException: java....
1
vote
1answer
154 views

web3j event listening on android project

I trying to listen events from smart contract but my code isn't working. what's the problem? Event event = droneChain.UPDATEMISSIONSTATE_EVENT; String encodedEventSignature = EventEncoder.encode(...
1
vote
0answers
285 views

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 ...
1
vote
1answer
288 views

Input byte array must be in range 0 < M <= 32 and length must match type-web3j

I have created an api to addCandidates. But when i run the api i get error: Input byte array must be in range 0 < M <= 32 and length must match type My codesnippet for addCandidates is: @...
1
vote
1answer
84 views

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

I am trying to deploy smart contract using web3j. My code is as follows: @RequestMapping("/") public String index() throws Exception { Web3j web3j = Web3j.build(new HttpService("https://...
1
vote
1answer
116 views

LoadCredentials function returns file not found exception

I am using the following code to deploy my contract: @RequestMapping("/") public String index() throws Exception { Web3j web3j = Web3j.build(new HttpService("https://rinkeby.infura.io/v3/...
1
vote
0answers
85 views

Web3j no transaction pooling with REST

I have setup an application with jhisper gateway with one microservice in REST linked to Web3j. Idea is when you store an object in the database, you notarize it in a private ethereum blockchain. So, ...
1
vote
0answers
81 views

Web3J - Creation of Light Wallet takes too long

I am creating the wallet in my Android app, using the library Web3j: https://web3j.io/ See the code: String seed = UUID.randomUUID().toString(); ECKeyPair exKey = Keys.createEcKeyPair(); WalletFile ...
1
vote
1answer
520 views

How to create wallet with web3j and web3swift like with web3js web3.eth.accounts.create(); function?

With web3js v1.0.0 you can create accounts with web3.eth.accounts.create(); and access the public address and private key with newWallet.address and newWallet.privateKey. How can you do this with ...
1
vote
0answers
126 views

Filtering blocks on basis of transaction logs in web3j

I want to filter blocks on the basis of a log present inside transactions. How can I do that? I don't have any contract address and want to filter all the blocks generated by all the contracts. ...
1
vote
0answers
253 views

Getting ClassCastException while creating wallet

Always getting this exception when I am creating new wallet file java.lang.ClassCastException org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPrivateKey cannot be cast to org.bouncycastle.jcajce....
1
vote
0answers
385 views

How to subscribe to future incoming ERC-20 token events?

I'm using web3j to subscribe to my ERC-20 token transfer events with transferEventObservable: humanStandardToken.transferEventObservable(DefaultBlockParameterName.EARLIEST, DefaultBlockParameterName....
1
vote
0answers
141 views

Can deploy Smart contract from Main thread but not from a class

I have a contract: pragma solidity ^0.4.0; contract qualification { address owner; /* This function is executed at initialization and sets the owner of the contract */ function qualification() { ...