Questions tagged [web3j]

Lightweight Java and Android library for integration with Ethereum clients

Filter by
Sorted by
Tagged with
1
vote
1answer
400 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 ...
3
votes
0answers
117 views
+100

Problems calling Smart Contract function in Java using Web3j

I am rather new to writing/using smart contracts in Java and I am currently trying to use my smart contract. I already wrote and tested it, compiled it, deployed it to Ropsten, and built my Java class ...
1
vote
1answer
91 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
0answers
9 views

Web3j generate command not running

I am trying to generate a java wrapper class for a solidity contract, I have compiled the file and have the abi and bin file, but when I run the command as follows: web3j solidity generate ...
0
votes
2answers
2k 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....
1
vote
1answer
134 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 {...
0
votes
1answer
329 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); ...
0
votes
1answer
688 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 ...
1
vote
0answers
17 views

web3j command-line does not recognize flags

I am trying to run the command such as web3j solidity generate -b SimpleBank/SimpleBank.bin -a SimpleBank/SimpleBank.abi -o ~/IdeaProjects/quiknode/src/main/java/ -p com.simplebank Found here: https:/...
1
vote
1answer
257 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
90 views

Error processing transaction request: already known

I'm developing an application with which you can make ERC20 token transfers. When you make transfers from one account to another with a reasonable time between transfers it works correctly. But when ...
1
vote
1answer
11 views

How to properly close web3 after execution? - Java

Here is what I am trying to do: String amt = Web3j.build(new HttpService("https://ropsten.infura.io/v3/123blahblah")) .ethGetBalance("0xblahblah", DefaultBlockParameterName.LATEST) ...
0
votes
1answer
416 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 ...
0
votes
1answer
469 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....
0
votes
1answer
226 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; } ...
1
vote
0answers
34 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 : ...
0
votes
1answer
430 views

Not able to convert and access Tuples of bytes array and convert to string in Java using web3j

I am new to the development of smart contract using web3j. I am facing issue, while converting Bytes32[] returned from wrapper of contract(.sol) method to array. I have contract as: pragma solidity ...
0
votes
1answer
291 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 ...
2
votes
1answer
281 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
2answers
467 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
1answer
690 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....
3
votes
3answers
2k views

Decoding transaction input data with web3j (Java)

My use case is the following: I would like to have a daemon monitoring how users are interacting with my smart contract. The way I see it is to look at incoming blocks and try to decode input data ...
1
vote
1answer
277 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 ...
0
votes
0answers
10 views

Unable to executive function of smart contract on android studio java file

I am trying to execute some functions of my deployed contract in Android Studio through a Java file. I have generated Java Wrapper files. However, when I run Android Studio, there is no data added to ...
0
votes
0answers
22 views

Cannot generate java wrapper class from contract

currently I am trying to generate a java wrapper contract from my smart contract. The command I use is as seen below : web3j truffle generate --javaTypes C:\Users\name\Documents\test\...
0
votes
1answer
51 views

web3j - Java - Resolve ENS Name to Contract Address

I am trying to Resolve my ENS Name to the corresponding Contract Address. But so far I get the error org.web3j.tx.exceptions.ContractCallException: Empty value (0x) returned from contract I am using ...
0
votes
1answer
423 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 ...
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....
0
votes
0answers
19 views

Verifying ethereum message signatures with java

I am using web3j to verify message signatures but there are some false negative results. For example this signature should be right, but it seems like the address could not be recovered: final ...
1
vote
0answers
10 views

Contracts invoked asynchronously are not packaged as transactions [closed]

I use the sendAsync() method to call the contract asynchronously. If I loop through the method several times, without using get(), the number of packaged transactions is less than the number of calls, ...
0
votes
2answers
49 views

Contract Call has been reverted by the EVM with the reason: 'execution aborted (timeout = 5s)'

I defined an array of objects in the Ethereum smart contract. An object is a structure that is inserted into the array every time a function is called.When 80,000 data is inserted, it takes a long ...
0
votes
1answer
331 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 ...
3
votes
1answer
923 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 (!...
1
vote
1answer
50 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 =...
0
votes
1answer
314 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 ...
1
vote
0answers
34 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 ...
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....
0
votes
2answers
380 views

What's problem about “gas required exceeds allowance or always failing transaction”

I translate smart contract into Java with solc and web3j, but I meet the probelm "gas required exceeds allowance or always failing transaction". This is my smart contract. It is work when I use ...
0
votes
0answers
18 views

How to catch a solidity event from Java

I am trying to make a decentralized android application. It is an online two player Tic-Tac-Toe game. I have implemented the back-end with solidity and a part of the front-end in android studio. ...
1
vote
0answers
22 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 ...
0
votes
1answer
305 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
7
votes
1answer
877 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 ...
1
vote
1answer
589 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 ...
0
votes
1answer
216 views

how to find if a Tx hash is in pending state in ethereum mainnet after web3j fastTxMgr timeout

I am using QueuingTransactionReceiptProcessor() with callback accept(). DEFAULT_POLLING_ATTEMPTS_PER_TX_HASH is 10 and POLLING_FREQUENCY is 15000. That gives nearly 3 min wait for network to ...
2
votes
0answers
40 views

events and relationships between smart contracts and oracle smart contracts [closed]

How to subscribe a web3j client node to a smart Oracle contract event? Do I need the Oracle contract address?
0
votes
2answers
505 views

How to use balanceOf function with Web3j for an android app

I am trying to use the balanceOf function after the generation of our smart contract (pakoin) function wrappers in Java with Web3j. Despite trying different ways, I get plenty of errors and I don't ...
1
vote
2answers
272 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'...
0
votes
1answer
650 views

Web3j decode function from TransactionReceipt

I'm connecting to a testnet using a Geth node running version 1.8.8-stable, and also I'm using the web3j lib version 3.4.0. I deployed a Smart Contract and also used the web3j wrapper tools to ...
0
votes
1answer
138 views

Deploying a smart contract using transaction manager in web3j

I am new to web3j and smart contract deployment. Consider a scenario where a user is too scared to give his wallet credential file or username/password or private key in a piece of code(the code is ...
1
vote
0answers
16 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 ...

1
2 3 4 5
7