Questions tagged [web3j]

Lightweight Java and Android library for integration with Ethereum clients

Filter by
Sorted by
Tagged with
1
vote
1answer
264 views

web3j transactions with value

I'm using web3j to analyze transactions. How can I get transactions of a specific contract (assuming I got it's address) in some time frame (or blocks interval) and how can I know if ERC20 tokens were ...
1
vote
1answer
630 views

how to know smart contract gas price and gas limit when deploying the contract using web3j

I am new to smart contracts and ethereum I am using web3j to deploy contracts on the private network Following this as a guide https://github.com/web3j/web3j In the below section of code, it asks ...
1
vote
1answer
407 views

How to call a deployed smart contract methods from android

I deployed a smart contract into my private network using truffle framework. After deployed the contract I implemented a client interface using android from android I want to call the methods of ...
1
vote
1answer
468 views

How to get deposits confirmation

I am using Web3j and I want confirmation for deposits in user wallet. Is it possible if yes how can I do this using Web3j
1
vote
2answers
2k views

How to make transaction using private key and address using web3j

I have a private key and address . Is it possible to make transaction with these parameter using web3j.
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(...
1
vote
1answer
596 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, ...
1
vote
1answer
528 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 ...
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 ...
1
vote
1answer
474 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 ...
1
vote
1answer
338 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
732 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 ...
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 { ...
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 ...
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 ...
1
vote
0answers
23 views

Not able to decode the input data from transaction using web3j (Java)

I am creating transactions using web3j and passing some private data in that transaction. The transaction is also getting mined . I have subscribed to the mined blocks, where I am fetching the ...
1
vote
1answer
37 views

How to decode InputValue of ethereum using java web3j

**I'm trying to decode the inputValue of an transaction using web3j without using any contract abi and wrapper class,Im loading the contract using its contract address ,is there any way/inbuilt ...
1
vote
1answer
31 views

how can i fetch all the tokens from ethereum network to my wallet ?using web3js(nodejs) or web3j(java)?

I'm trying to fetch all the available tokens from ethereum network into my android wallet but could not able to find an suitable solution other than web scrapping
1
vote
0answers
38 views

Web3J - how to perform two identical transactions in a row?

I have a contract being an ERC-20 token. I want to perform two idendical transfers (sender, receiver and amounts are the same). I am using the contract objects from Web3j: MyToken token = MyToken....
1
vote
1answer
46 views

How to get events on android with infura?

I am developing an app on Android, but Web3j does not support events on infura ( Should I use Infura with Web3j for Event filter? ) . What are the options, I did not find any alternative library?
1
vote
0answers
52 views

How to achieve inheritance support using web3j wrapper?

I have two types of smart contracts. One parent contract to store the type and other child contracts which inherits the parent contract. The problem is, I can't generate java wrapper class (...
1
vote
1answer
28 views

Using contract to create Child contracts (web3j Java wrapper)

I have a simple Parent contract that creates child contracts and stores their address. contract Parent { address[] public registry; function createChild () public { address newChild =...
1
vote
0answers
64 views

Using web3j with infura returns null

I've used web3.js to handle my contracts, and it worked very well. But web3j is pretty hard for me since the beginning. I'm using android studio, infura, web3j. Since I don't know very much about ...
1
vote
0answers
60 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
1answer
96 views

Can I send data (e.g. text) in a Transaction with Web3J?

I need to send a transaction from an account to another one via Web3J that includes not only the value field but also the data field (in particular, I need to send text). Is it possible?
1
vote
0answers
32 views

Trouble with personalUnlockAccount,web3j

I am creating android dapp for votings I am trying to check if user's credentials are right,so i use object of PersonalUnlockAccount class and function accountUnlocked().So the problem is that when i ...
1
vote
0answers
97 views

Subscribe to changes in contract balance (Web3j)

Using web3j I would like to subscribe to changes in a contract balance i.e deposits and withdraws. I would like to base this subscription over transactions (and not events) since the contract does ...
1
vote
0answers
217 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()....
1
vote
0answers
89 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
1answer
131 views

web3j event listening on android project

I trying to listen events from smart contract but my code isn't working. what's the problem? Event event = droneChain.UPDATEMISSIONSTATE_EVENT; String encodedEventSignature = EventEncoder.encode(...
1
vote
0answers
250 views

How to encode tuple as input parameter to function using web3j

I am attempting to call a solidity function that looks something like the following: function fillOrder( Order memory order, uint256 takerAssetFillAmount, bytes memory signature ) Using ...
1
vote
1answer
160 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
0answers
78 views

Web3j no transaction pooling with REST

I have setup an application with jhisper gateway with one microservice in REST linked to Web3j. Idea is when you store an object in the database, you notarize it in a private ethereum blockchain. So, ...
1
vote
0answers
18 views

necessity of mining while doing transaction [duplicate]

While doing any transaction in private network, is it necessary for one node to keep on mining?. I was trying to implement to deploy smart contract and transact in ethereum private network with the ...
1
vote
0answers
67 views

Web3J - Creation of Light Wallet takes too long

I am creating the wallet in my Android app, using the library Web3j: https://web3j.io/ See the code: String seed = UUID.randomUUID().toString(); ECKeyPair exKey = Keys.createEcKeyPair(); WalletFile ...
1
vote
1answer
43 views

Contract NOT created when using “new” on testnet

I've got a contract which one of his functions creates a new contract in the following manner: (Solidity) function createCarrier() public { P2Carrier newCarrier = new P2Carrier(msg.sender); ...
1
vote
1answer
412 views

How to create wallet with web3j and web3swift like with web3js web3.eth.accounts.create(); function?

With web3js v1.0.0 you can create accounts with web3.eth.accounts.create(); and access the public address and private key with newWallet.address and newWallet.privateKey. How can you do this with ...
1
vote
0answers
112 views

Filtering blocks on basis of transaction logs in web3j

I want to filter blocks on the basis of a log present inside transactions. How can I do that? I don't have any contract address and want to filter all the blocks generated by all the contracts. ...
1
vote
1answer
1k views

how to get the status of a transaction which is not mined and pending

I used the following code to send a transaction and get transaction status.However, sometimes the transaction is not minded at all. But the transactionReceipt get the same value "NULL" for both of the ...
1
vote
0answers
225 views

Getting ClassCastException while creating wallet

Always getting this exception when I am creating new wallet file java.lang.ClassCastException org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPrivateKey cannot be cast to org.bouncycastle.jcajce....
1
vote
0answers
372 views

How to subscribe to future incoming ERC-20 token events?

I'm using web3j to subscribe to my ERC-20 token transfer events with transferEventObservable: humanStandardToken.transferEventObservable(DefaultBlockParameterName.EARLIEST, DefaultBlockParameterName....
1
vote
0answers
131 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
287 views

Get and Set values of Contract remotely via Web3j returns 0 and null

I have my two Quorum nodes setup on two different machines A(X.X.X.1) and B(X.X.X.3) and I am trying to interact with the smart contract from a different machine C(X.X.X.4) via Web3j. Below is the ...
1
vote
0answers
261 views

String returned from mapping of struct array

I want to store some details from every transaction. These are the struct and the variable: struct MoneyTransfer{ address sender; string comment; uint creationTime; uint quantity; } ...
1
vote
1answer
830 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://...
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
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
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 ...
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")...