Questions tagged [web3j]

Lightweight Java and Android library for integration with Ethereum clients

web3j is a lightweight, highly modular, reactive, type safe Java and Android library for working with Smart Contracts and integrating with clients (nodes) on the Ethereum network.

https://github.com/web3j/web3j

424 questions
8
votes
3 answers

How to create accounts and also retrieving the ether balance with web3j in a java file?

I do not see anything in creating accounts and retrieving ether balance in web3j's documentation, I wonder if it is possible.
TerenceT
  • 105
  • 1
  • 1
  • 7
4
votes
2 answers

I am using web3j and geth. How to create default accounts with some ether allocation to it?

I need a default account with huge ether allocation. This I need to set up manually in genesis.json Hereafter,all accounts need to be created dynamically in java, and they should also be given some default funds. I tried this using web3j, but its…
Twinkle Shine
  • 129
  • 1
  • 12
3
votes
1 answer

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 ->…
eyang
  • 31
  • 2
2
votes
2 answers

Get function returned 2 values in Web3j

I wrapped a smart-contract generated in remix into a Java Project. Im trying to get the two values that return me this function. function getValues(address _a) external returns(bool, uint32) { uint32 n= data[_a].number; return (true,…
UnexpectedCharacter
  • 852
  • 1
  • 11
  • 30
2
votes
2 answers

how to get latest block number using web3j java APIs

I ask the network for current balance of the address i want to keep track. after that i want to detect/listen incoming deposits starting at the latest block number at the start of my program/server. now the problem is how to find the latest block…
hd312
  • 81
  • 1
  • 3
2
votes
1 answer

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, recipient, amount, Convert.Unit.WEI) …
yemista
  • 141
  • 7
2
votes
1 answer

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 { web3ClientVersion =…
undefined
  • 151
  • 6
2
votes
1 answer

Insufficient funds error on deploying smart contract

I am writing a Java program to deploy a smart contract. I have created the Java Wrapper class. This is the essence of the code. static final BigInteger GAS_PRICE = BigInteger.valueOf(20_000_000_000L); static final BigInteger GAS_LIMIT =…
2
votes
0 answers

Filter events with multiple allowed topic values

I'm building a contract listener. I am only interested in 1 particular contract, let's say at address 0x123...789. final EthFilter filter = new EthFilter(DefaultBlockParameterName.LATEST, null, "0x123...789") All events emitted by this contract have…
lizardev
  • 73
  • 4
1
vote
0 answers

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.load(tokenAddress, web3j, credentials,…
Piotrek M.
  • 111
  • 1
1
vote
0 answers

JVM waits for some timeout every time when I load a Smart Contract using Web3j In Java

Initially I had a problem with the Web3j object, but after explicitly calling its shutdown method everything works fine (JVM quits immediately, so my application closes). The problem occurs when I call load(...) method of any Smart Contract. For…
Bogdan
  • 41
  • 5
1
vote
2 answers

Where is the ethLogObservable method in Web3j?

I can´t find where is the Web3j ethLogObservable method. I can´t find in GitHub repo
UnexpectedCharacter
  • 852
  • 1
  • 11
  • 30
1
vote
3 answers

How can i read symbol and name of the token in transaction?

How can i read symbol and name of the token in transaction? I tried to decode input data from transaction, but it wasn't success. the latest Web3j does not have toAscii method in java. Should i use parity tracer for this? What advantages of…
1
vote
0 answers

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, I have a REST Post service to create the object…
flefevre
  • 11
  • 2
1
vote
1 answer

How to do asynchronous callback in web3j?

My application is dealing with high speed RPC requests, so it cannot reply on synchronous blocking call to process requests. It wants web3j RPC calls to return tx hash immediately without blocking and invoke callback later after RPC completion. Can…
sinoTrinity
  • 377
  • 2
  • 8
1
2 3