Questions tagged [web3j]

Lightweight Java and Android library for integration with Ethereum clients

Filter by
Sorted by
Tagged with
2
votes
2answers
5k views

Generate private key and address using web3j

How can i generate private key and address using web3j instead of creating keystore json file
0
votes
1answer
355 views

How to list all recipts in a block using web3js?

I'm trying to list all transactions and their receipts from given block. Transactions get be included in the result of GetBlockByNumber function but I have found no option to include receipts. I can ...
4
votes
1answer
391 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,...
3
votes
1answer
380 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 ...
0
votes
1answer
231 views

Correct way to easily call function with web3j from deployed contract

I am trying to call a function from a modified ERC20 contract and I can't manage to make it work. I am doing this with web3j from Android. I can connect to Infura. The contract is already deployed on ...
2
votes
0answers
382 views

Noob having trouble connecting to the Infura Mainnet

I've been attempting to run a script from my terminal, and have been getting this error: Error: CONNECTION ERROR: Couldn't connect to node https://mainnet.infura.io. I've installed Web3j on my ...
1
vote
1answer
828 views

iOS: Create Raw Transaction in swift

I'm working on a project related to blockchain and need to figure out, how raw transaction can be possible, I got no reference for this as of now. Can anyone help me? I have tried this lib: https://...
0
votes
1answer
292 views

Web3j - what is <ensName> when using existing contract

I was just beginning my blockchain development by following https://docs.web3j.io/getting_started.html , I saw some 0x<address>|<ensName>, what is the address and ensName consecutively in ...
2
votes
0answers
288 views

web3j make raw call to deployed contract which checks transaction sender

I have deployed contract to rinkeby. Contract method refuses any call except a call from contract owner (aka contract deployer). I can't use Java bindings. I'm trying to use Function API but it ...
1
vote
1answer
1k views

How to extract token transfer data from Transaction? (Web3j)

