Questions tagged [web3j]

Lightweight Java and Android library for integration with Ethereum clients

Filter by
Sorted by
Tagged with
1
vote
3answers
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
2answers
1k 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
2answers
2k views

Why is my web3j wrapper failing to generate?

I've created a smart contract in solidity which I've compiled with solc into a .bin & a .abi file. However, when I run the generator on the .abi and .bin files it returns a JSONParseException ...
1
vote
2answers
2k views

Creating an account using web3js or web3j

I am trying to create account on ethereum private network using web3js from front end. I have written the below lines in my js file. The createAccount() gets called from an HTML page web3 = new Web3(...
1
vote
1answer
39 views

How to subscribe to transaction with a smart contract in web3js?

I am trying to write a web3js code. I have already written it using web3j (java) and now i want to do exactly same thing but using web3js. I have seen documentation and stuff, but i am not able to ...
1
vote
1answer
235 views

raw transactions to send ERC20 token fails on private network(POA)

I am trying to transfer ERC20 tokens on private ethereum network(POA) Transaction flow: raw tx object creation on backend. { "gasLimit": 37000, "gasPrice": 4000000000, "...
1
vote
1answer
92 views

Unable to load smart contract using web3j on android

What I'my trying to do is to load already deployed smart contract and interact with it. The problem is that after my credentials are being created properly, the error is being catched but the message ...
1
vote
1answer
405 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(...
1
vote
1answer
129 views

How to get the txHash of a transaction?

I have this method where I make a transaction to the network rinkeby, but to know how I can get the hash of the transaction made. I am using java with web3j, in addition to using infura to connect to ...
1
vote
2answers
334 views

web3j: EthSendTransaction.sendTransaction() is throwing “Error processing transaction request: Invalid params: invalid format”

I am trying to send a transaction to an address: 0xDD210......... using the EthSendTransaction.sendTransaction() method from the org.web3j.protocol.core.methods.response.EthSendTransaction library. ...
1
vote
1answer
547 views

web3j.ethSendRawTransaction wait until the transaction is successfully mined - Web3j

Im trying to send 0 ether to the same account with Web3j, however when i run this code it give me directly the transaction hash, even if the transaction has not been mined yet and still pending. I can'...
1
vote
1answer
150 views

Value returned by a getter from smart contract instead of uint : org.web3j.protocol.core.RemoteCall@5104cf00 - spring boot - web3j

pragma solidity ^0.4.18; contract MyDeal { /// The seller's address address public owner; /// The buyer's address part on this contract address public buyerAddr; /// The Buyer struct ...
1
vote
1answer
51 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
312 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
853 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
2answers
2k 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
1answer
537 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
533 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
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
659 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
530 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
357 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
864 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
895 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
680 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
2answers
775 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
10 views

Contracts invoked asynchronously are not packaged as transactions [closed]

I use the sendAsync() method to call the contract asynchronously. If I loop through the method several times, without using get(), the number of packaged transactions is less than the number of calls, ...
1
vote
0answers
21 views

Ethereum account for HD Wallet key generated with xpub key only using bitcoinj

Accordingly to the BIP32/BIP44 specification recommendations I generating HD Wallet addresses using bitcoinj library (DeterministicKey instances) with the path like M/44'/60'/0'/0/0 using xpub key ...
1
vote
0answers
16 views

smart contract Thether balanceOf method returns 0x

i used web3j-java call Tether contract method balanceOf(the server node is mine , and on ether mainnet),my address has 3USDT,but i call balanceOf , the node returns me 0x as the balance value,it is ...
1
vote
1answer
41 views

Error processing transaction request: already known

I'm developing an application with which you can make ERC20 token transfers. When you make transfers from one account to another with a reasonable time between transfers it works correctly. But when ...
1
vote
0answers
15 views

How can i get the name of an emitted event through the event abi (log entry, topics) of solidity?

I want to get the name of an emitted event from my contract using the event abi and web3j. This is the contract i'm using as an example for this question: pragma solidity ^0.5.7; contract ...
1
vote
1answer
298 views

How to get contract object using ABI json and address with web3j?

I worked with web3js(JavaScript) and used web3.eth.Contract with 2 params (json, address) and successfully got contract object. Now I started to work with web3j(Java) and don`t understand how I have ...
1
vote
0answers
46 views

How can I calculate gas price and gas limit programmatically using web3j [duplicate]

I am using following code to deploy my smart contract but now my transaction is taking too much time to mine on my private blockchain. String contractAddress = myContract.deploy(web3j, credentials, ...
1
vote
0answers
22 views

Simple way to balance web3j connections between nodes

Context: I have a client that can connect to 3 local-network nodes to distribute query-loads and be more resilient to network/software issues. I have managed to create a -simple- watch-dog with a ...
1
vote
0answers
93 views

Transaction receipt was not generated after 600 seconds for contract transaction

I use SimpleMultiSig to generate java code with web3j. When I call the execute() function after 600s throw the error org.web3j.protocol.exceptions.TransactionException: Transaction receipt was not ...
1
vote
0answers
23 views

Not able to fetch custom token after mint from Infura

I am using web3j library with an Infura Websocket connection. I set up a subscribe method where I listen to transfer events of my custom ERC20 Token. When a transfer event occurs on the blockchain I ...
1
vote
1answer
113 views

org.web3j.abi.datatypes.Utf8String cannot be cast to java.lang.String

I have a problem when get string value from smart contact: pragma solidity >=0.4.22 <0.7.0; pragma experimental ABIEncoderV2; contract Election { // Model a Candidate struct Candidate {...
1
vote
0answers
73 views

TransactionException: Transaction has failed with status: 0x0. Gas used: 50434. (not-enough gas?)

I’m new to ethereum and have small experiance with write contracts (in solidity). I think I have a very simple question but is very hard for me. I wrote a contract to manage erc20 tokens. Most ...
1
vote
0answers
106 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
246 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
2answers
240 views

Unable to invoke smart contract function from Web3j contract wrapper

I've been learning about interacting with smart contracts through Android and the Web3j framework but have run into an issue. I'm trying to mint an ERC721 token and send it to an address but it doesn'...
1
vote
1answer
41 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
1answer
616 views

How estimate GAS from a contract call with Web3j

I'm trying to estimate gas cost of a contract call, i need to send a string to a contract, but i need to see if i overtook the GAS limit. I'm trying like this: Transaction t = Transaction....
1
vote
0answers
64 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
89 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
65 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
92 views

getWeb3ClientVersion() returns null

I'm trying to create an android Dapp by using the web3j library. I'm using connection to a local private Ethereum blockchain. When I'm trying to display the Client version it returns null. This is the ...
1
vote
1answer
49 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
43 views

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 ...

1 2
3
4 5
7