Questions tagged [web3j]

Lightweight Java and Android library for integration with Ethereum clients

Filter by
Sorted by
Tagged with
1
vote
0answers
15 views

How To Specify ChainID

I am interacting with the Harmony testnet using web3j, but since Harmony has 4 shards i also have to specify the chainID, otherwise it throw an error. When writing to the blockchain i was able of ...
0
votes
0answers
16 views

Can I get the IPFS hash from file (without uploading it & with java)?

As far as I'm concerned IPFS client uses the resulting SHA-256 hash from files, and also compatible with others, to index them in the IPFS Protocol. My problem is that I'm not sure how to consistently ...
0
votes
0answers
14 views

Is it possible to get revert reasons using CallContract method? If not how can I get revert reason using ethClient in go Ethereum?

I'm using the below functions to get the revert reason : func ErrorReason(ctx context.Context, from common.Address, tx *types.Transaction, blockNum *big.Int, ethClient ethclient.Client) (string, error)...
0
votes
0answers
17 views

Generating a new web3j erc20 projects fails

I've tried to generate a new web3j project with the cli using web3j new erc20. However the generation fails and the log provides the following error: "Source file requires different compiler ...
0
votes
0answers
20 views

web3j Smart Contract function call -> Could not construct a recoverable key. Are your credentials valid?

I deployed a smart contract on Mumbai / Polygon Testnet and Managed to create Java Web3j Wrapper for this Smart Contract. I'm able to load the smart contract and call the function balanceOf for any ...
1
vote
0answers
7 views

Trouble implementing ERC20 payment service in android application

I have been following this tutorial (https://medium.datadriveninvestor.com/a-primer-to-ethereum-token-development-using-java-and-web3j-52b24cc6c403) but seem to keep running into errors when it comes ...
0
votes
0answers
15 views

get transaction hash

I want to know the transaction hash that already done. The transaction is called tr in my code. Credentials credentials=Credentials.create("account address") ; web3= ...
0
votes
1answer
67 views

Web3j, how to correctly byte encode multiple data?

I am interacting with a smart contract and i do not understand correctly how to encode the data using Web3j to interact with the smart contract since I had never interacted with a contract that ...
1
vote
0answers
20 views

Is there a Java equivalent of estimateGas?

I read from many questions (example: How to estimate the cost to call a Smart Contract method?) that web3.eth has a method estimateGas that can provide an estimate of the gas usage of a transaction/...
1
vote
0answers
34 views

Web3j - How to read the contract without credentials?

I'm using Web3j to interact with my deployed smart contract. I've deployed my contract onto the testnet and can interact with it, however using the generated wrapper code, it requires my wallet. Web3j ...
0
votes
0answers
31 views

How to estimate gas price of contract call from a web3j-generated wrapper class?

Let's say I have some code as follows: Web3j web3 = Web3j.build(new HttpService(endpoint)); Credentials creds = Credentials.create(pk); DefaultGasProvider gasProvider = new DefaultGasProvider(); MyNFT ...
0
votes
1answer
64 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....
1
vote
0answers
18 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
128 views

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
66 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
33 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
108 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
10 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
330 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
72 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
26 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
13 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
116 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
37 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
67 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
38 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
122 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
204 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
673 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
115 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
134 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
112 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
14 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
150 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
63 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
123 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
230 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
221 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
310 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
221 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
474 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
22 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
2k 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
112 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
120 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
301 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
194 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
60 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
239 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
2 3 4 5
8