Questions tagged [web3j]

Lightweight Java and Android library for integration with Ethereum clients

Filter by
Sorted by
Tagged with
0
votes
1answer
4 views

Invalid parameters: must provide an Ethereum address

Uncaught (in promise) {code: -32602, message: 'Invalid parameters: must provide an Ethereum address.'} (anonymous) @ index.js:64 setTimeout (async) _fireError @ index.js:63 o @ index....
0
votes
1answer
5 views

Unable to resolve host "ropsten.infura.io" android exception [closed]

this code throw an exeption : Unable to resolve host "ropsten.infura.io" I don't know where is the problem There is the code : import androidx.appcompat.app.AppCompatActivity; import ...
0
votes
1answer
12 views

android web3j.build() error

The problem I am is that web3j's build symbol is not being recognized. It appears even though adding in the dependency does not work. In the build.gradle I have added the line "implementation ('...
0
votes
0answers
6 views

Can I verify if given address is a correct ETH address using web3j/Java?

Is there a possibility to verify if given String is a correct Ethereum address? I have found out that there is a possibility to do that using web3js I can do either: web3.utils.isAddress('...
2
votes
0answers
50 views
+50

How to verify signature on server backend with web3j?

I am sending an EIP_712 signature from metamask to the java backend (web3j) and I need to verify it on backend java application. In this topics it is discussed the support of EIP-712 in java (web3j): ...
1
vote
1answer
13 views

web3j cant connect to localhost or bsc network

Issue_title how to connect bsc test network and localhost:8545 Issue_description here is my load contract code PerformanceToken contract = PerformanceToken.load( this.contractAddress, ...
0
votes
0answers
9 views

How to avoid handling private keys when minting tokens using web3j?

I am able to use web3j to successfully mint NFT. However, in this process, I need to provide the public and private keys as credentials. Web3j web3 = Web3j.build(new HttpService(ENDPOINT)); ...
0
votes
0answers
21 views

Minted NFT's in Rinkeby show up automatically in marketplace collection?

I minted a few NFT's in the Rinkeby testnet using web3j. When I open my OpenSea account I immediately see it in my collection without having to do anything. The same happens when I connected to ...
0
votes
1answer
7 views

compare uint from datestamp always return true

function testDate(uint date1,uint date2) public returns (bool) { require(date1 == date2,'not same date') return date1 == date2; } let res = await TestSol.testDate.call(‘1630972800’,‘1631145600’)...
0
votes
1answer
46 views

How to send transaction to payable contract on Binance Smart Chain without Metamask

Suppose there is a live contract (on live network, not test network) out there on Binance Smart Chain and it has a payable function that I want to use. I want to use web3 to send a transaction and ...
0
votes
1answer
36 views

web3j - Unable to call a function that returns tuple[]

I am relatively new to interacting with smart contracts in java and I am facing a problem while trying to retrieve a tuple[] returned by the smart contract function. Here is the ABI definition of the ...
0
votes
0answers
15 views

Web3j ws for unconfirmed transactions repeat some transactions

I am running a Geth (1.10.8) node synchronised with Goerli network, and a Java application using web3j (5.0.0) to consume transaction flowables coming from the node. web3j.pendingTransactionFlowable()....
0
votes
0answers
12 views

Connecting two Ubuntu Virtual machines on private Ethereum network, can't get the two nodes to read each other

I am trying to connect two ubuntu vm as two ethereum nodes using geth. Addpeer doesn't work and bootnode isn't responding to one of the VMs. Note that I ssh accessed the other VM and can telnet the ...
0
votes
1answer
45 views

Get the same result of abi.encode function in Java

let say we have the following function in solidity: function tryAbiEncode (address _address, uint8 _amount) public pure returns (bytes memory) { return abi.encode("\x19Ethereum Signed ...
1
vote
0answers
31 views

Error processing transaction request: Number can only safely store up to 53 bits

I have the following code (in clojure): 212 (def CGP 213 (reify ContractGasProvider 214 (getGasPrice [_ contract-func] (BigInteger. "1")) 215 (getGasLimit [_ contract-func] (...
1
vote
0answers
52 views

Error in Ropsten: The network id specified in the truffle config (3) does not match the one returned by the network (1)

There are similar questions but I could not find the solution. maybe because smart contract tools are developing so fast. here is the setting for ropsten in truffle config. ropsten: { ...
0
votes
1answer
27 views

transactions signed always reverted

I don't know how to send a signed transaction against a method payable in Ganache, can someone help me??? When I call the method in Remix it works fine but from Java I get the Hash of the transaction ...
0
votes
0answers
67 views

ETH/BSC Transaction subscribtion

Im connecting to BSC websocket with: let options = { filter: { value: [], }, fromBlock: 0 }; myContract.events.Transfer(options) .on('data', event => console.log(event)) ...
1
vote
1answer
127 views

Encoding ABI function signature in Java using web3j?

Is there a generic way to simply take an ABI function, something like: { "name":"foo", "inputs":{ "interalType":"uint256", "...
0
votes
1answer
437 views

How to sign transaction from frontend with metamask and then send that signed data to rest api for submitting the transaction?

I have a front end connected with metamask wallet and a rest API layer. My requirement is to sign the transaction from metamask and then to send the signed transaction to rest api to submit the ...
1
vote
1answer
69 views

Raw transaction with web3j, tx hash is always null

I'm trying to send raw transaction with Web3j, to call a smart contract function. I try to set very high values for gas to avoid problems with it. But I always get a null tx hash. What is wrong in my ...
0
votes
1answer
68 views

How to access already deployed Smart Contract using Java?

I would like to get information about token. For example total supply and so on. For this I need the contract. However what is the way to actually load it/access it from Java? Checking examples in ...
1
vote
0answers
58 views

Web3ProviderEngine does not support synchronous requests on deploy to private network

I know there are many similar questions, but I've been through all of them and haven't got the answer I'm looking for. I'm trying to deploy a smart contract (that's already been compiled and deployed ...
0
votes
0answers
10 views

Can't invoke a method in a public contract from another contract inside a privacy group using web3j

This is the contract that resides in a privacy group: pragma solidity 0.7.4; import "./Coin.sol"; contract PrivateTransfer { Coin coin; constructor(Coin _coin) { coin = ...
0
votes
1answer
115 views

Delay between IPC transaction call and submitting to mempool

I encountered a problem, where a web3j transaction was successfully submitted via IPC call and yet, it was not submitted to mempool for another 40 minutes. Etherscan did not show the TX as pending and ...
1
vote
0answers
41 views

How do I get the transfer/transaction history of an erc20 token using web3j givin an address

I am not sure how to view the the txhistory of an erc20 token for a specific address. I use a java token wrapper for my erc20 toke as below: public class ERC20 extends Contract { public static final ...
0
votes
1answer
104 views

How to get Ether in private blockchain?

Fast summary: Need a faucet-like funcionality in my private blockchain to give Ether to the newly on-demand created wallets from Android Dapp. I'm working in a project where I've deployed a totally ...
5
votes
1answer
1k views

How to point web3j to other networks such as BSC?

I would like to use web3j and to execute the functions of contracts that are found on Binance Smart Chain. How is this done ? Would it be just Web3j web3 = Web3j.build(new HttpService("https://...
1
vote
1answer
150 views

Retrieve public key of an address to verify off-chain signatures

I have a question regarding use of keys in Ethereum for signing requests/data OUTSIDE of Ethereum. Let's say I have a regular Ethereum EOA with an address and keypair. I now want to have a piece of ...
1
vote
0answers
174 views

eth_estimateGas Error when balance of an account < the amount to send in a transaction

I have used the following request to estimate gas in an ETH transaction in Ropsten. ## JSON-RPC over HTTPS POST curl https://ropsten.infura.io/v3/YOUR-PROJECT-ID \ -X POST \ -H "Content-...
1
vote
1answer
243 views

How to specify Solidity version in web3j?

I have a simple java maven project whose pom.xml looks like: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" ...
0
votes
1answer
132 views

Execution Reverted Details

I am writing code in Java and trying to calculated potential gas units, for a function call on my methods. I am trying to do so by using infura as a provider for my web3 Instance, and then created a ...
0
votes
1answer
375 views

How do i import my ethereum wallet just using private key?

Help me out how do i resolve the issue of ethereum smartcontract for getting my wallet when i enter my private key in the text area Use WalletUtils functionality The WalletUtils class can be used to ...
0
votes
0answers
21 views

Development of ethereum payments system

I'm in need of some help! I'm developing a project where I'm supposed to implement an ethereum payment system that will then be installed in a point of sale (POS) in a retail store. The idea is not to ...
1
vote
1answer
1k views

How to use Web3j call Multicall Contract?

I need to use Multi Call contract to merge multiple calls,Its address on the mainnet is 0x2cc8688C5f75E365aaEEb4ea8D6a480405A48D2A contract Multicall { struct Call { address target; bytes ...
0
votes
0answers
94 views

org.web3j.protocol.exceptions.ClientConnectionException: Invalid response received: okhttp3.internal.http.RealResponseBody

Environment Android Studio Infura – Rinkeby test network Web3J Metamask Rinkeby.etherscan.io I am trying to build an Android app to read and write smart contract by following the medium article: ...
1
vote
2answers
82 views

TransactionException: Cannot unmarshal invalid hex string when deploying contract in web3j

I have a java server that uses web3j library with geth as the provider. When I tried to deploy my contract on my private test net. I got this error: org.web3j.protocol.exceptions.TransactionException: ...
0
votes
1answer
226 views

Web3j generate command not running

I am trying to generate a java wrapper class for a solidity contract, I have compiled the file and have the abi and bin file, but when I run the command as follows: web3j solidity generate ...
1
vote
1answer
167 views

web3j command-line does not recognize flags

I am trying to run the command such as web3j solidity generate -b SimpleBank/SimpleBank.bin -a SimpleBank/SimpleBank.abi -o ~/IdeaProjects/quiknode/src/main/java/ -p com.simplebank Found here: https:/...
1
vote
1answer
39 views

How to properly close web3 after execution? - Java

Here is what I am trying to do: String amt = Web3j.build(new HttpService("https://ropsten.infura.io/v3/123blahblah")) .ethGetBalance("0xblahblah", DefaultBlockParameterName.LATEST) ...
1
vote
0answers
197 views

org.web3j.protocol.exceptions.ClientConnectionException: Invalid response received on web3j on Android

I am trying to execute transactions by calling my RegisterNewUser function in the deployed smart contract through Android and I am using Infura. However, when I run, there is an error as seen below : ...
1
vote
1answer
51 views

Unable to executive function of smart contract on android studio java file

I am trying to execute some functions of my deployed contract in Android Studio through a Java file. I have generated Java Wrapper files. However, when I run Android Studio, there is no data added to ...
0
votes
0answers
123 views

Cannot generate java wrapper class from contract

currently I am trying to generate a java wrapper contract from my smart contract. The command I use is as seen below : web3j truffle generate --javaTypes C:\Users\name\Documents\test\...
1
vote
0answers
215 views

Verifying ethereum message signatures with java

I am using web3j to verify message signatures but there are some false negative results. For example this signature should be right, but it seems like the address could not be recovered: final ...
1
vote
0answers
15 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, ...
0
votes
2answers
363 views

Contract Call has been reverted by the EVM with the reason: 'execution aborted (timeout = 5s)'

I defined an array of objects in the Ethereum smart contract. An object is a structure that is inserted into the array every time a function is called.When 80,000 data is inserted, it takes a long ...
4
votes
2answers
1k views

Problems calling Smart Contract function in Java using Web3j

I am rather new to writing/using smart contracts in Java and I am currently trying to use my smart contract. I already wrote and tested it, compiled it, deployed it to Ropsten, and built my Java class ...
1
vote
0answers
97 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
1answer
88 views

How to catch a solidity event from Java

I am trying to make a decentralized android application. It is an online two player Tic-Tac-Toe game. I have implemented the back-end with solidity and a part of the front-end in android studio. ...
1
vote
0answers
72 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
2 3 4 5
8