Questions tagged [web3j]
Lightweight Java and Android library for integration with Ethereum clients
398
questions
12
votes
5
answers
22k
views
why did it returned null after call miner.start()
> miner.start()
> null
before it , I had created a account like this .
user1 = eth.accounts[0]
"0xb62f0bae52d153365661c4e23ab1d594484e9bef"
10
votes
2
answers
6k
views
Web3j listening to events
I'm tinkering with web3j and most of the things that I want to do succeed, however I seem to not be able to listen to events.
I've extended the ballot.sol contract you get with remix by adding an ...
9
votes
3
answers
3k
views
Deploy contract on EthereumJS TestRPC
Following https://medium.com/@mvmurthy/full-stack-hello-world-voting-ethereum-dapp-tutorial-part-1-40d2d0d807c2
I've tried to create an instance of a contract using:
VotingContract = web3.eth....
7
votes
4
answers
30k
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 ...
7
votes
3
answers
9k
views
How to create accounts and also retrieving the ether balance with web3j in a java file?
I do not see anything in creating accounts and retrieving ether balance in web3j's documentation, I wonder if it is possible.
7
votes
2
answers
2k
views
Unable to deploy contract to private blockchain using Web3j (Java client) because of TransactionTimeoutException
I am using Web3j for interacting with my private blockchain network created in Azure.
I have created contracts using Remix and Metamask and was able to view that Contract from Java.
However I was ...
7
votes
1
answer
5k
views
Solidity ecrecover and web3j Sign.signMessage() are not compatible, is it?
Using Web3j to sign and verify a message is fine but when I use the signature generated by Web3j to verify using ecrecover in solidity it doesnot seem to work correctly. The signer address is ...
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 ...
6
votes
2
answers
4k
views
how to use Web3j library for android
hi guys i am confuse about the web3j library for android i search about this but i did not get any materiel about this (https://github.com/web3j/web3j). this is lib for using ether node on java and ...
5
votes
3
answers
5k
views
How to catch solidity contract revert message using web3j (Java)
Is there any way to catch solidity revert message like Remix Javascript VM in web3j (Java)
Revert message(Remix)
transact to Erecruitment.issueNewAdmitCard errored: VM error: revert.
revert The ...
5
votes
1
answer
3k
views
send() or sendAsync() while using Web3j to call functions
I built a java web application which connects using Web3j with my smart contract deployed on Ropsten Network.
My web application provides a control panel to allow the user to send transactions to the ...
5
votes
1
answer
6k
views
Convert String to Bytes32 in web3j?
public String solFunction(String str) {
byte[] byteValue = DatatypeConverter.parseHexBinary(str);
Bytes32 strInBytes = new Bytes32(byteValue);
try {
Uint256 value = contract....
5
votes
1
answer
3k
views
How to point web3j to other networks such as BSC?
I would like to use web3j and to execute the functions of contracts that are found on Binance Smart Chain. How is this done ?
Would it be just
Web3j web3 = Web3j.build(new HttpService("https://...
5
votes
1
answer
3k
views
How to Query the state of a smart contract using web3j in Android?
I found this documentationQuerying the state of a smart contract.
but i can't get resault,this is my code.
Web3j web3j = Web3jFactory.build(new HttpService(url));
List&...
5
votes
3
answers
4k
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....
5
votes
1
answer
1k
views
How do I get the raw private key from a WalletFile object?
How can I get the raw private key from a WalletFile object?
Here is how I am creating the wallet.
String seed = UUID.randomUUID().toString();
ECKeyPair exKey = Keys.createEcKeyPair();
BigInteger ...
5
votes
3
answers
2k
views
A problem with filters and events (web3j/TestRPC). SOS! ;)
Help me, please, with this little simple task! I cannot solve this problem for several days. SOS! ;)
I'm trying to write a program for filtering events via web3j. I copied to start (for the test) from ...
5
votes
1
answer
935
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 ...
5
votes
1
answer
645
views
How do I connect Parity and TestRpc
My very much appreciated and valued Conor Svensson -who creates web3j- gave me a very simple task so that we can reproduce the issue https://github.com/web3j/web3j/issues/105#issuecomment-309186331.
"...
4
votes
2
answers
3k
views
Ethereum remix web3 connection problem
I tried to connect to an ethereum node by using remix. It means that I am using http and not https. However, I receive same error message:
Not possible to connect to the Web3 provider. Make sure the ...
4
votes
1
answer
4k
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 ...
4
votes
2
answers
3k
views
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 ...
4
votes
2
answers
3k
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....
4
votes
2
answers
5k
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....
4
votes
2
answers
1k
views
web3j.ethSendRawTransaction wait until the transaction is successfully mined - Web3j
Im trying to send 0 ether to the same account with Web3j, however when i run this code it give me directly the transaction hash, even if the transaction has not been mined yet and still pending. I can'...
4
votes
2
answers
435
views
personalUnlockAccount.accountUnlocked() giving NullPointerException even if correct passphrase has been inserted
When I trying to unlock the account with personalUnlockAccount.accountUnlocked() method of PersonalUnlockAccount class of web3j library, it's giving NullPointerException even if I am entering right ...
4
votes
1
answer
1k
views
Why is web3j java not generating correct return types for my contract
Here is my contract:
pragma solidity ^0.4.17;
contract SignVerify {
function recoverAddr(bytes32 msgHash, uint8 v, bytes32 r, bytes32 s) returns (address) {
return ecrecover(msgHash, v, r,...
4
votes
2
answers
6k
views
Send Custom ERC20 Tokens from one Address to another
How to send custom ERC20 tokens from one wallet to another, if i want to send EBTC/ECASH custom ERC20 tokens.
I wrote a method that can send the ether from one account to another, how could i do the ...
4
votes
1
answer
826
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 ...
4
votes
2
answers
1k
views
I am using web3j and geth. How to create default accounts with some ether allocation to it?
I need a default account with huge ether allocation. This I need to set up manually in genesis.json
Hereafter,all accounts need to be created dynamically in java, and they should also be given some ...
4
votes
1
answer
772
views
How can I get merkle proof in Ethereum?
I am 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 the Merkle branch. With the help of web3j, I can get the ...
4
votes
0
answers
481
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):
...
3
votes
2
answers
4k
views
Convert ethereum balance getting in biginteger to ether
public BigInteger getBalance(String address)
{
/*Web3j web3j */
createEthreumConnection();
EthGetBalance ethGetBalance = null;
try {
ethGetBalance = web.ethGetBalance(address, ...
3
votes
2
answers
4k
views
How to create a RawTransaction for contract interaction Web3j
I want to sign a transaction that calls a smart contract function and send it to the Rinkeby network.
I found on Web3j documentation the RawTransaction class that supports the methods for the ...
3
votes
1
answer
8k
views
Contract.methods.transfer is a not a function error using web3
Running something simple as this:
Contract = new web3.eth.Contract(this.contractABI, this.contractAddress)
Contract.methods.transfer(toAccount.address, transfferAmount).encodeABI()
Gives me ...
3
votes
1
answer
4k
views
web3.eth.getBalance returns me the strange values ?
i am trying to get the balance of a wallet, the method is working but the returned result is a json object - { c:(2) [484895,26495000000000],e:19, s: 1}.
In which the value - 484895 corresponds to ...
3
votes
4
answers
5k
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 ...
3
votes
1
answer
575
views
What does the get Status () method return with a pending state transaction?
If a transaction has a successful state it returns 0x1 but if the transaction has a failed state it returns 0x0. My questions is, what to return when the transaction has a pending status?
public ...
3
votes
1
answer
2k
views
How to use web3j to observe transaction of ERC20 token
Leverage Web3j TransactionObservable together with filter, i can monitor ETH/ETC transactions as following code snippet illustrates.
web3j.transactionObservable().filter(tx -> isWantedTransaction(...
3
votes
1
answer
3k
views
Create ethereum wallet inside android dapp
I am creating a DApp for android and want to be able to create a wallet for each user when they register. I am using web3j, can see how to make wallets in the command line but can't see how to do it ...
3
votes
1
answer
1k
views
Function of smart contract returns 0 from Web3j
please help me in this problem.
I am successful to compile and deploy my smart contract using web3j on testrpc. But When I call the function that returns uint in this contract from web3j, I always ...
3
votes
2
answers
2k
views
Compiling Smart Contract in Java
I want to compile a smart contract (solidity code) in Java. Currently I am using the web3j library. When I run the method web3j.ethCompileSolidity(contract) I'm getting the following error: The method ...
3
votes
1
answer
1k
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
3
answers
2k
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
2
answers
5k
views
What is the wallet path for credentials in web3j?
I am using the readme guide https://github.com/web3j/web3j. What I am interested is developing smart contracts from my host with java + web3j to private ethereum network which runs on my virtual ...
3
votes
2
answers
349
views
Smart contract listeners
I want to develop a method in a smart contract that act as a listener,
what i mean is when i use eth.sendTransaction(from:, to:@ of smart contract) it will be executed, without calling any smart ...
3
votes
3
answers
4k
views
How to convert Java String to Bytes32 in Java ? I am using web3j solidity wrapper to interact with Smart contract. I am getting following error:
java.lang.UnsupportedOperationException: Input byte array must be in range 0 < M <= 32 and length must match type
I am trying to do as given below. I wanted to add the people but wrapper ...
2
votes
2
answers
3k
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. ...
2
votes
2
answers
9k
views
Generate private key and address using web3j
How can i generate private key and address using web3j instead of creating keystore json file
2
votes
2
answers
3k
views
How to get public key from private key in Web3j
I am developing Dapp by web3j and I attempt to convert private key to public key. I found this question this question that provides a way converting private key to public key in class ECKey, but I ...