EthereumConnector
Interacts with the Ethereum blockchain network. The functions include reading transaction, address, or block information, sending transactions, or interaction with deployed contracts.
Typical Uses
- Reading transaction, address, or block information
- Sending transactions
- Interacting with deployed contracts
How does it work?
The Ethereum blockchain is an immutable and distributed ledger. Once data is stored on the blockchain it cannot be changed or deleted. Information is added to the network by sending a transaction. Ethereum also allows code execution called contracts, which together can create decentralized applications (Dapps). The EthereumConnector allows:
- Reading stored information
- Storing data
- Interacting with Dapps
There are 2 methods of connecting to the Ethereum network through the connector.
- An rpc url to an ethereum node. https://infura.io is a popular node service, or you can use a local or another hosted node.
- An API Key from https://etherscan.io.
A private key is required to send a transaction. The key is generated when you create an ethereum wallet.
Usage Notes
- There are multiple ethereum networks. The public mainnet requires real ether for the transaction fee to send transactions. For testing purposes, we recommend using a testnet as transactions are free and ether has no monetary value. However, testnets should only be for testing purposes and should not be used for production.
Configuration
Input Ports
This transformer accepts any feature.
Output Ports
Output will depend on the method chosen.
The incoming feature is output through this port.
Features that cause the operation to fail are output through this port. An fme_rejection_code attribute, having the value ERROR_DURING_PROCESSING, will be added, along with a more descriptive fme_rejection_message attribute which contains more specific details as to the reason for the failure.
Rejected Feature Handling: can be set to either terminate the translation or continue running when it encounters a rejected feature. This setting is available both as a default FME option and as a workspace parameter.
Parameters
Credential Source |
The EthereumConnector has 2 methods for accessing the Ethereum network.
|
Node URL |
The URL to use when Node is chosen as the Credential Source. |
Etherscan API Key |
The API Key to use when Etherscan is chosen as the Credential Source. |
Network |
The network for Etherscan to use. “Mainnet” is the main ethereum chain. We recommend using the Ropsten testnet for development. You enter any testnet supported by etherscan, i.e. “Kovan”, but your results may vary. |
Action |
The type of operation to perform. Choices are:
|
The remaining parameters available depend on the value of the Request > Action parameter. Parameters for each Action are detailed below.
Retrieves metadata information for an address.
Get Address Options
Address |
The ethereum address. |
Output Attributes
_balance |
The ether balance of the address. |
_transaction_count |
The number of transactions going out from an address. |
Retrieves transactions from the address as features.
If using the Node credential source, only the transactions in the last 100 blocks are returned. This is about 20 minutes back in time on the mainnet. It is recommended to use Etherscan to retrieve all outgoing transactions on an address as the last 10000 transactions can be retrieved.
Get Address Options
Address |
The ethereum address. |
Encoding |
The encoding used for the _input output attribute value. |
Output Attributes
_block_hash |
The block hash of the transaction. |
_block_number |
The block number of the transaction. |
_from_address |
Address the transaction was from. |
_gas |
The gas used to send the transaction. |
_gas_price |
The gas price when the transaction was sent. |
_hash |
The hash of the transaction. |
_input |
The data on the transaction. |
_to_address |
Address the transaction is to. |
_transaction_index |
The integer transaction index in the block. |
_value |
Ether value of the transaction. |
Retrieves metadata information on a block.
Get Block Options
Block Number |
The block number or block hash. |
Output Attributes
_difficulty |
The difficulty of the block. |
_extra_data |
Extra data added to the block when it was created. |
_gas_limit |
The gas limit set on the block. |
_gas_used |
The gas used mining the block. |
_hash |
The block hash. |
_latest_block_number |
The most recent block number. |
_miner |
The address that mined the block. |
_number |
The block number. |
_parent_hash |
Hash of the block’s parent. |
_size |
The total size in bytes. |
_timestamp |
The time the block was created. |
_total_difficulty |
The total difficulty of mining the block. |
Retrieves transactions on the block as features.
Get Block Options
Block Number |
The block number or block hash. |
Encoding |
The encoding used for the _input output attribute value. |
Output Attributes
_block_hash |
The block hash of the transaction. |
_block_number |
The block number of the transaction. |
_gas |
The gas used to send the transaction. |
_gas_price |
The gas price when the transaction was sent. |
_from_address |
Address the transaction was from. |
_hash |
The hash of the transaction. |
_input |
The data on the transaction. |
_to_address |
Address the transaction is to. |
_transaction_index |
The integer transaction index in the block. |
_value |
Ether value of the transaction. |
Retrieves a single transaction.
Get Transaction Options
Transaction |
The hash of the transaction. |
Encoding |
The encoding used for the _input output attribute value. |
Output Attributes
_block_hash |
The block hash of the transaction. |
_block_number |
The block number of the transaction. |
_gas |
The gas used to send the transaction. |
_gas_price |
The gas price when the transaction was sent. |
_from_address |
Address the transaction was from. |
_hash |
The hash of the transaction. |
_input |
The data on the transaction. |
_to_address |
Address the transaction is to. |
_transaction_index |
The integer transaction index in the block. |
_value |
Ether value of the transaction. |
Read a method on a deployed contract.
Contract Options
Contract Address |
The address where the contract lives. |
ABI |
A file that contains the application binary interface. |
Contract Function |
The name of the function to call. |
Output Attributes
_value |
The value of the called function. When using the node connection type, the output value will be formatted to the function return type. Etherscan will return the unformatted byte value. |
Send a transaction to the network.
Send Transaction Options
Private Key |
The private key used to sign the transaction. |
From |
The address where the transaction is sent from. |
To |
The address to send the transaction to. |
Value (Eth) |
The value of the transaction in Eth. |
Data |
Added data to the transaction. |
Encoding |
The encoding used for the data parameter. |
Gas Limit |
The max amount of gas to use. |
Gas Price (Gwei) |
The price set for gas. If the transaction fails, try increasing the gas price. |
Wait for receipt |
If Yes, wait until the transaction is broadcasted on the network with a hash before returning the feature. If No, immediately return the feature. |
Output Attributes
_block_hash |
The block hash of the transaction. |
_block_number |
The block number of the transaction. |
_gas |
The gas used to send the transaction. |
_gas_price |
The gas price when the transaction was sent. |
_from_address |
Address the transaction was from. |
_hash |
The hash of the transaction. |
_input |
The data on the transaction. |
_to_address |
Address the transaction is to. |
_transaction_index |
The integer transaction index in the block. |
_value |
Ether value of the transaction. |
Execute a write method on a deployed contract.
Write Contract Options
Private Key |
The private key used to sign the transaction. |
ABI |
A file that contains the application binary interface. |
From Address |
The address where the transaction is sent from. |
Contract Address |
The address where to execute the function. |
Contract Function |
The function to execute. |
Function Params |
The parameters of the function in comma-separated form arg1,arg2. |
Gas Limit |
The max amount of gas to use. |
Gas Price (Gwei) |
The price set for gas. If the transaction fails, try increasing the gas price. |
Wait for receipt |
If Yes, wait until the transaction is broadcasted on the network with a hash before returning the feature. If No, immediately return the feature. |
Output Attributes
_block_hash |
The block hash of the transaction. |
_block_number |
The block number of the transaction. |
_gas |
The gas used to send the transaction. |
_gas_price |
The gas price when the transaction was sent. |
_from_address |
Address the transaction was from. |
_hash |
The hash of the transaction. |
_input |
The data on the transaction. |
_to_address |
Address the transaction is to. |
_transaction_index |
The integer transaction index in the block. |
_value |
Ether value of the transaction. |
Editing Transformer Parameters
Using a set of menu options, transformer parameters can be assigned by referencing other elements in the workspace. More advanced functions, such as an advanced editor and an arithmetic editor, are also available in some transformers. To access a menu of these options, click beside the applicable parameter. For more information, see Transformer Parameter Menu Options.
Defining Values
There are several ways to define a value for use in a Transformer. The simplest is to simply type in a value or string, which can include functions of various types such as attribute references, math and string functions, and workspace parameters. There are a number of tools and shortcuts that can assist in constructing values, generally available from the drop-down context menu adjacent to the value field.
Using the Text Editor
The Text Editor provides a convenient way to construct text strings (including regular expressions) from various data sources, such as attributes, parameters, and constants, where the result is used directly inside a parameter.
Using the Arithmetic Editor
The Arithmetic Editor provides a convenient way to construct math expressions from various data sources, such as attributes, parameters, and feature functions, where the result is used directly inside a parameter.
Conditional Values
Set values depending on one or more test conditions that either pass or fail.
Parameter Condition Definition Dialog
Content
Expressions and strings can include a number of functions, characters, parameters, and more.
When setting values - whether entered directly in a parameter or constructed using one of the editors - strings and expressions containing String, Math, Date/Time or FME Feature Functions will have those functions evaluated. Therefore, the names of these functions (in the form @<function_name>) should not be used as literal string values.
These functions manipulate and format strings. | |
Special Characters |
A set of control characters is available in the Text Editor. |
Math functions are available in both editors. | |
Date/Time Functions | Date and time functions are available in the Text Editor. |
These operators are available in the Arithmetic Editor. | |
These return primarily feature-specific values. | |
FME and workspace-specific parameters may be used. | |
Creating and Modifying User Parameters | Create your own editable parameters. |
Dialog Options - Tables
Transformers with table-style parameters have additional tools for populating and manipulating values.
Row Reordering
|
Enabled once you have clicked on a row item. Choices include:
|
Cut, Copy, and Paste
|
Enabled once you have clicked on a row item. Choices include:
Cut, copy, and paste may be used within a transformer, or between transformers. |
Filter
|
Start typing a string, and the matrix will only display rows matching those characters. Searches all columns. This only affects the display of attributes within the transformer - it does not alter which attributes are output. |
Import
|
Import populates the table with a set of new attributes read from a dataset. Specific application varies between transformers. |
Reset/Refresh
|
Generally resets the table to its initial state, and may provide additional options to remove invalid entries. Behavior varies between transformers. |
Note: Not all tools are available in all transformers.
Reference
Processing Behavior |
|
Feature Holding |
No |
Dependencies | Ethereum connection |
Aliases | |
History | Released FME 2019.1 |
FME Community
The FME Community is the place for demos, how-tos, articles, FAQs, and more. Get answers to your questions, learn from other users, and suggest, vote, and comment on new features.
Search for all results about the EthereumConnector on the FME Community.
Examples may contain information licensed under the Open Government Licence – Vancouver and/or the Open Government Licence – Canada.