Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 05:35
    W3-Mimo labeled #1433
  • 05:35
    W3-Mimo labeled #1433
  • 05:35
    W3-Mimo opened #1433
  • 05:35
    W3-Mimo opened #1433
  • Jun 20 07:57
    thup forked
    thup/web3j
  • Jun 20 07:28
    yux829 starred web3j/web3j
  • Jun 20 04:50
  • Jun 19 09:36
    unnamedw commented #1409
  • Jun 19 09:36
    unnamedw commented #1409
  • Jun 18 15:25
    littlekev starred web3j/web3j
  • Jun 18 13:14
    spolnik commented #1342
  • Jun 18 13:14
    spolnik commented #1342
  • Jun 18 12:25
    oofriday starred web3j/web3j
  • Jun 18 11:05
    AlexandrouR commented #1417
  • Jun 18 11:05
    AlexandrouR commented #1417
  • Jun 18 08:07
    YEJC1992 starred web3j/web3j
  • Jun 18 03:02
  • Jun 18 03:02
    zhonghua-han starred web3j/web3j
  • Jun 17 19:00
    sandrocaseiro starred web3j/web3j
  • Jun 17 17:17
    yasseralaa starred web3j/web3j
Farhan
@ffarhan.aamin_gitlab
I have the exact same problem, the only different is I am using HTtpService
Ram
@rampatra

My sample web3j java project was running fine but suddenly I started getting this error when I ran my vanilla Java project with web3j as a dependency (not sure what I changed except the installed Java version in my system). The error was :

Error: Expected identifier, got 'LParen' constructor() {

I am actually not sure what the problem is here as the files compile fine but when I run my java project, I get the above error. So, what maybe the problem here? Any hints?

Farhan
@ffarhan.aamin_gitlab
i have generated a web3j wrapper
of a smart contract
there is. a function foo() in the contract that is payable
how can I send fund ?
jkvoulgaridis
@jkvoulgaridis
Hey! Nice to join you!
I would like to ask u if/ how I can use web3j in scala! I am relatively new in eth etc but I need to use scala for my project
Lucas Saldanha
@lucassaldanha
Hi folks! I have opened a PR to fix how Web3j is interacting with Besu when reading private contracts. Here is the PR web3j/web3j#1395
allawala
@allawala
New to eth development. I am trying to get details for a transaction related to whether if it was an approval or a swap (from and to tokens) or transfer etc. If I am not mistaken that information can be found in the transaction "input" field. Though i am struggling to find how to decode the input. Note, it can be any transaction and i am not the creator of the contract.
André Reiter
@andre77
Hello everybody
i would like to call the "increaseAllowance" method on an ERC20 contract, but this method is not available in the ERC20 class for some reason
is there a work around ?
kunalbarchha
@kunalbarchha

org.web3j.protocol.core.filters.Filter : The filter has not been found. F

refer my solution here : https://github.com/ethereum/go-ethereum/issues/21386#issuecomment-723992023 working perfectly fine from last few months.

smcio
@smcio
hey
smcio
@smcio
i'm having trouble with the ethLogFlowable() API, which i'm trying to use to listen for events on BSC

when i do something like:

EthFilter filter = new EthFilter(DefaultBlockParameterName.EARLIEST, DefaultBlockParameterName.LATEST, tokenAddr); web3.ethLogFlowable(filter).subscribe(log -> System.out.println(log.toString()));

i'm getting a NPE exception here:

EthFilter filter = new EthFilter(DefaultBlockParameterName.EARLIEST, DefaultBlockParameterName.LATEST, list); web3.ethLogFlowable(filter).subscribe(log -> System.out.println(log.toString()));

any idea what's going on here? is event listening broken?
smcio
@smcio

sorry, the stack trace/exception message was as such:

Caused by: java.lang.NullPointerException at org.web3j.protocol.core.filters.LogFilter.process(LogFilter.java:46) at org.web3j.protocol.core.filters.Filter.getInitialFilterLogs(Filter.java:119) at org.web3j.protocol.core.filters.Filter.run(Filter.java:69) at org.web3j.protocol.rx.JsonRpc2_0Rx.run(JsonRpc2_0Rx.java:89) at org.web3j.protocol.rx.JsonRpc2_0Rx.lambda$ethLogFlowable$2(JsonRpc2_0Rx.java:79) at io.reactivex.internal.operators.flowable.FlowableCreate.subscribeActual(FlowableCreate.java:71)

i'm using web3j 5.0.0, and i've tried other recent versions as well. i'm on BSC, the binance smart chain.
Ilya Shaydullin
@ilusha2012_gitlab

Hi!

I try deploy the contract in binance smart chain through web3j. But I doesn't understand how calculating gas price and gas limit.

When I run this example, I get this error: "Error processing transaction request: tx fee (1.00 ether) exceeds the configured cap (1.00 ether)"

        val web3j = Web3j.build(HttpService("https://data-seed-prebsc-1-s1.binance.org:8545"))
        val credentials = WalletUtils.loadBip39Credentials(
            "pass",
            "mnemonic"
        )

        val gasLimit = web3j.ethGetBlockByNumber(DefaultBlockParameterName.LATEST, false)
            .send()
            .getBlock()
            .gasLimit
        val gasPrice = web3j.ethGasPrice().send().gasPrice

        val newGasPrice = gasPrice.toBigDecimal() * 3.3333333335.toBigDecimal()

        val contract = TokenERC20.deploy(
            web3j,
            FastRawTransactionManager(web3j, credentials, 97),
            StaticGasProvider(newGasPrice.toBigInteger(), gasLimit)
        ).send()
Christopher McGregor
@chrismcgregor
Does web3j support ABIV2?
zillerium
@zillerium
I used web3 last in 2018
I have some old code but when I run it that code fails]
has anyone the new code?
I use this
 if (typeof web3 !== 'undefined') {
       web3 = new Web3(web3.currentProvider);
   } else {
       // set the provider you want from Web3.providers
       web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
   }
       // Our future code here..
      //  web3.eth.defaultAccount = web3.eth.accounts[0];
        var addr = '0x774e44c7bc4c24183f379712B9a55d2bD3280fee';
        var aBCContract = new web3.eth.Contract(abi, addr);


