Questions tagged [web3j]

Lightweight Java and Android library for integration with Ethereum clients

161 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
7 votes
1 answer
929 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 ...
user avatar
  • 71
4 votes
0 answers
480 views

How to verify signature on server backend with web3j?

I am sending an EIP_712 signature from metamask to the java backend (web3j) and I need to verify it on backend java application. In this topics it is discussed the support of EIP-712 in java (web3j): ...
user avatar
2 votes
0 answers
459 views

org.web3j.protocol.exceptions.ClientConnectionException: Invalid response received on web3j on Android

I am trying to execute transactions by calling my RegisterNewUser function in the deployed smart contract through Android and I am using Infura. However, when I run, there is an error as seen below : ...
user avatar
  • 21
2 votes
1 answer
292 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?
user avatar
  • 21
2 votes
0 answers
259 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 ...
user avatar
  • 523
2 votes
4 answers
250 views

Transfer ETH using third party

I want to transfer ETH from an individual address to another address. So is there any API provider who can send ETH from single Address to another address. Also If I setup Web3 in windows machine ...
user avatar
2 votes
0 answers
639 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 ...
user avatar
  • 121
2 votes
2 answers
790 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. ...
user avatar
  • 121
2 votes
1 answer
65 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....
user avatar
2 votes
1 answer
365 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 ...
user avatar
  • 121
2 votes
0 answers
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 ...
user avatar
  • 171
2 votes
1 answer
1k 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 ...
user avatar
  • 141
2 votes
0 answers
424 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 ...
user avatar
  • 53
2 votes
0 answers
345 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 ...
user avatar
2 votes
1 answer
602 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
user avatar
  • 143
1 vote
0 answers
24 views

insufficient funds for gas * price + value in ropsten network with web3j (java)

I have a wallet in metamask in ropsten test network, and I try to send a transaction to another wallet in metamask ropsten network, using Web3j library with java. First, I build a httpServer with ...
user avatar
1 vote
1 answer
94 views

error:Expected private key to be an Uint8Array with length 32

var Tx= require('ethereumjs-tx').Transaction const Web3=require('web3') const web3= new Web3('HTTP://127.0.0.1:7545') const account1='0x06e61BDdC2a45A7523C62c0DcC4E15D842BBa9BA' const account2='...
user avatar
1 vote
1 answer
325 views

Transferring ERC721 tokens with web3j using an operator

I've been struggling using web3j (the web 3 Java library, not JS) transferring ERC721 tokens from one user to another, using an operator. I get that we need to approve the operator from the user that ...
user avatar
  • 11
1 vote
1 answer
120 views

How to sign text message using public key in web3j?

I can sign a text message using public key in web3js const signature = await this.web3.eth.personal.sign( loginMessage, publicAddress, "" ) What ...
user avatar
1 vote
0 answers
36 views

Web3j How to Load Bip32ECKeyPair from xprivate_key and xpublic_key

I've used PyWallet from (https://github.com/ranaroussi/pywallet) to create an HD Wallet for Ethereum { "coin": "ETH", "seed": "virtual option economy rose hello ...
user avatar
1 vote
1 answer
140 views

How To Specify ChainID

I am interacting with the Harmony testnet using web3j, but since Harmony has 4 shards i also have to specify the chainID, otherwise it throw an error. When writing to the blockchain i was able of ...
user avatar
  • 11
1 vote
0 answers
200 views

Can I get the IPFS hash from file (without uploading it & with java)?

As far as I'm concerned IPFS client uses the resulting SHA-256 hash from files, and also compatible with others, to index them in the IPFS Protocol. My problem is that I'm not sure how to consistently ...
user avatar
  • 705
1 vote
0 answers
105 views

Is it possible to get revert reasons using CallContract method? If not how can I get revert reason using ethClient in go Ethereum?

I'm using the below functions to get the revert reason : func ErrorReason(ctx context.Context, from common.Address, tx *types.Transaction, blockNum *big.Int, ethClient ethclient.Client) (string, error)...
user avatar
  • 113
1 vote
0 answers
42 views

Trouble implementing ERC20 payment service in android application

