Questions tagged [java]

Java is a general-purpose computer programming language that is concurrent, class-based, object-oriented, and specifically designed to have as few implementation dependencies as possible.

Filter by
Sorted by
Tagged with
1
vote
0answers
19 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
14 views

How do I create a dApp with an interface and deploy it online [closed]

I did coding in Java for around an year now. I recently learnt about blockchain and its mechanisms. Now I would like to make an app, for example, an anonymous voting system, on a private blockchain ...
1
vote
0answers
18 views

How can I add an option to pay with cryptocurrency in an android app using Java? [duplicate]

For my college assignment I have been tasked with creating an app that among other things allows a user to pay for services using an ICO Token (ERC20 contract), How do I go about doing this? The ...
2
votes
0answers
85 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
0answers
8 views

Encode String to byte[] to invoke method via web3j

I have a method in a contract that receives a bytes object. Web3J generated code in Java translates it to a byte[] object as parameters. I have the correct String "0x....." thet represents ...
0
votes
0answers
25 views

How can there be multiple FROM addresses in one contract?

As I understood, there cannot be several senders for eth. How to make such a contract? For example, here is a transaction with several addresses, this is a swap, but it's still not clear how: https://...
0
votes
1answer
814 views

How do I add minting functions to my webpage?

I'm looking at adding a mint function on my website so that users can directly mint from my website straight to the contract such as this: https://campfirebear.club/mint is this just written in JS ? ...
0
votes
1answer
58 views

Java Keccak 256 hashing implementation of multiple inputs

What's the best way to achieve the equivalent hashing in Java as below in Solidity? keccak256(abi.encodePacked(arg1,arg2,...))
0
votes
2answers
120 views

how to build Defi app from A to Z