I'm new to ethereum and I would like to confirm a few things about Transaction. I've transferred tokens and I would like to extract method, address transferred to and amount from Transaction(org....
0
votes
3answers
4k views

Web3j generate new address in a wallet

I'm using Java (web3j). I have some users and I want to give address to each user. How to generate new address in an ethereum wallet? For example I can generate lots of address from bitcoin wallet. Is ...
1
vote
1answer
2k views

get ERC20 token balance with web3j

I am able to get the balance of my custom token with web3 javascript.The code is shown below. However, when i switch to web3j, I don't find equivalent method like web3.eth.contract(contractABI).at(...
0
votes
1answer
306 views

calling method using web3j returns null

while calling an contract method using web3j returns null.Deployed in Remix ,getting response and deployed in geth console ,got response.
0
votes
1answer
345 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
3answers
6k 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 ...
1
vote
1answer
590 views

Cannot send funds to a smart contract using web3j

I'm trying to send funds to a smart contract using the following code, however, the balance is always 0. TransactionReceipt transactionReceipt = Transfer.sendFunds( web3j, credentials, ...
0
votes
1answer
756 views

how do you check the number off transaction confirmations of an ethereum transaction using web3j?

I looked through the documentation but there doesnt seem to be mention of this. I tried to debug it and look at the status of the transaction receipt but it is always null. Is there any way to do ...
0
votes
0answers
349 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
278 views

cannot deploy a contract with web3j

I am able to generate the contract just fine, and able to create a wallet, but when I try to deploy the contract on testrpc, I always get an exception saying I dont have enough funds. How can you ...
0
votes
1answer
161 views

Gas limit exceeded despite function not being complex

I am writing a function which takes in a bytes32 message and validates it against a signature (this is done without hashing to save gas). I am able to call the recover function and have it execute but ...
0
votes
2answers
254 views

Does an ethereum address exist on all networks when created?

When you create a wallet file, can you use the same address on both main net and test net? I understand the same address will have different funds on each network, but does the address exist on both?...
1
vote
2answers
711 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[] ...
0
votes
2answers
462 views

Web3j doesn't observe new blocks/transactions

I'm using Web3j 3.2.0 and Infura to get information about new blocks and transactions in Ethereum. val web3j = Web3j.build(HttpService("https://mainnet.infura.io/<mytoken>")) log.info("...
2
votes
1answer
2k views

eth_sendRawTransaction:invalid argument 0: json: cannot unmarshal non-string into Go value of type hexutil.Bytes

I call the eth_sign to get signature of RawTransaction, then call eth_sendRawTransaction,but got the error "{"jsonrpc":"2.0","id":1,"error":{"code":-32602,"message":"invalid argument 0: json: ...
1
vote
1answer
527 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
0answers
251 views

Subscription stop after only a few blocks in Web3j

I am using the following code to catch and receive new transactions: DefaultBlockParameter startingBlock = DefaultBlockParameter.valueOf(lastActionedBlockNumber.add(BigInteger.ONE)); ...
0
votes
2answers
451 views

How to use balanceOf function with Web3j for an android app

I am trying to use the balanceOf function after the generation of our smart contract (pakoin) function wrappers in Java with Web3j. Despite trying different ways, I get plenty of errors and I don't ...
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
828 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
1answer
417 views

Ethereum - how to get merkle proof

I'm 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 mercle branch. With the help of web3j I can get the block ...
2
votes
1answer
298 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
1k views

How can I Interact with an ethereum smart contract via Java

I have successfully created smart contract on Ethereum rinkeby network and deployed as well. Now, I want to call the methods of deployed contract through Java not through JS. I know, there is one API ...
0
votes
2answers
2k views

Web3j test accounts and Credentials object

I launch the ethereum blockchain by running testrpc. That is creating 10 test accounts with sufficient funds. When I use web3 with node.js to to deploy a new smart contract, I can use: MyContract.new(...
2
votes
1answer
904 views

Should I use Infura with Web3j for Event filter?

I'm using Web3j with Infura for smart contract deployment, calling contract method and transactions. Now I want to use Filter contract event from log. Should I use Infura for this? Is Web3j filter ...
0
votes
1answer
1k 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
2answers
3k 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, ...
1
vote
1answer
472 views

After-the-fact Fee calculation for ETH transfers

I'm working on a basic application to track ETH transfers, and I'm making use of the web3j Java API to interact with the Ethereum blockchain. My app is working, but I'm having trouble figuring out how ...
3
votes
2answers
2k 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
3k 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
1k 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
1answer
438 views

Getting exception while getting the ethBalance

web3 = Web3j.build(new HttpService()); EthGetBalance ethGetBalance = web3.ethGetBalance("0xb34a5b6a39bceafeb8e23c2cc526889d85bf664e", DefaultBlockParameterName.LATEST).send(); ...
1
vote
0answers
695 views

How to create ethreum wallet using WEB3j [duplicate]

I want to create my own Ethereum wallet,how can I do that and is it necessary to run GETH or similar to use wallet.It will be helpful if any good reference can be provided as I am very much new to it
0
votes
1answer
1k views

How to speed-up Geth transactions in private blockchain?

I'm testing Ethereum smart contracts with web3j and Geth. Geth is running with scripts like that: PASSFILE=/var/folders/_l/kl9pdj2x50v7416j8htb6w740000gn/T/pwd6597172766860806720.tmp DATADIR=/var/...
1
vote
1answer
337 views

Why block number is kept BigInteger in Web3j?

BigInteger blockNum = web3j.ethGetBlockByNumber(DefaultBlockParameterName.LATEST, false).send() .getBlock().getNumber(); Long.MAX_VALUE (9223372036854775807) is more than enough to hold block ...
1
vote
1answer
727 views

Load Contract in web3j

What is the equivalent of (in Web3Js) token = web3.eth.contract(erc20abi).at(tokenAddress); in Web3J I have the erc20abi and the contract address, i want to perform transfer from one address to ...
4
votes
2answers
5k 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 ...
3
votes
1answer
626 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(...
1
vote
2answers
554 views

What is the “right” way to send Ether to multiple addresses?

I have seen this discussed here but didn't get a satisfactory answer. What is the recommended way to send ether to multiple recipients? One way that I have thought of is follows: Deploy a smart ...
0
votes
1answer
719 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 ...
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 ...