I have been following this tutorial (https://medium.datadriveninvestor.com/a-primer-to-ethereum-token-development-using-java-and-web3j-52b24cc6c403) but seem to keep running into errors when it comes ...
user avatar
1 vote
0 answers
80 views

Is there a Java equivalent of estimateGas?

I read from many questions (example: How to estimate the cost to call a Smart Contract method?) that web3.eth has a method estimateGas that can provide an estimate of the gas usage of a transaction/...
user avatar
1 vote
0 answers
108 views

Web3j - How to read the contract without credentials?

I'm using Web3j to interact with my deployed smart contract. I've deployed my contract onto the testnet and can interact with it, however using the generated wrapper code, it requires my wallet. Web3j ...
user avatar
1 vote
0 answers
185 views

Can I verify if given address is a correct ETH address using web3j/Java?

Is there a possibility to verify if given String is a correct Ethereum address? I have found out that there is a possibility to do that using web3js I can do either: web3.utils.isAddress('...
user avatar
  • 131
1 vote
0 answers
68 views

Error processing transaction request: Number can only safely store up to 53 bits

I have the following code (in clojure): 212 (def CGP 213 (reify ContractGasProvider 214 (getGasPrice [_ contract-func] (BigInteger. "1")) 215 (getGasLimit [_ contract-func] (...
user avatar
1 vote
0 answers
175 views

Error in Ropsten: The network id specified in the truffle config (3) does not match the one returned by the network (1)

There are similar questions but I could not find the solution. maybe because smart contract tools are developing so fast. here is the setting for ropsten in truffle config. ropsten: { ...
user avatar
  • 546
1 vote
1 answer
890 views

Encoding ABI function signature in Java using web3j?

Is there a generic way to simply take an ABI function, something like: { "name":"foo", "inputs":{ "interalType":"uint256", "...
user avatar
1 vote
1 answer
513 views

How to access already deployed Smart Contract using Java?

I would like to get information about token. For example total supply and so on. For this I need the contract. However what is the way to actually load it/access it from Java? Checking examples in ...
user avatar
  • 111
1 vote
0 answers
327 views

Web3ProviderEngine does not support synchronous requests on deploy to private network

I know there are many similar questions, but I've been through all of them and haven't got the answer I'm looking for. I'm trying to deploy a smart contract (that's already been compiled and deployed ...
user avatar
  • 89
1 vote
0 answers
167 views

How do I get the transfer/transaction history of an erc20 token using web3j givin an address

I am not sure how to view the the txhistory of an erc20 token for a specific address. I use a java token wrapper for my erc20 toke as below: public class ERC20 extends Contract { public static final ...
user avatar
1 vote
0 answers
394 views

eth_estimateGas Error when balance of an account < the amount to send in a transaction

I have used the following request to estimate gas in an ETH transaction in Ropsten. ## JSON-RPC over HTTPS POST curl https://ropsten.infura.io/v3/YOUR-PROJECT-ID \ -X POST \ -H "Content-...
user avatar
  • 111
1 vote
0 answers
265 views

Ethereum account for HD Wallet key generated with xpub key only using bitcoinj

Accordingly to the BIP32/BIP44 specification recommendations I generating HD Wallet addresses using bitcoinj library (DeterministicKey instances) with the path like M/44'/60'/0'/0/0 using xpub key ...
user avatar
  • 111
1 vote
0 answers
287 views

smart contract Thether balanceOf method returns 0x

i used web3j-java call Tether contract method balanceOf(the server node is mine , and on ether mainnet),my address has 3USDT,but i call balanceOf , the node returns me 0x as the balance value,it is ...
user avatar
1 vote
0 answers
167 views

How can i get the name of an emitted event through the event abi (log entry, topics) of solidity?

I want to get the name of an emitted event from my contract using the event abi and web3j. This is the contract i'm using as an example for this question: pragma solidity ^0.5.7; contract ...
user avatar
1 vote
0 answers
165 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 ...
user avatar
  • 526
1 vote
0 answers
492 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 ...
user avatar
1 vote
0 answers
88 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 ...
user avatar
  • 181
1 vote
1 answer
539 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 {...
user avatar
1 vote
0 answers
955 views

How to get Ethereum transaction list by address in java web3j quickly?

Im trying to fetch transaction logs from ganache using web3j library to send it as an api ,is there any way where i can get all transactions from ganache quickly? @GetMapping("/test") public List&...
user avatar
  • 86
1 vote
0 answers
266 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 ...
user avatar
  • 86
1 vote
1 answer
920 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 ...
user avatar
  • 86
1 vote
2 answers
1k 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'...
user avatar
  • 11
1 vote
1 answer
76 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
user avatar
  • 86
1 vote
0 answers
120 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....
user avatar
1 vote
1 answer
149 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?
user avatar
  • 168
1 vote
0 answers
106 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 (...
user avatar
1 vote
1 answer
108 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 ...
user avatar