Questions tagged [web3j]

Lightweight Java and Android library for integration with Ethereum clients

Filter by
Sorted by
Tagged with
0
votes
1answer
533 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
97 views

org.web3j.protocol.exceptions.TransactionException: Transaction receipt was not generated after 600 seconds for transaction

I am sending a transaction through this code public String transferEthByPk(String amount, String toAddress, String privateKey, Web3j web3j) { BigDecimal value = new BigDecimal(amount); ...
0
votes
0answers
13 views

TransactionException: Transaction has failed with status: 0x0. Gas used: 50434. (not-enough gas?)

I’m new to ethereum and have small experiance with write contracts (in solidity). I think I have a very simple question but is very hard for me. I wrote a contract to manage erc20 tokens. Most ...
0
votes
3answers
76 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 ...
0
votes
1answer
35 views

Web3 hex conversion - Reading Events Output

Using the following code in Nodejs - Web3 to catch event from Solidity Smart Contract: const cron = require("node-cron"); const Web3 = require("web3"); const ABISimpleStorage = require("./build/...
2
votes
1answer
45 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....
0
votes
1answer
139 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
1answer
45 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); ...
2
votes
1answer
108 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
1answer
99 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
72 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 ...
0
votes
1answer
300 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
323 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 ...
1
vote
1answer
74 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
71 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://...
0
votes
0answers
35 views

Web3j and Ganache stack underflow error

I'm experiencing the error "Error processing transaction request: VM Exception while processing transaction: stack underflow" basically with any contract. I'm using Ganache v2.1.2 and Web3j 4.5.15. ...
1
vote
2answers
68 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'...
4
votes
1answer
314 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 ...
1
vote
1answer
137 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(...
4
votes
1answer
401 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 ...
2
votes
1answer
308 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
2answers
258 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 ...
0
votes
1answer
572 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 ...
1
vote
1answer
193 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: @...
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....
0
votes
0answers
20 views

App freezes when using any Web3j sendAsync function

I'm developing an app using Web3j and Java Kotlin in Android Studio. However, I'm not sure why anytime I call a web3j function with sendAsync the app freezes. if(preferences.applicationPreferences....
0
votes
1answer
325 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
263 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
37 views

Not able to add 'replayPastTransactionsFlowable' transaction logs result into an collection List object using Web3j java?

I'm trying to create an api where i have to provide transaction logs in json objects but im unable to add result of replayPastTransactionsFlowable into an collection object @GetMapping("/test") ...
3
votes
2answers
883 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
0answers
45 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&...
0
votes
2answers
772 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
0answers
17 views

Reading all ERC20 token balances

I am aware that the ERC20 balance is easily obtained in web3js by calling token.methods.balanceOf(ADDRESS); However, I was wondering if there are any new developments or API that can now be used ...
0
votes
1answer
292 views

Where is the ethLogObservable method in Web3j?

I can´t find where is the Web3j ethLogObservable method. I can´t find in GitHub repo
0
votes
1answer
31 views

How to use gas price for faster transaction in erc20 transafer event?

I'm trying to provide a customised gas price for faster transaction ,how can achieve that ? Web3j web3 = Web3j.build(new HttpService("http://")); ERC20 javaToken = ERC20.load(contractAddress,...
1
vote
1answer
54 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
37 views

Invalid response received: 404; 404 page not found on Infura

Since I changed my version of web3j from 4.5.11 to 4.5.14 all of my http requests to Infura lead to Invalid response received: 404; 404 page not found response. I saw that they upgraded okHttp in ...
1
vote
1answer
238 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")...
0
votes
1answer
457 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
322 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
0answers
20 views

Contract is not deploying properly on Geth private network using web3j SDK

I am new to Ethereum. I have created private blockchain using Geth on my local and trying to deploy my smart contract using java web3j SDK. I am able to deploy my contract using java and getting ...
0
votes
1answer
358 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
438 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 ...
1
vote
0answers
33 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 ...
0
votes
0answers
428 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
240 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
2answers
379 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. ...
1
vote
1answer
52 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
4answers
1k 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?
0
votes
1answer
197 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
2 3 4 5
7