Web3j is the primary JVM library for working with Blast, the ETH-gas Optimistic Rollup with chain ID 81457. It works with Java 8+ and integrates cleanly with Kotlin coroutines out of the box. For Android projects, depend on the web3j-android artifact instead, which excludes desktop-only dependencies that bloat or break an APK build. Add it through Gradle with implementation "org.web3j:core:4.x.x" and point the HttpService at https://blast.therpc.io/YOUR_API_KEY.
Web3j supports Java 8+ and pairs naturally with Kotlin coroutines, so suspending balance and transaction calls against Blast read cleanly. For Android builds, use the web3j-android artifact to drop desktop-only dependencies that would otherwise inflate your APK or trigger packaging conflicts.
Web3j
Create the client with Web3j.build(new HttpService(nodeUrl)), passing your Blast endpoint https://blast.therpc.io/YOUR_API_KEY as nodeUrl. The same call works identically from Java and Kotlin; the examples below show both, reading an ETH balance and signing a raw transfer transaction.
Key features: Java 8+ support, Kotlin coroutines, Android compatibility, generated smart contract wrappers for Blast, CLI tooling, and wallet management
Android Support
On Android, never run Blast RPC calls on the main thread — launch them in viewModelScope.launch and switch to Dispatchers.IO so network I/O stays off the UI thread and keeps the app responsive. The client construction is identical to the desktop case: Web3j.build(HttpService("https://blast.therpc.io/YOUR_API_KEY")). The ViewModel example below fetches a balance and is ready to push the result back to your UI state.
// Android example
class EthereumViewModel : ViewModel() {
private val web3j = Web3j.build(HttpService("https://blast.therpc.io/YOUR_API_KEY"))
fun getBalance(address: String) = viewModelScope.launch {
withContext(Dispatchers.IO) {
val balance = web3j.ethGetBalance(address, DefaultBlockParameterName.LATEST)
.send()
.balance
// Update UI
}
}
}
Smart Contract Integration
Use the web3j CLI to generate Java or Kotlin wrapper classes directly from a Solidity ABI, as shown below. The generated wrapper exposes each contract method as a type-safe call, so interacting with a Blast contract — say, a yield-bearing vault — becomes a strongly typed method invocation rather than manual ABI encoding.