Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [web3j]

Lightweight Java and Android library for integration with Ethereum clients

117 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
7
votes
1answer
783 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
1answer
248 views

how to use web3j over infura to find exact gas price used for a successful transaction

my goal is to compute the cost of gas for a successful tx. I get a callback when a transaction succeeds and i retrieve gasUsed with transactionReceipt.getGasUsed(). Now I need to know the exact gas ...
3
votes
2answers
736 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
527 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
2k 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
367 views

Passing Web3 & Contracts Between Components - React Redux & MetaMask

Curious what's the best way to access and pass a web3 contract instance provided by MetaMask between components when using react-redux. At this point, I'm tempted to do the following for both web3 ...
3
votes
1answer
412 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
0answers
355 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
332 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
40 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
246 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
1k 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
376 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
285 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
288 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
0answers
30 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
33 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
46 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
28 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
50 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
53 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
1answer
78 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?
1
vote
0answers
30 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
2answers
333 views

Empty value (0x) returned from contract web3j

I'm trying to deploy a very simple contract on Windows 10, using Web3j 4.2.0. I've created an account using Mist. I've set up one local ethereum node (using geth) on my machine and I'm able to deploy ...
1
vote
0answers
91 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
183 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
81 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
123 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
245 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
143 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
0answers
77 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
65 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
41 views

Contract NOT created when using “new” on testnet

I've got a contract which one of his functions creates a new contract in the following manner: (Solidity) function createCarrier() public { P2Carrier newCarrier = new P2Carrier(msg.sender); ...
1
vote
1answer
385 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
108 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
1answer
1k views

how to get the status of a transaction which is not mined and pending

I used the following code to send a transaction and get transaction status.However, sometimes the transaction is not minded at all. But the transactionReceipt get the same value "NULL" for both of the ...
1
vote
0answers
221 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
368 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
130 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() { ...
1
vote
0answers
281 views

Get and Set values of Contract remotely via Web3j returns 0 and null

I have my two Quorum nodes setup on two different machines A(X.X.X.1) and B(X.X.X.3) and I am trying to interact with the smart contract from a different machine C(X.X.X.4) via Web3j. Below is the ...
1
vote
0answers
259 views

String returned from mapping of struct array

I want to store some details from every transaction. These are the struct and the variable: struct MoneyTransfer{ address sender; string comment; uint creationTime; uint quantity; } ...
1
vote
1answer
801 views

iOS: Create Raw Transaction in swift

I'm working on a project related to blockchain and need to figure out, how raw transaction can be possible, I got no reference for this as of now. Can anyone help me? I have tried this lib: https://...
1
vote
0answers
82 views

Is there a thread leak in Ethereum Web3J

As part of our plans to integrate blockchain technology, I am looking at Ethereum and playing around with the java API (web3j). One obviously starts with the examples but I found that the VM does not ...
1
vote
0answers
202 views

WalletUtils.loadCredentials takes a while to answer,about 2 minutes

WalletUtils.loadCredentials takes a while to answer, about 2 minutes, running on the android devices, Credentials credentials = WalletUtils.loadCredentials("password","path to file"); just this method,...
1
vote
0answers
110 views

Huge amount of gas being used for small computation

I have just added one other part to my contracts addUser method (setting the isPermitted field) and it has blown up the amount of gas it uses to the point I keep getting out of gas exceptions. The ...
1
vote
1answer
232 views

Web3j client not exit after unsubscribe

I use web3j to fetch information from ethereum blockchain, public static void main(String[] args) throws InterruptedException { Web3j web = Web3j.build(new HttpService("http://10.9.59.138:18001")...
1
vote
0answers
97 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
1answer
596 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
3answers
885 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?