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

Filter by
Sorted by
Tagged with
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
77 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?
0
votes
1answer
29 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....
0
votes
1answer
86 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/...
0
votes
1answer
182 views

Load smart contracts in Java application without having the java wrapper class for Web3j (only the address of the contract)

I use web3j to interact with my local Ethereum node (created with geth), and I was wondering how should I handle smart contracts created at runtime. I know that in order to deploy a smart contract ...
0
votes
1answer
17 views

Installing Web3 stuck on fetchMetadata: sill resolveWithNewModule http-https@1.0

I am trying to install web3 for ethereum but it keeps sticking on this fetchMetadata
0
votes
1answer
237 views

How to Serialize/Deserialize array of bytes?

I'm writing a smart contract and inevitably need to have arrays of bytes as input and output of functions. In remix arrays work just fine but with web3j and web3js there are several issues with arrays ...
0
votes
1answer
63 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 ...
0
votes
1answer
66 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
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(...
0
votes
1answer
51 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 ...
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
247 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 ...
0
votes
2answers
225 views

Smart Contract with web3j - Stored SHA hash returned is not the same as input

I have a contract that stores sha-256 hashes of documents (stored as bytes32). I also have a method to retrieve a hash that is mapped to a unique id for the document. However, when I retrieve and ...
1
vote
2answers
330 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
1answer
142 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: @...
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
0
votes
1answer
450 views

how to deploy a smart contract in ethereum using web3j

i am following this tutorial tutorial under the section Working with smart contracts with Java smart contract wrappers i followed the same steps but i am getting RunTimeException here is the full ...
0
votes
1answer
275 views

Send function transaction to existing smart contract using web3j

I've been exploring web3j and got the credentials working so I'm able to send transactions from an ethereum address. Now I want to send a transaction to an already existing smart contract and use a ...
0
votes
1answer
34 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 ...
3
votes
2answers
735 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....
0
votes
1answer
236 views

Not getting any results from Web3j querying of ERC20 token's balanceOf() function

I am trying to use Web3j to query the balanceOf() function of a standard ERC20 token as shown in the code below: try { String encodedFunction = FunctionEncoder.encode(function); ...
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?
0
votes
1answer
358 views

Port number for connecting web3 to mainnet using Geth

I am trying to connect web3j object to the mainnet using geth. I can't use infura because i am working with replay transaction observable function which doesn't work with infura. To connect with the ...
0
votes
1answer
41 views

Listen to Ethereum transactions

I need to listen ethereum transactions for current count of addresses using web3j. I know that I can use subscribe to get transactions, but how can I add some filter to listen a certain number of ...
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
1answer
25 views

Unable to load smart contract using web3j on android

What I'my trying to do is to load already deployed smart contract and interact with it. The problem is that after my credentials are being created properly, the error is being catched but the message ...
0
votes
1answer
274 views

java.lang.RuntimeException: Error processing transaction request: insufficient funds for gas * price + value when invoking smart contract function

using web3j for loading a contract which is deployed on the private network following this tutorial https://web3j.readthedocs.io/en/latest/smart_contracts.html#constant-methods smart contract ...
1
vote
1answer
174 views

web3j.ethCall returns null when retrieven contract variable

Environment: Geth node Geth/v1.9.0-unstable/windows-amd64/go1.12 Commands used to start the node to mine: geth --datadir "." --networkid 101 -verbosity 6 --port 30301 --rpcport 8101 --nodiscover -...
0
votes
1answer
310 views

Error while retrieving transaction count

I am trying to retrieve the total transaction count of an address using java, web3j and Infura as the Ethereum client. My code is as below: EthGetTransactionCount txnCount = web3j....
1
vote
1answer
101 views

Anyone with knowledge in org.web3j.abi.Type Decoder?

I am trying to decode a String with this code that I found but I have not been able to do it. String to = inputdata.substring(10, 74); String value = inputdata.substring(74, 138); Method refMethod = ...
0
votes
1answer
229 views

Correct way to easily call function with web3j from deployed contract

I am trying to call a function from a modified ERC20 contract and I can't manage to make it work. I am doing this with web3j from Android. I can connect to Infura. The contract is already deployed on ...
0
votes
0answers
339 views

Quorum & web3j: Transaction has failed with status: 0x0. Gas used: 0. (not-enough gas?)

I'm doing some play & test with Quorum. I'm using example 7nodes with docker. The network is up and my simple smart contract is deployed with a set and a get function. When I call the set function ...
0
votes
1answer
187 views

How can I show on web3j a list of all the instructors added on my blockchain?

I need to show on an html a list of all the instructors that are set up on the list pragma solidity ^0.4.18; contract Owned { address owner; function Owned() public { owner = msg.sender; } ...
2
votes
2answers
331 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. ...
0
votes
2answers
594 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
1k views

Android webj3 “insufficient funds for gas * price + value” exception

I'm trying to send ether in my Android app between 2 addresses which were opened using Metamask.io There is a balance of 2 ethers in "from" account. Here the code Web3j web3 = Web3jFactory....
2
votes
3answers
6k views

How to view custom token balance in ether wallet using web3

Hello I am newbie to cryptocurrency. I have created my erc20 custom token. Now, I want to create an API to view the balance(in my token as well as in ethers) using web3 and node js.Can someone please ...
0
votes
1answer
388 views

Web3j Signature and Solidity Ecrecover

I'm trying to understand how to sign a message in Java and recover the public key in a Solidity smart contract however my public keys don't seem to match. Here's my Java code to generate the ...
0
votes
1answer
420 views

Failed to connect to localhost/0:0:0:0:0:0:0:1:8545

When I am doing one transaction with the help of Java web3j library, it's not connecting to localhost(my private network). And giving this error. package com.kaushik.blockchain; import java.math....
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 ...
0
votes
1answer
340 views

How to list all recipts in a block using web3js?

I'm trying to list all transactions and their receipts from given block. Transactions get be included in the result of GetBlockByNumber function but I have found no option to include receipts. I can ...
0
votes
1answer
80 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
0answers
37 views

Generated code using web3j contains errors

This is the smart contract pragma solidity ^0.5.0; pragma experimental ABIEncoderV2; import "./sharedLib.sol"; import "./clientSC.sol"; import "./projetSC.sol"; contract ...
0
votes
0answers
54 views

How to use web3j to check the balance of an ERC20 custom Token and transfer the token to another wallet?

I'm studying to create wallets using infura, web3j, and android studio. I am using ropsten testnet. I have been able to check the amount of ethereum in my wallet and send ethereum to another account. ...
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
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 ...
0
votes
1answer
298 views

Interacting with the smart contract from Java application (We3j)

I have many questions about the workflow ( sequence ) of interacting with the smart contract from Java application, so I will first explain what I have done and then put my questions, and if something ...
0
votes
1answer
272 views

Web3j send ether transaction pending forever

i'm trying to send ether to a smart contract with a specified amount of gas usage, the transaction sending works fine and it propagates to the network but remains pending forever not being executed as ...
0
votes
1answer
279 views

org.web3j.tx.exceptions.ContractCallException: Empty value (0x) returned from contract

Problem: org.web3j.tx.exceptions.ContractCallException: Empty value (0x) returned from contract The code is as follows.... My java: String owner = managedWalletLookup.getOwner(contractAddress).send(...