2022 Developer Survey is open! Take survey.

Questions tagged [web3j]

Lightweight Java and Android library for integration with Ethereum clients

Filter by
Sorted by
Tagged with
0 votes
0 answers
10 views

How to Export public key from Metamask

【Front】 const keyB64 = await window.ethereum.request({ method: 'eth_getEncryptionPublicKey', params: [accounts], }); const publicKey = Buffer.from(keyB64, 'base64') ...
user avatar
0 votes
0 answers
12 views

fetching metadata from Ethereum

I've been struggling using web3j for getting metadata or details like name, description, and properties like the image shown bellow. I know that using web3 will be similar like export async function ...
user avatar
0 votes
0 answers
7 views

How do I use Mapping as a filter to return specific values in my struct?

I have a struct in my smart contract, that stores tokens in two different statuses, either as an unassigned gifts or as an assigned gifts. I would like to configure my mapping as a filter to return ...
user avatar
  • 107
1 vote
1 answer
12 views

What `to` should be set when deploying contracts?

I'm deploying contract using eth_sendTransaction and compiled bytecode. So for example my transaction is: { from: "0x0000123...", data: "0x6000...", gas: "0x9999"...
user avatar
  • 81
0 votes
0 answers
11 views

What's the proper way to update your metadata?

I'm trying to build NFT game where I'm going to upgrade NFTs attributes based on in-game activity achievements, I've googled around, but couldn't find a solution, so my question is how can I make ...
user avatar
0 votes
1 answer
17 views

Connection reset when reading from socket from geth

Hi I am getting a connection reset when using the latest geth. I am working on a laptop with latest windows 10 pro with updates. I and using latest WSL and installed with it ganache and geth. I am ...
user avatar
0 votes
1 answer
24 views

yul get abi file

Normally, when you compile a solidity file for Web3j, you need a bin and abi file. The command for this is solc <contract>.sol --bin --abi --optimize -o <output-dir>/ To compile a yul ...
user avatar
  • 3
0 votes
0 answers
18 views

Can i create multiple web3 filter ? At least 10000 filter for checking deposit to adderess

We have more than 10000 ethereum wallet addresses and I want to keep track of crypto deposit to the wallet addresses. What should I do ? Should I create 10000 web3 filter for checking deposit to that ...
user avatar
0 votes
1 answer
29 views

How to track the crypto payment made to specified address on ethereum?

I have created different ethereum wallet address for each user registred on exchange . Now the problem is user can deposit crypto at any time and we have to reflect the balance in user account and ...
user avatar
0 votes
2 answers
860 views

How to get list of NFT collection holders

I'm new to this web3 world (but with experience of backend skills) I would like to start a new Solidity project that gets an NFT collection as input and returns a list of all current holders. Any help ...
user avatar
0 votes
0 answers
55 views

web3j: how to estimateGas before sending transaction

I am working with web3j, and I have the following code to send a transaction and get its receipt: TransactionReceipt mr = contract.mintTo(WALLET1_ACCOUNT1_PUBKEY, tokenURI, tokenId).send(); But I ...
user avatar
1 vote
1 answer
183 views

Transferring ERC721 tokens with web3j using an operator

I've been struggling using web3j (the web 3 Java library, not JS) transferring ERC721 tokens from one user to another, using an operator. I get that we need to approve the operator from the user that ...
user avatar
  • 11
0 votes
1 answer
42 views

Approve the contract to send the Tokens

