Stack Exchange Network

Stack Exchange network consists of 174 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.

0
votes
0answers
255 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
216 views

Web3j bytes32 cast fails despite byte[] being 32 in length

I know similar questions like this have been asked however most the answers conclude that the array length is wrong (i.e. not 32). In my case however my array is exactly the correct length and when ...
1
vote
2answers
385 views

Deriving the v value from an ECDSA signature without web3j

I am currently signing with a the ECDSASignature spec in java however I noticed that getting a v value from the signature is a custom spec for ethereum. My code: public static void main(String[] ...
1
vote
1answer
424 views

Error when calling a function of a smart contract with web3j

I am trying to use a function which returns a value of the smart contract (pakoin). contract Pacoin { /* This creates an array with all balances */ mapping (address => uint256) public ...
0
votes
2answers
931 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
576 views

How could I send transactions continuously by Web3j generated wrapper

I wrote a smart contract and deployed on my private Quorum. I use Web3j to generate java wrapper to call ABIs. For example, // here is a smart contract function function getMoney() external payable ...
3
votes
0answers
244 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
1answer
915 views

How to get balanceOf of a deployed ERC20 contract using web3j?

I'm new to Ethereum and I got stuck on trying to call balanceOf on a deployed ERC20 contract. Here is the code I have so far: Web3j web3j = Web3j.build(new HttpService()); RemoteCall<...
3
votes
1answer
1k 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 ...
2
votes
1answer
2k views

How fetch transaction history for account quickly using Web3j?

Intro We use Web3j java library to work with Ethereum network. I use Rinkeby test network wit Geth client at the moment. I got familiar with blockchains only a week ago, so terms I use can be ...
0
votes
1answer
761 views

Unable to retrieve value from Web3j sendFunds Future

I have been trying to send funds from one ethereum account to another using web3j to test that it works on Android. I am using an Infura cloud instance. First, it appears I need to send it async ...
0
votes
0answers
79 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 ...
0
votes
1answer
603 views

Interacting with an ethereum smart contract via Java

I am interested in interacting with a smart contract via a Java application. I found that there is a library called web3j (https://docs.web3j.io/) for which this should be possible, however there is ...
3
votes
1answer
239 views

Iterating through the ethereum blockchain using Java

I am trying to iterate through the LevelDB in ethereum to see what data is stored in the blockchain. I have loaded the database and created in itr using Dain's LevelDB api, but I am having trouble ...
2
votes
2answers
640 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
332 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
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 ...
0
votes
2answers
386 views

Ethereum Account setup, connect with the blockchain and keep tracks of the updates

I have a Bitcoin wallet developed in Java/Spring MVC and supports account setup, connect with the blockchain and keep tracks of the updates such as the balance, transactions etc. The sample code ...
2
votes
1answer
2k views

How to decode input data with ABI using java?

There is a tool on npm ethereum-input-data-decoder. And yes, i can read input data as hex byte[] bytes = Hex.decodeHex(transactionReceipt.getInput().substring(2).toCharArray()); System.out.println(...
3
votes
1answer
2k 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....
1
vote
1answer
186 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
2answers
544 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 ...
1
vote
1answer
273 views

IPFS Android Cant add file

I am using the java-ipfs-api - https://www.npmjs.com/package/geth-private for my android DApp. I have managed to connect to the ipfs daemon and have tested it using the ipfs.refs.local(); command as ...
3
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
430 views

is there a java library to access or respond to an ethereum contract events?

We are building a java backend that is expected to interact with an ethereum node. So far I have only seen and tried web3.js api but it seems difficult to run it from java code. Is there a way to ...
1
vote
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
1answer
422 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
2k 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 ...
1
vote
0answers
162 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
1answer
491 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 ...
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 ...
1
vote
1answer
638 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 ...
3
votes
1answer
632 views

Java Client for Ethereum Contract [closed]

I am trying to create an Ethereum Contract, through my java application, has anyone done this before? how do you pass the JASONRPC command via java method I am using TESTRPC
6
votes
1answer
203 views

Is the EVM operand stack size (at any instruction) independent of the execution path?

I'm trying to analyze some EVM bytecode, comparing it with Java bytecode. The Java specification states the following in the JVM specification §4.9.2. Structural Constraints: If an instruction can ...
3
votes
2answers
1k 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 ...
13
votes
3answers
3k views

How to experiment with Ethereum without downloading the entire blockchain?

I want to experiment with Ethereum without having to download the entire blockchain. My ISP limits my bandwidth to 50GB and downloading the ETH chain would consume a lot of that, not to mention the ...
1
vote
0answers
217 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 ::...
4
votes
1answer
358 views

Deploying a contract on private Ethereum network Harmony

I just started on ethereum and I created a private ethereum network on harmony and we were able to syn up to other peers using the same router . Question would like to ask is how do u deploy the ...
4
votes
1answer
678 views

How to sign transaction for calling sendRawTransaction JSON RPC method?

I have a private ethereum network and a java process with communicates with a ethereum node with JSON RPC. I need to add a transaction from java process by calling the sendRawTransaction RPC method. ...
10
votes
5answers
8k views

Can I write and deploy smart contracts in Java language?

I am a Java developer. I want to write a smart contract using Java and deploy it to a private blockchain network. Does Ethereum provide the facility to write smart contracts using Java language? If ...
4
votes
2answers
2k views

Generating Ethereum Private Key,Public Key On Mobile (Android/Java)

I'm looking for a way to generate Ethereum private keys and public keys inside an Android app. I've scavenged the web and ultimately decided to tear apart the code to myetherwallet and import the same ...
4
votes
3answers
1k views

Does EthereumJ (Java implementation of Ethereum) support JSON RPC API?

Looking at their github repository and searching through the source code, I could not find JSON RPC API, except the one for Whisper. Perhaps I did not look hard enough?