I'm a java developer and a newbie with blockchain. I want to build a simple Defi app with a simple smart contract. please tell me know steps by steps to do that? how to setup environment? which the ...
0
votes
1answer
55 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
33 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] (...
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 ...
1
vote
1answer
133 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
72 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
44 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 ...
1
vote
1answer
255 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
143 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 ...
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 ...
1
vote
2answers
87 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: ...
1
vote
1answer
173 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
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
126 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
243 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
102 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 ...
0
votes
1answer
797 views

Attempting to transfer erc20 token, but keep encountering insufficient funds for gas * price + value

I'm attempting to transfer an erc20 token, but keep running into insufficiant funds for gas * price + value, regardles of how much eth I have, I also have an estimate function which returns a value ...
0
votes
1answer
54 views

How to reliably send transaction via web3j while connection is poor?

I use Transfer.sendFunds(Web3j, Credentials, BigDecimal, Convert.Unit) to transfer money. Usually I convert it to flowable. Flowable/RemoteCall completes when transaction is included in block (...
0
votes
0answers
54 views

Ethereum address(generated) and ecrecover computed address is not matching

I created the Ethereum address by following the below steps . 1. Generated a public key(ECDSAsecp256k1) from HSM. 2. Generated a Keeccak256 hash of Q point of ECPublicKeyParameters ...
0
votes
0answers
37 views

where to host my Java web app to fully decentralised?

I need a idea to host my webapp to be on some secure distributed network. my client doesn't want to deployed on aws or gcp. he wants it to be on decentralised network p2p. Your suggestion and advice ...
0
votes
0answers
18 views

org.web3j 4.5.18 ethGetBalance get stuck

I'm using the following simple code in order to obtain the wallet balance: Credentials credentials = Credentials.create(privateKey); web3.ethGetBalance(credentials.getAddress(), ...
0
votes
1answer
163 views

Not able to add 'replayPastTransactionsFlowable' transaction logs result into an collection List object using Web3j java?

I'm trying to create an api where i have to provide transaction logs in json objects but im unable to add result of replayPastTransactionsFlowable into an collection object @GetMapping("/test") ...
1
vote
0answers
613 views

How to get Ethereum transaction list by address in java web3j quickly?

Im trying to fetch transaction logs from ganache using web3j library to send it as an api ,is there any way where i can get all transactions from ganache quickly? @GetMapping("/test") public List&...
0
votes
1answer
278 views

How to use gas price for faster transaction in erc20 transafer event?

I'm trying to provide a customised gas price for faster transaction ,how can achieve that ? Web3j web3 = Web3j.build(new HttpService("http://")); ERC20 javaToken = ERC20.load(contractAddress,...
1
vote
0answers
208 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
503 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
575 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
54 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
0answers
126 views

Curl Request Java - How To

I am looking to use some of the management admin API's found here: https://github.com/ethereum/go-ethereum/wiki/Management-APIs but unfortunately, the web3j library does not support the calls that I ...
0
votes
1answer
492 views

Not able to generate java wrapper class from solidity smart contract using truffle

I'm trying to generate java wrapper class of solidity smart contract using truffle but not getting wrapperclass.java file Here is an command which i've used to generate abi/Json of that contract ...
3
votes
2answers
2k 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....
0
votes
1answer
146 views

Listen to Ethereum transactions

I need to listen ethereum transactions for current count of addresses using web3j. I know that I can use subscribe to get transactions, but how can I add some filter to listen a certain number of ...
1
vote
1answer
85 views

Cryptocurrency payments in Centralized Architecture

I'm new to cryptocurrency, so not sure if I'm asking the right question on this... I want to develop a game with traditional centralized client/server architecture, probably java application server, ...
1
vote
0answers
133 views

Extra mining fees added in etherbase account

1st scenario - I have set miner.setEtherbase(eth.accounts[1]) and gasPrize is 0. 1 coin Transaction - And done transaction from 0th account to one random account. I expect 0 mining fees will add ...
2
votes
1answer
289 views

org.web3j.protocol.exceptions.TransactionException: Transaction receipt was not generated after 600 seconds for transaction

I am sending a transaction through this code public String transferEthByPk(String amount, String toAddress, String privateKey, Web3j web3j) { BigDecimal value = new BigDecimal(amount); ...
1
vote
1answer
200 views

Could someone explain to me the use of the FastRawTransactionManager class?

int pollingInterval = 3000; FastRawTransactionManager fastRawTxMgr = new FastRawTransactionManager(web3j, credentials, new PollingTransactionReceiptProcessor(web3j, pollingInterval, 40)); From what I ...
1
vote
0answers
410 views

Transaction receipt was not generated after 600 seconds for transaction:

I am sending a transaction through this code: txhash = careercertificate .createCertificate(id, fecha, nombre, rutalumno, instituto, rutinstituto, titulo, totalhash, ...
0
votes
1answer
385 views

Can't connect Android app to Ganache using retrofit

I'm have deployed contracts on ethereum blockchain. I have ganache running on server I'm tring to connect to it from android with this code: private BlockChainService() { Retrofit retrofit =...
0
votes
0answers
111 views

Invalid OPCode on passing address parameter through Java wrapper on smart contract using Ganache

I have been facing this issue for some time and I realized there must be a problem with Ganache or maybe someone has any idea why it doesn't work. I have created a very simple contract as below, it ...
1
vote
2answers
1k views

Offline transaction signing with web3j?

I'd like to generate and sign a transaction offline and then send that transaction with a different account. I've found a few web3js sources and I've read the web3 documentation, but I haven't found ...
1
vote
1answer
52 views

Is it worthwhile to store my supply chain product data on the blockchain using a smart contract? [closed]

I'm currently developing an android app that uses the Web3j framework (Java) to interact with my private Ethereum blockchain (running on Ganache). The app is a supply chain tool that will let users ...
0
votes
2answers
441 views

Unable to make a transaction with Data using Java api ethSendRawTransaction

I am trying to make a transaction between two different accounts using Java. It works perfectly fine as long as I am not using "Data" parameter. My intent is not to call a smart contract but to make ...