Categories
Cryptocurrency Ethereum Mastering Development

Trouble getting started with web3j for java

This is my first time working with blockchain related programming. I am using java so i have added the web3j dependencies in my project. So what i want to do is :- Connect to a smart contract whose contract address i have. It’s on ropsten network. Say my application starts at 12 p.m. today. So […]

Categories
Cryptocurrency Ethereum Mastering Development

How to filter an indexed event parameter using web3j?

I am planning to use ethereum logs as a data storage on my private blockchain. I have defined event in my contract like this: event logDomainFilter(uint128 indexed _campaignId, uint128 indexed _orderId, string _whiteListDomains, string _blackListDomains); Now in my java code, I am using following code: EthFilter eventFilter = new EthFilter( DefaultBlockParameterName.EARLIEST, DefaultBlockParameterName.LATEST, contract.getContractAddress() ); eventFilter.addSingleTopic(EventEncoder.encode(contract.LOGDOMAINFILTER_EVENT)); […]

Categories
Cryptocurrency Development Ethereum

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<Transaction> test() throws InterruptedException, ExecutionException { List<Transaction> transaction=new ArrayList<Transaction>(); Web3j web3j=web3jConfig.initializeWeb3j(); System.out.println(“test Running…….”); EthFilter filter = new EthFilter( DefaultBlockParameterName.EARLIEST, DefaultBlockParameterName.LATEST, “0xeedc155ae507fb0a9becae6315286183a23229b0”); web3j.ethLogFlowable(filter).subscribe(event -> […]