Web3j
This skill is for AI agents helping users consume the Web3j library and CLI.
Treat Web3j as two separate interfaces:
- Java library usage inside application code
- Web3j CLI usage from the shell
Do not blur these together. If the user asks for code inside a Java project, answer with the library APIs. If the user asks to scaffold a project, audit Solidity, or manage wallets from the terminal, answer with the CLI.
Routing
- For contributing to the Web3j library itself, including bug reports, fixes, feature proposals, formatting, PR expectations, and community discussion paths, read references/contributing.md.
- For project setup, dependency selection, module guidance, and "how do I use this library", read references/getting-started.md.
- For end-to-end ERC20 examples that show how CLI scaffolding, wrapper generation, interaction, tests, and events fit together, read references/erc20-example.md.
- For event subscriptions, filters, flowables, WebSocket pub/sub, and runnable starter examples, read references/events.md.
- For smart contract wrapper generation, deployment, loading, calling, sending transactions, contract event subscriptions, and raw transaction fallbacks, read references/smart-contracts.md.
- For
web3j new,web3j import,web3j run,web3j docker run,web3j wallet create,web3j wallet update,web3j wallet send,web3j audit, and OpenAPI-oriented CLI scaffolding, read references/cli.md. - For Gradle and Maven plugin workflows, read references/build-plugins.md.
- For private transactions, Besu/EEA privacy APIs, and permissioned-network configuration context, read references/privacy-permissioning.md.
- For transaction managers, signing, gas, nonces, EIP transaction types, wallet files, ETH transfers, generic log filters, and block/transaction flowables, read references/transactions.md.
- For the broader Web3j ecosystem tools named directly by the user, read:
- references/web3j-eth2-client.md
- references/web3j-openapi.md
- references/web3j-unit.md
- references/web3j-evm.md
- references/web3j-sokt.md
Repo-grounded examples
When you need canonical implementation patterns, prefer these local sources:
README.mdfor published dependency coordinates, Java version expectations, and high-level positioningintegration-tests/src/test/java/org/web3j/protocol/scenarios/FunctionWrappersIT.javafor generated wrapper deploy/load/call patternsintegration-tests/src/test/java/org/web3j/protocol/scenarios/DeployContractIT.javafor lower-level raw contract deployment and ABI callsintegration-tests/src/test/java/org/web3j/protocol/scenarios/SendEtherIT.javafor ETH transfers andTransfer.sendFundsintegration-tests/src/test/java/org/web3j/protocol/core/FlowableIT.javafor block, transaction, pending-transaction, log, and replay flowablesintegration-tests/src/test/java/org/web3j/protocol/scenarios/EventFilterIT.javafor manualEthFilter-based event filtering and log decodingcore/src/main/java/org/web3j/crypto/WalletUtils.javafor wallet creation and credential loading APIscore/src/main/java/org/web3j/tx/RawTransactionManager.javafor local signing and raw transaction broadcast patternsintegration-tests/build.gradleforweb3j-unitusage in this repo's test setupintegration-tests/src/test/java/org/web3j/protocol/besu/BesuPrivacyQuickstartIntegrationTest.javafor private transaction and privacy group flowsbesu/src/main/java/org/web3j/tx/PrivateTransactionManager.javaandeea/src/main/java/org/web3j/protocol/eea/crypto/RawPrivateTransaction.javafor privacy APIscontracts/scripts/generateWrappers.shandcodegen/src/main/java/org/web3j/codegen/SolidityFunctionWrapperGenerator.javafor wrapper-generation CLI shape
Working rules
- Prefer concise, copyable answers.
- Separate "library code" from "CLI commands" with explicit headings when both are relevant.
- If the user asks to create a new project, first decide whether they mean:
- a CLI-scaffolded Web3j project
- a CLI import or generated-project workflow
- adding Web3j to an existing Maven or Gradle Java project
- If the user asks how to contribute to Web3j itself, first decide whether they mean:
- report a bug
- submit a fix
- propose a feature
- ask a source-code question
- For dependency coordinates and install steps, prefer official published usage from the docs and
README.md. - For implementation details, prefer this repo's source and integration tests.
- When showing smart contract usage, default to generated wrappers first and raw ABI / raw transaction flows second.
- When the user asks for a basic ERC20 example or how Web3j pieces fit together across wrappers, tests, and events, prefer the starter assets under
assets/erc20-example/. - When the user asks for a runnable event-listening example, prefer the starter assets under
assets/event-subscriptions/and adapt the closest template instead of writing one from scratch. - When answering audit questions, make clear that
web3j auditis static analysis from the CLI toolchain, not a Java runtime API. - When answering OpenAPI, Unit, EVM, Sokt, or Eth2 questions, be explicit when the docs describe a companion library or generated project rather than a package implemented in this repo's main modules.
- When helping with repo contributions, follow
CONTRIBUTING.md: bug issues should include a real reproducer, fixes should be formatted with Spotless, and feature ideas should go through Discord discussion before GitHub issue creation.