Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [java]

Java is a general-purpose computer programming language that is concurrent, class-based, object-oriented, and specifically designed to have as few implementation dependencies as possible.

1
vote
3answers
544 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?
2
votes
2answers
1k views

Ethereum HD wallet library for Java

Is there any Ethereum HD wallet java library? I find a popular java library on Github, web3j, which doesn't support HD wallet yet.
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....
1
vote
1answer
85 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: @...
1
vote
1answer
195 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
517 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 ...
0
votes
1answer
32 views

org.web3j.tx.exceptions.ContractCallException: Empty value (0x) returned from contract

Problem: org.web3j.tx.exceptions.ContractCallException: Empty value (0x) returned from contract The code is as follows.... My java: String owner = managedWalletLookup.getOwner(contractAddress).send(...
0
votes
1answer
38 views

Anyone with knowledge in org.web3j.abi.Type Decoder?

I am trying to decode a String with this code that I found but I have not been able to do it. String to = inputdata.substring(10, 74); String value = inputdata.substring(74, 138); Method refMethod = ...
0
votes
1answer
147 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 ...
0
votes
1answer
128 views

Could not resolve placeholder 'XXXX' in value “YYY”

I am unable to read my application.properties file.Here is my code for application.properties: eth.network.url="https://rinkeby.infura.io/v3/9ea96ecdf13c4756a99c19f4f34e679e"; WORKING_DIRECTORY= "~/...
0
votes
1answer
57 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
1answer
276 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 ...
0
votes
1answer
191 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
198 views

how to call java method via solidity contract

I have my solidity contract //solidity contract pragma solidity ^0.4.7; contract SimpleStorage { uint public storedData; function SimpleStorage(uint initialValue) { ...
0
votes
1answer
228 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 ...
0
votes
1answer
390 views

A bit confused. How do I send ether using Web3j to an address (Android)

EDIT: I am using android platform I think I'm a bit confused conceptually. I would appreciate it if someone could answer these few questions for me as I'm trying to make an app so that I can be ...
0
votes
1answer
251 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 ...
0
votes
1answer
253 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 ...
3
votes
0answers
258 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
2
votes
0answers
212 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 ...
1
vote
0answers
55 views

[RuntimeException: java.lang.NoSuchMethodException: SmartContract using web3j

I am following this tutorial for deployment of contract https://www.youtube.com/watch?v=ibAh04Csp0M&index=33&list=PL16WqdAj66SCOdL6XIFbke-XQg2GW_Avg but i am getting [RuntimeException: java....
1
vote
0answers
39 views

How to write a mock method for getting ether balance using Web3j Api. I am trying to mock Web3j and callig EthGetBalance method but I am getting Null

public static BigInteger OriginalMethod(){ // connect to node Web3j web3 = Web3j.build(new HttpService()); // defaults to http://localhost:8545/ // send asynchronous requests to get balance ...
1
vote
0answers
112 views

Can deploy Smart contract from Main thread but not from a class

I have a contract: pragma solidity ^0.4.0; contract qualification { address owner; /* This function is executed at initialization and sets the owner of the contract */ function qualification() { ...
1
vote
0answers
175 views

How to convert Ethereumj byte arrays to Strings?

Ethereumj gives a lot of byte arrays, when the equivalent would be a string in Bitcoin. A few examples (in Scala) ECKey.getAddress // returns Array[Byte], need String Transaction.getHash // returns ...
1
vote
0answers
224 views

How to create an account from a Spring MVC project

I am working on Ethereum blockchian. I have create a login page using Spring MVC 4 and it is connected to MySQL DB. Now I want to assign coinbase to the successful registration of the user. My Idea ::...
0
votes
0answers
29 views

Generate derivated address from xpub

I managed to get Bitcoin addresses from xpub using bitcoinj with this code : DeterministicKey hd = DeterministicKey.deserializeB58("xpub...", MainNetParams.get()); DeterministicHierarchy hi = new ...
0
votes
0answers
16 views

In ethereumj, why the signature use loop to get v?

In the java version of Ethereum, I see the signature code as follows: public ECDSASignature sign(byte[] messageHash) { ECDSASignature sig = doSign(messageHash); // Now we have to work ...
0
votes
0answers
18 views

How to do decoding with web3j?

I am looking for how to decode the input data of a transaction and what I have obtained up to now is in utf-8 and it gives me this data: "Ã;` Q ò  à                          ...
0
votes
0answers
66 views

How to decode the input data in java?

I receive the input data as the image shows. And when I try to decode it with the method: String inputdata = null; Optional<Transaction> tx = web3.ethGetTransactionByHash(txHash).send()....
0
votes
0answers
24 views

deploying an oracle using web3j

I want to use web3j in order to deploy an oracle (smart contract using OraclizeApi) and I don't know how to do it. normally for a simple smart contract we compile the .sol using solc and then generate ...
0
votes
0answers
28 views

Changing block reward in Ethereum's Java Protocol

I'm new to Ethereum and just messing around with the code on my free time. I heard that the current block reward is 3ETH, and I want to change it just for fun. In the end, I managed to find a line in ...
0
votes
0answers
179 views

WEB3J error: cannot find symbol import org.web3j.protocol.Web3j

The following code compiles in Java but gives: error: cannot find symbol import org.web3j.protocol.Web3j; and other import related errors on runtime. I'm new to the Java environment (using VS ...
0
votes
0answers
40 views

Running Go Ethereum on Java Web Apps

i have done implementing go ethereum smart contract through command line. Now i want my java web apps interacting with my smart contract. My idea is to use "Runtime" in java so i can execute the ...
0
votes
0answers
31 views

RxJava reduce function called in transactionObservable in etherum

I was going through events in solidity and how to catch them in my web3J (web3 java), my requirement was to get all the latest transaction that is being added in the blocks, for that from the ...
0
votes
0answers
257 views

Sending A Transaction Async | Cannot Resolve Method 'executeTransactionAsync' | Android Studio | Java

When calling the executeTransactionAsync method, part of web3.abi.datatypes.Function, I get an error saying the method can not be found. If I remove the Async so the method is executeTransaction, I ...
0
votes
0answers
341 views

How to create an android wallet for Ethereum

There's a project that I would like to implement that would require me to implement a simple Ethereum wallet client for Android. I would like to know the basic building blocks for making such an ...
0
votes
0answers
278 views

Why do I always get 'private key length is invalid' when launching testrpc from java with predefined accounts?

Im trying to deploy testrpc from java with two accounts starting with funds, and I keep getting an error saying "private key length is invalid" from testrpc. Below is my code: private static final ...
0
votes
0answers
93 views

Account management with geth and mobile devices

Let's say I have a private blockchain that will interact with [mobile devices]. The closest example is an identity mobile app like Civic. As I understand, key & account management is very ...