This guide covers the Base (Coinbase L2) blockchain anchor client integration for TrustWeave. The Base adapter provides fast and low-cost anchoring with Ethereum security.
Overview
The chains/plugins/base module provides a complete implementation of TrustWeave’s BlockchainAnchorClient interface using Base, Coinbase’s Ethereum L2. This integration enables you to:
Anchor credential digests on Base with lower fees than Ethereum
Benefit from Coinbase’s backing and ecosystem
Use EVM-compatible transaction data storage
Leverage Ethereum security with L2 scalability
Installation
Add the Base adapter module to your dependencies:
1
2
3
4
5
6
7
8
9
dependencies{implementation("com.trustweave.chains:base:1.0.0-SNAPSHOT")implementation("com.trustweave:trustweave-anchor:1.0.0-SNAPSHOT")implementation("com.trustweave:trustweave-json:1.0.0-SNAPSHOT")implementation("com.trustweave:trustweave-core:1.0.0-SNAPSHOT")// Web3j for Base blockchain (EVM-compatible)implementation("org.web3j:core:5.0.1")}
Configuration
Basic Configuration
1
2
3
4
5
6
7
8
9
10
11
12
13
importcom.trustweave.anchor.*importcom.trustweave.base.*// Create Base anchor client for mainnetvaloptions=mapOf("rpcUrl"to"https://mainnet.base.org","privateKey"to"0x..."// Optional: for signing transactions)valclient=BaseBlockchainAnchorClient(BaseBlockchainAnchorClient.MAINNET,options)
Pre-configured Networks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Base mainnetvalmainnetClient=BaseBlockchainAnchorClient(BaseBlockchainAnchorClient.MAINNET,mapOf("rpcUrl"to"https://mainnet.base.org","privateKey"to"0x..."))// Base Sepolia testnetvalsepoliaClient=BaseBlockchainAnchorClient(BaseBlockchainAnchorClient.BASE_SEPOLIA,mapOf("rpcUrl"to"https://sepolia.base.org","privateKey"to"0x..."))
SPI Auto-Discovery
When the module is on the classpath, Base adapter is automatically available:
1
2
3
4
5
6
7
8
9
10
11
12
13
importcom.trustweave.anchor.*importcom.trustweave.anchor.spi.*importjava.util.ServiceLoader// Discover Base providervalproviders=ServiceLoader.load(BlockchainAnchorClientProvider::class.java)valbaseProvider=providers.find{it.name=="base"}// Create clientvalclient=baseProvider?.create(BaseBlockchainAnchorClient.MAINNET,mapOf("rpcUrl"to"https://mainnet.base.org"))
importcom.trustweave.anchor.*importcom.trustweave.base.*importkotlinx.serialization.json.*valclient=BaseBlockchainAnchorClient(BaseBlockchainAnchorClient.BASE_SEPOLIA,mapOf("rpcUrl"to"https://sepolia.base.org","privateKey"to"0x..."))// Anchor a JSON payloadvalpayload=buildJsonObject{put("digest","uABC123...")put("timestamp",System.currentTimeMillis())}valresult=client.writePayload(payload,"application/json")println("Anchored to Base: ${result.ref.txHash}")
Chain IDs
Network
Chain ID
RPC URL
Base Mainnet
eip155:8453
https://mainnet.base.org
Base Sepolia Testnet
eip155:84532
https://sepolia.base.org
Advantages
Lower fees: Significantly cheaper than Ethereum mainnet
Fast confirmations: Optimistic rollup with fast finality
Coinbase ecosystem: Access to Coinbase’s user base and tools
EVM compatible: Same tools and patterns as Ethereum