Questions tagged [web3j]

Lightweight Java and Android library for integration with Ethereum clients

Filter by
Sorted by
Tagged with
1
vote
0answers
87 views

Is there a thread leak in Ethereum Web3J

As part of our plans to integrate blockchain technology, I am looking at Ethereum and playing around with the java API (web3j). One obviously starts with the examples but I found that the VM does not ...
1
vote
2answers
1k views

Why is my web3j wrapper failing to generate?

I've created a smart contract in solidity which I've compiled with solc into a .bin & a .abi file. However, when I run the generator on the .abi and .bin files it returns a JSONParseException ...
0
votes
1answer
71 views

May last block on watch only client become stale?

Let we have an ethereum node which is for a watch purposes only (it doesn't create any transactions, just updates it's replica of the whole chain). To get notifications about top blocks in the chain ...
1
vote
1answer
837 views

No build method inside Web3j class

I'm trying to initialize web3j with following code: Web3j web3 = Web3j.build(new HttpService()); // defaults to http://localhost:8545/ Web3ClientVersion web3ClientVersion = null; try { ...
2
votes
2answers
803 views

Out Of Memory exception when using web3j in Android

I'm trying to integrate web3j in an android application. But the library gives an Out Of Memory exception when loading the wallet file: Credentials credentials = WalletUtils.loadCredentials("password"...
0
votes
1answer
397 views

Getting exception with web3j new transaction listener code

I am using web3j to receive all new transactions as they are added to the blockchain. I am using private blockchain. Here is my code: web3j.transactionObservable().subscribe(tx -> { ...
0
votes
2answers
238 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
2k views

Creating an account using web3js or web3j

I am trying to create account on ethereum private network using web3js from front end. I have written the below lines in my js file. The createAccount() gets called from an HTML page web3 = new Web3(...
1
vote
2answers
2k views

Using Web3j to load a smart contract, how do i specify my credentials?

I am using the Web3j library to generate a Java wrapper for my solidity contract, i have already deployed the contract to the blockchain and it has been mined, i now want to load the contract in java ...
1
vote
0answers
202 views

WalletUtils.loadCredentials takes a while to answer,about 2 minutes

WalletUtils.loadCredentials takes a while to answer, about 2 minutes, running on the android devices, Credentials credentials = WalletUtils.loadCredentials("password","path to file"); just this method,...
1
vote
0answers
110 views

Huge amount of gas being used for small computation

I have just added one other part to my contracts addUser method (setting the isPermitted field) and it has blown up the amount of gas it uses to the point I keep getting out of gas exceptions. The ...
9
votes
3answers
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....
5
votes
1answer
4k 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....
7
votes
1answer
800 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
233 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
0answers
99 views

Setting balance to an account

After i created a wallet for a user i want to modify his balance, how could i do that without setting the account address' balance in the genesis, I'm using quorum blockchain with web3j. Thank you!
0
votes
2answers
615 views

web3j WalletUtils.loadCredentials() works in Java, throws java.lang.OutOfMemoryError on Android

I'm trying to use web3j + Infura to interact with the Rinkeby chain from an android app. I first wrote a simple test in Java and everything worked - transactions, interacting with contracts, you name ...
1
vote
2answers
669 views

Get input data from specific transaction

I have a contract. I store data in ethereum using contract. Is it possible, to work with contract in git-like way. For example, i have a list of previous transaction hashes. Can i fetch data from any ...
2
votes
1answer
1k views

Is it possible to call payable functions of smart contract using web3j’s smart contract wrappers?

How do we call payable functions of smart contract using web3j? UPDATE: I'm going to change generated smart contract wrapper class manually. Now I have: public Future<TransactionReceipt&...
1
vote
1answer
1k views

How to store user private keys and details

I am creating an android DApp and have used go-ethereum to create wallets for users when they create an account. This stores the private key on their device. I want to also keep all of their details ...
2
votes
1answer
2k 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
1answer
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 ...
6
votes
2answers
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 ...
2
votes
1answer
2k views

Web3j: “Intrinsic gas too low” error when deploying contract in Ethereum from Java

I am a new to Ethereum and Blockchain, I have been trying execution of Contracts using Metamask and Remix using Chrome browser for sometime. I am trying to deploy the same contract from Java using ...
1
vote
3answers
359 views

From a traditional web based application how can I able to call ethereum network node?

Let's say there is a web application running on server 12.34.45.45 ip. Peer A open this web application in his own browser.Now how he will be able to connect a ethereum node where peer B is running....
5
votes
1answer
591 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. "...
0
votes
3answers
609 views

How can I let TestRpc reveil the public key of a generated account

I suffer a steep learning curve at the beginning. My current goal is to set up a testing environment with TestRpc, Truffle and Web3j (wow). Web3j worked as expected and generated a Java wrapper for ...
1
vote
1answer
606 views

how to represent “\x19Ethereum Signed Message:\n32” as java string?

How can I represent the this string "\x19Ethereum Signed Message:\n32" in java? The first character seems the length of 'Ethereum Signed Message:\n' string but it is escaped. What I'm trying to do is ...
5
votes
1answer
3k 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 ...
0
votes
2answers
514 views

Deploying and interacting contract with Azure consortium blockchain with their transaction receipt not returning from blockchain

I am using Web3j to deploy and interact with a contract on Azure consortium blockchain. Connecting to Azure consortium blockchain RPC endpoint Web3j web3 = Web3j.build(new HttpService("http://***....
0
votes
1answer
2k views

Transfer of Ether from one party to another

I'm trying to transfer ETH from one account to another using web3j and a java program using following code. public void transfer (String from, String to, BigInteger amount) throws ...
7
votes
2answers
8k 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.
2
votes
2answers
2k views

Deploy smart contracts using web3j java library

I am using web3j java library to deploy a smart contract. // I am encoding the constructor parameters here -- 2 & 3, 10 & 20 String encodedConstructor = FunctionEncoder....
3
votes
2answers
4k 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
2answers
264 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 ...
1
vote
1answer
606 views

problem when deploy smart contract in Quorum using web3j

I'm using web3J when i try to deploy contract i get Error processing transaction request: Non-200 status code: &{Status:400 Bad Request StatusCode:400 Proto:HTTP/1.1 ProtoMajor:1 ProtoMinor:1 ...
8
votes
2answers
3k 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 ...
3
votes
2answers
1k 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 ...
9
votes
5answers
16k 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"
1
vote
1answer
717 views

Web3j client is not detecting any transaction or blockchain from geth

I am using web3j to listen to transactions and blockchains through geth. It seems that none of the subscriptions that I have created to the blockchain or transaction are detecting changes. I start ...
5
votes
3answers
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 ...
2
votes
1answer
1k views

Insufficient funds error on deploying smart contract

I am writing a Java program to deploy a smart contract. I have created the Java Wrapper class. This is the essence of the code. static final BigInteger GAS_PRICE = BigInteger.valueOf(20_000_000_000L)...
1
vote
1answer
707 views

Event watcher gives [object Object] in Geth console

I compiled a contract source below: pragma solidity ^0.4.0; //////////////////////////////////////////////////////////// // This is an example contract hacked together at a meetup. // It is by far ...
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....
3
votes
1answer
2k 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&...
3
votes
3answers
2k 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 ...