$("#btnAddInvestorNft").click(function() {
    var assetNft = $("#assetNft").val();
    var investorAddr = $("#investorAddr").val();
    var investorNft = $("#investorNft").val();
    var NftValue = $("#NftValue").val();




    aBCContract.methods.addiNft(assetNft,investorAddr,investorNft , NftValue);


});
I think somehow the methods part is wrong
something related to accounts and metamask
zillerium
@zillerium
looks like web3 changed a lot
Cem Ozer
@cemozerr
As soon as I added web3j to a project that was otherwise running without errors, I'm now getting these errors:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
Any ideas
the version I'm using is 4.8.4
kunalbarchha
@kunalbarchha

As soon as I added web3j to a project that was otherwise running without errors, I'm now getting these errors:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation

replace @SL4J with @Log4j

tomato1015
@tomato1015
0x62BA9425f133f2fF8981F3dB5dE9BBad8B7bEb65
Cem Ozer
@cemozerr
When I subscribe to blockFlowable with using a web socket service under the hood, I get blocks in batches of 5 or so. Any reason why this happens? I've tested the same node with node.js and ethers.js and I'm able to get blocks one by one so the connected node is not the issue.
Cem Ozer
@cemozerr
Okay, I dug a bit and saw that that is due to the polling interval being set as the default block time for ethereum, which is 15 seconds. That's why I was getting 7-8 blocks batched as I'm connected to polygon.
I have a question though. When you build a Web3j instance with a web socket service, why does it need to have a polling interval? and why does it adhere to a polling interval? When I build Web3j with a websocket service, I expect to receive events as soon as the server I'm connected to publishes the events
Is there a reason why this is not the case?
Moisés
@moisesvs
Hi! I am trying run contract code with Web3J in Android but I always obtain the same error: 0x0. So content object has the following data:
Captura de pantalla 2021-06-04 a las 13.41.20.png
could someone help me to try something..?
Moisés
@moisesvs
Captura de pantalla 2021-06-04 a las 14.21.12.png
Moisés
@moisesvs
I was checking this issue in Github but I didn't find any solution for my error: web3j/web3j#515
mitruth
@mitruth_gitlab

Hello ! I am coming back to a project I have done 1-2 years ago and it seems that what was happening then, is not happening anymore... can it be due to some changes in versions or behaviours of classes?
I want to trigger some separate methods when a certain event is thrown. The module must work continuously and each time the event is thrown, I want to log a message. This is what was happening the first time I wrote the code, but now, it seems that it does not listen continuously to that event. If the program is running and I throw the event, it does not do anything. However, when I re-run the module, it sees the event and logs the below message. Again, it was detecting the event while the module was running, the first time I wrote the code. Does anyone have a clue why this is happening?
The pseudocode is like this:
-- get address then load the contract
-- load the previous block at which an event was detected and use it as parameter:
observeEvent(marketContractInstance, lastBlockNumber, web3j);

observeEvent(managerContractInstance, lastBlockNumber, web3j) {
DefaultBlockParameterNumber defaultBlockParameterNumber = new DefaultBlockParameterNumber(lastBlockNumber);

    Flowable<MarketsManager.EnergyTypeOfMarketSessionEventResponse> obs = managerContractInstance.energyTypeOfMarketSessionEventFlowable(
            defaultBlockParameterNumber, DefaultBlockParameterName.LATEST);
    obs.subscribe(event -> {
        LOGGER.log(Level.INFO, "observed insert market session event");

        EthBlockNumber ethBlockNumber = web3j.ethBlockNumber().sendAsync().get();
        BigInteger ethBlockNumberBigInt = ethBlockNumber.getBlockNumber();
        if (ethBlockNumberBigInt.compareTo(lastBlockNumber) > 0) {
            String lastBlockString = ethBlockNumberBigInt.intValue() + "";
            LOGGER.log(Level.INFO, "Last block: " + lastBlockString);
            EventListenerService.writeToFile(lastBlockString);
        }

    });

}
-- I have also tried using EthFilter and subscribe, but the behaviour is exactly the same as described above.
I am using web3j 4.8.4, openethereum (the new name for parity) 3.0.