Web3j Ethereum Blockchain
Call the JSON-RPC API of an Ethereum node with web3j, and receive new blocks, transactions and logs from it.
What’s inside
-
Web3j Ethereum Blockchain component, URI syntax:
web3j:nodeAddress
Please refer to the above links for usage and configuration details.
Maven coordinates
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-web3j-starter</artifactId>
</dependency> Spring Boot Auto-Configuration
The starter supports 39 options, which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
camel.component.web3j.address | The address of the account or contract, for ETH_GET_BALANCE, ETH_GET_STORAGE_AT, ETH_GET_TRANSACTION_COUNT, ETH_GET_CODE and ETH_SIGN, or the Whisper identity for SHH_HAS_IDENTITY and SHH_ADD_TO_GROUP. | String | |
camel.component.web3j.addresses | A comma separated list of the contract addresses whose logs the ETH_LOG_OBSERVABLE consumer receives. The ETH_NEW_FILTER and ETH_GET_LOGS operations of the producer ignore this option: they take the addresses only from the CamelWeb3jAddresses header, as a List. | String | |
camel.component.web3j.at-block | The block that the operation reads the state at: a block number in decimal, or a block tag: earliest, latest, pending, safe, finalized or accepted. Used by ETH_GET_BALANCE, ETH_GET_STORAGE_AT, ETH_GET_TRANSACTION_COUNT, ETH_GET_CODE, ETH_CALL, ETH_GET_BLOCK_BY_NUMBER, ETH_GET_BLOCK_TRANSACTION_COUNT_BY_NUMBER, ETH_GET_UNCLE_COUNT_BY_BLOCK_NUMBER, ETH_GET_TRANSACTION_BY_BLOCK_NUMBER_AND_INDEX and ETH_GET_UNCLE_BY_BLOCK_NUMBER_AND_INDEX. | latest | String |
camel.component.web3j.autowired-enabled | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | Boolean |
camel.component.web3j.block-hash | The hash of the block, for ETH_GET_BLOCK_BY_HASH, ETH_GET_BLOCK_TRANSACTION_COUNT_BY_HASH, ETH_GET_UNCLE_COUNT_BY_BLOCK_HASH, ETH_GET_TRANSACTION_BY_BLOCK_HASH_AND_INDEX and ETH_GET_UNCLE_BY_BLOCK_HASH_AND_INDEX. | String | |
camel.component.web3j.bridge-error-handler | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | Boolean |
camel.component.web3j.client-id | A random id of 32 bytes, as a hex string, that identifies the client in ETH_SUBMIT_HASHRATE. | String | |
camel.component.web3j.configuration | The configuration that the endpoints of this component start from. Each endpoint uses a copy, and the options set on the endpoint override it. The option is a org.apache.camel.component.web3j.Web3jConfiguration type. | Web3jConfiguration | |
camel.component.web3j.data | The data, as a hex string. For ETH_SEND_TRANSACTION, ETH_CALL, ETH_ESTIMATE_GAS and QUORUM_ETH_SEND_TRANSACTION, the data of the transaction: the compiled code of a contract to create, or the hash of the method signature and the encoded parameters of a contract call. For SHH_POST, the payload of the Whisper message. For SHH_NEW_FILTER, the Whisper identity that the messages are sent to. | String | |
camel.component.web3j.database-name | The name of the local database of the node, for the DB_PUT_STRING, DB_GET_STRING, DB_PUT_HEX and DB_GET_HEX operations. | String | |
camel.component.web3j.enabled | Whether to enable auto configuration of the web3j component. This is enabled by default. | Boolean | |
camel.component.web3j.filter-id | The id of the filter, as a decimal number, for ETH_UNINSTALL_FILTER, ETH_GET_FILTER_CHANGES, ETH_GET_FILTER_LOGS, SHH_UNINSTALL_FILTER, SHH_GET_FILTER_CHANGES and SHH_GET_MESSAGES. The option is a java.math.BigInteger type. | BigInteger | |
camel.component.web3j.from-address | The address that the transaction is sent from, for ETH_SEND_TRANSACTION, ETH_CALL, ETH_ESTIMATE_GAS and QUORUM_ETH_SEND_TRANSACTION, or the Whisper identity of the sender for SHH_POST. | String | |
camel.component.web3j.from-block | The first block of the range: a block number in decimal, or a block tag: earliest, latest, pending, safe, finalized or accepted. Used by the ETH_NEW_FILTER and ETH_GET_LOGS operations of the producer, and the ETH_LOG_OBSERVABLE, REPLAY_BLOCKS_OBSERVABLE and REPLAY_TRANSACTIONS_OBSERVABLE operations of the consumer. | latest | String |
camel.component.web3j.full-transaction-objects | Whether a block holds the full transaction objects (true) or only the hashes of its transactions (false). For ETH_GET_BLOCK_BY_HASH and ETH_GET_BLOCK_BY_NUMBER, and the BLOCK_OBSERVABLE and REPLAY_BLOCKS_OBSERVABLE operations of the consumer. | false | Boolean |
camel.component.web3j.gas-limit | The maximum amount of gas that the transaction can use, for ETH_SEND_TRANSACTION, ETH_CALL and QUORUM_ETH_SEND_TRANSACTION. When not set, the node chooses it. The option is a java.math.BigInteger type. | BigInteger | |
camel.component.web3j.gas-price | The price in wei of each unit of gas, for ETH_SEND_TRANSACTION and ETH_CALL. When not set, the node chooses it. The option is a java.math.BigInteger type. | BigInteger | |
camel.component.web3j.hashrate | The hash rate that ETH_SUBMIT_HASHRATE reports, as a hex string of 32 bytes. | String | |
camel.component.web3j.header-pow-hash | The proof-of-work hash of the block header (256 bits), as a hex string, for ETH_SUBMIT_WORK. | String | |
camel.component.web3j.index | The index of the transaction or the uncle in the block, as a decimal number, for ETH_GET_TRANSACTION_BY_BLOCK_HASH_AND_INDEX, ETH_GET_TRANSACTION_BY_BLOCK_NUMBER_AND_INDEX, ETH_GET_UNCLE_BY_BLOCK_HASH_AND_INDEX and ETH_GET_UNCLE_BY_BLOCK_NUMBER_AND_INDEX. The option is a java.math.BigInteger type. | BigInteger | |
camel.component.web3j.key-name | The key in the local database of the node, for the DB_PUT_STRING, DB_GET_STRING, DB_PUT_HEX and DB_GET_HEX operations. | String | |
camel.component.web3j.lazy-start-producer | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | Boolean |
camel.component.web3j.mix-digest | The mix digest (256 bits), as a hex string, for ETH_SUBMIT_WORK. | String | |
camel.component.web3j.nonce | The nonce. For ETH_SEND_TRANSACTION, ETH_CALL and QUORUM_ETH_SEND_TRANSACTION, the nonce of the transaction as a decimal number; when not set, the node chooses it. For ETH_SUBMIT_WORK, the proof-of-work nonce found (64 bits), as a hex string. | String | |
camel.component.web3j.operation | Operation to use. The producer needs an operation, set with this option or the CamelWeb3jOperation header. The consumer needs one of the observable operations: ETH_LOG_OBSERVABLE, ETH_BLOCK_HASH_OBSERVABLE, ETH_PENDING_TRANSACTION_HASH_OBSERVABLE, TRANSACTION_OBSERVABLE, PENDING_TRANSACTION_OBSERVABLE, BLOCK_OBSERVABLE, REPLAY_BLOCKS_OBSERVABLE or REPLAY_TRANSACTIONS_OBSERVABLE. | transaction | String |
camel.component.web3j.position | The position (slot) in the storage of the contract that ETH_GET_STORAGE_AT reads, as a decimal number. The option is a java.math.BigInteger type. | BigInteger | |
camel.component.web3j.priority | The priority of the Whisper message that SHH_POST sends. The option is a java.math.BigInteger type. | BigInteger | |
camel.component.web3j.private-for | A comma separated list of the public keys of the Quorum nodes that receive the private transaction that QUORUM_ETH_SEND_TRANSACTION sends. | String | |
camel.component.web3j.quorum-a-p-i | Whether the endpoint builds a Quorum client instead of a Web3j client. The QUORUM_ETH_SEND_TRANSACTION, QUORUM_NODE_INFO and QUORUM_GET_PRIVATE_PAYLOAD operations need it. Not used when the web3j option is set. | false | Boolean |
camel.component.web3j.sha3-hash-of-data-to-sign | The data that ETH_SIGN signs, as a hex string. The node signs it, with the Ethereum signed message prefix, with the key of the account in the address option. | String | |
camel.component.web3j.signed-transaction-data | The signed transaction that ETH_SEND_RAW_TRANSACTION sends, RLP encoded as a hex string: a message call or a contract creation. | String | |
camel.component.web3j.source-code | The source code that ETH_COMPILE_LLL, ETH_COMPILE_SOLIDITY or ETH_COMPILE_SERPENT compiles. | String | |
camel.component.web3j.to-address | The address that the transaction is sent to, for ETH_SEND_TRANSACTION, ETH_CALL, ETH_ESTIMATE_GAS and QUORUM_ETH_SEND_TRANSACTION (not set for a contract creation), or the Whisper identity of the receiver for SHH_POST. | String | |
camel.component.web3j.to-block | The last block of the range: a block number in decimal, or a block tag: earliest, latest, pending, safe, finalized or accepted. Used by the ETH_NEW_FILTER and ETH_GET_LOGS operations of the producer, and the ETH_LOG_OBSERVABLE, REPLAY_BLOCKS_OBSERVABLE and REPLAY_TRANSACTIONS_OBSERVABLE operations of the consumer. | latest | String |
camel.component.web3j.topics | A comma separated list of the log topics that the ETH_LOG_OBSERVABLE consumer filters on, matched by position: the first entry matches the first topic of a log, and so on, and an empty entry matches any topic at its position. The ETH_NEW_FILTER, ETH_GET_LOGS, SHH_POST and SHH_NEW_FILTER operations of the producer ignore this option: they take the topics only from the CamelWeb3jTopics header, as a List. | String | |
camel.component.web3j.transaction-hash | The hash of the transaction, for ETH_GET_TRANSACTION_BY_HASH and ETH_GET_TRANSACTION_RECEIPT. | String | |
camel.component.web3j.ttl | The time to live in seconds of the Whisper message that SHH_POST sends. The option is a java.math.BigInteger type. | BigInteger | |
camel.component.web3j.value | The amount of wei that the transaction transfers, for ETH_SEND_TRANSACTION, ETH_CALL and QUORUM_ETH_SEND_TRANSACTION. The option is a java.math.BigInteger type. | BigInteger | |
camel.component.web3j.web3j | The Web3j client to use, instead of the one that the endpoint builds from the node address. When set, the node address and the quorumAPI option are not used: set a Quorum client for the QUORUM_ETH_SEND_TRANSACTION, QUORUM_NODE_INFO and QUORUM_GET_PRIVATE_PAYLOAD operations. The option is a org.web3j.protocol.Web3j type. | Web3j |