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
632 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
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....
2
votes
1answer
271 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
1
vote
1answer
105 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
212 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
554 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
12 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
1answer
27 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
166 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
72 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
294 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
60 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
335 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
239 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
213 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
251 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
264 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
284 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 ...
2
votes
0answers
276 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
22 views

Extra mining fees added in etherbase account

1st scenario - I have set miner.setEtherbase(eth.accounts[1]) and gasPrize is 0. 1 coin Transaction - And done transaction from 0th account to one random account. I expect 0 mining fees will add ...
1
vote
0answers
68 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
53 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
116 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
194 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
228 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
9 views

Why does the error Invalid response received: 403;?

Develop a java project to connect to ethereum blockchain and until now no error has been presented, but now this error appeared:   org.web3j.protocol.exceptions.ClientConnectionException: Invalid ...
0
votes
0answers
14 views

Java class generated with web3j has a “deploy” method wherein initialWeiValue, initialSupply have to be both specified. Isn't it the same amount?

Method in the java class generated by web3j is like this: public static RemoteCall<Crowdfunding> deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, ...
0
votes
0answers
53 views

Transaction receipt was not generated after 600 seconds for transaction:

I am sending a transaction through this code: txhash = careercertificate .createCertificate(id, fecha, nombre, rutalumno, instituto, rutinstituto, titulo, totalhash, ...
0
votes
0answers
20 views

Send ether from one wallet to another

I have two metamask accounts and what I want to do is send ether between those accounts. For the interaction between those accounts, use infura, I give the address of both accounts but in the end the ...
0
votes
0answers
30 views

Invalid OPCode on passing address parameter through Java wrapper on smart contract using Ganache

I have been facing this issue for some time and I realized there must be a problem with Ganache or maybe someone has any idea why it doesn't work. I have created a very simple contract as below, it ...
0
votes
0answers
61 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
23 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
27 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
149 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
31 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
303 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 ...