error is coming 'token is not own' what i did. I approved the contract to spend tokens from the token owners account lets say account A approved the contract address function _setApprovalForAll( ...
user avatar
0 votes
0 answers
15 views

How to call approve function of erc721 with contracts address instead of msg.sender?

I know the parameters to call approve to give permission to others but i want to know how to call approve function using contract address instead of msg.sender
user avatar
1 vote
1 answer
65 views

How to sign text message using public key in web3j?

I can sign a text message using public key in web3js const signature = await this.web3.eth.personal.sign( loginMessage, publicAddress, "" ) What ...
user avatar
0 votes
1 answer
97 views

Unmatched arguments from index 2 while trying to generate java wrapper class web3j

I am trying to create wrapper class for my smart contract using standard command web3j truffle generate build\contracts\PKCoin.json -o src\main\java\ -p com.example.polygontestapp but keep getting ...
user avatar
  • 137
0 votes
0 answers
77 views

How to trace a token adress from an ERC 721 transfer transaction?

I have an Ethereum node which I connect using web3j library. In the code I iterate over transactions of a particular block and try to fetch information about ERC721 transfers. In particular, I want to ...
user avatar
0 votes
1 answer
74 views

org.web3j.protocol.exceptions.ClientConnectionException: Invalid response received: 403; error code: 1020

I have very simple java code using web3j library. I am using mumbai test network for polygon. After calling String chainId = web3j.netVersion().send().getNetVersion(); line I get error that is written ...
user avatar
1 vote
1 answer
228 views

Error while using ERC-20 java library: "only replay-protected (EIP-155) transactions allowed over RPC"

I am trying to make simple transaction using ERC-20 java library. I use mumbai test network for polygon. Code transfers stablecoin from one wallet from another. During approve method call I get ...
user avatar
1 vote
0 answers
27 views

Web3j How to Load Bip32ECKeyPair from xprivate_key and xpublic_key

I've used PyWallet from (https://github.com/ranaroussi/pywallet) to create an HD Wallet for Ethereum { "coin": "ETH", "seed": "virtual option economy rose hello ...
user avatar
0 votes
0 answers
105 views

Can't import chainlink using web3j

I am making simple contract using AndroidStudio and Java.In my contract i am using import statement: import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; but when i ...
user avatar
  • 137
1 vote
1 answer
47 views

Function balanceOf is not constant issues

when i am trying to get erc20 balance of an address from smart contract getting balanceOf is not constant issue. myContractInstance.balanceOf("0x2cdfa0382bc9c43bdf645baf14d90aecc8a6ce5a") ...
user avatar
0 votes
0 answers
18 views

Estimating Transfer Fees to Kraken ETH Deposit Addresses

I am sending ETH via web3j code. Before transferring I estimate the transaction using the web3j.ethEstimateGas(transaction) method. Transaction transaction = new Transaction( sourceAddress, ...
user avatar
  • 101
0 votes
1 answer
135 views

Monitor for all events

It is possible to monitor for all events that happens on Ethereum network or Binance Smart Chain network (BSC). I know that would be a lot of data however I would like later to filter that data. If ...
user avatar
  • 101
1 vote
1 answer
55 views

Should same contract address be same for multiply users?

OK i know that this is silly question but cant wrap my head around smart contracts .I am using web3j to make a simple android dapp. It should have add deposit, withdraw deposit and get current amount ...
user avatar
  • 137
1 vote
1 answer
110 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 ...
user avatar
  • 11
1 vote
0 answers
145 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 ...
user avatar
  • 584
1 vote
0 answers
66 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)...
user avatar
  • 113
0 votes
0 answers
56 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 ...
user avatar
  • 21
0 votes
0 answers
101 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 ...
user avatar
  • 101
1 vote
0 answers
19 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 ...
user avatar
0 votes
0 answers
43 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= ...
user avatar
0 votes
1 answer
227 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 ...
user avatar
  • 1
1 vote
0 answers
63 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/...
user avatar
1 vote
0 answers
98 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 ...
user avatar
0 votes
0 answers
136 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 ...
user avatar
0 votes
1 answer
768 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....
user avatar
1 vote
0 answers
123 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('...
user avatar
  • 131
2 votes
0 answers
358 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): ...
user avatar
1 vote
1 answer
234 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, ...
user avatar
0 votes
0 answers
121 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)); ...
user avatar
0 votes
0 answers
491 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 ...
user avatar
0 votes
1 answer
20 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’)...
user avatar
0 votes
1 answer
586 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 ...
user avatar
  • 157
0 votes
1 answer
305 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 ...
user avatar
0 votes
0 answers
64 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()....
user avatar
  • 101
0 votes
0 answers
19 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 ...
user avatar
0 votes
2 answers
422 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 ...
user avatar
1 vote
0 answers
56 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] (...
user avatar
1 vote
0 answers
132 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: { ...
user avatar
  • 491

1
2 3 4 5
8