-
Notifications
You must be signed in to change notification settings - Fork 7
chore: Adding info about monitor migration #91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
NicoMolinaOZ
wants to merge
11
commits into
main
Choose a base branch
from
monitor-migration-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
284e6b7
chore: Adding info about monitor migration
NicoMolinaOZ 4a6c037
chore: Adding video with explanation
NicoMolinaOZ e134e7d
chore: Adding relayer migration guide
NicoMolinaOZ 218a17a
fix: Fixing issue inside a react page
NicoMolinaOZ a849e8d
chore: Adding info about SDK migration
NicoMolinaOZ 3a4ef07
chore: Minor fix
NicoMolinaOZ 04bf7fc
chore: Adding new page for oss migration
NicoMolinaOZ e4927a6
chore: Docs improvements
NicoMolinaOZ 20d183c
chore: Adding signers information
NicoMolinaOZ e46aab0
chore: Improvements
NicoMolinaOZ c549642
chore: Minor improvements
NicoMolinaOZ File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,327 @@ | ||
| --- | ||
| title: Migrating from Defender to Open Source | ||
| --- | ||
|
|
||
| ## Overview | ||
|
|
||
| Defender is now in maintenance mode. To continue using monitoring and relaying capabilities with the latest features and updates, we recommend migrating to OpenZeppelin's open source tools. | ||
|
|
||
| This guide covers: | ||
| - Migrating from **Defender Monitor** to [OpenZeppelin Monitor](/monitor) | ||
| - Migrating from **Defender Relayer** to [OpenZeppelin Relayer](/relayer) | ||
|
|
||
| Both tools are designed to be self-hosted, giving you full control over your infrastructure while maintaining the functionality you rely on. | ||
|
|
||
| ## Migration Strategy | ||
|
|
||
| ### Planning Your Migration | ||
|
|
||
| 1. **Review your current usage**: Identify which Defender modules you're actively using | ||
| 2. **Export configurations**: Use Defender UI to export Monitors and Relayers configuration | ||
| 3. **Set up infrastructure**: Configure the open source tools on your own infrastructure | ||
| 4. **Test thoroughly**: Run both systems in parallel during the transition period | ||
| 5. **Migrate traffic gradually**: Switch over when you're confident everything works correctly | ||
|
|
||
| ### Timeline Considerations | ||
|
|
||
| - Plan for adequate testing time before fully switching over | ||
| - Consider running both systems in parallel during migration | ||
| - Schedule migration during low-traffic periods if possible | ||
|
|
||
| --- | ||
|
|
||
| ## Monitor Migration | ||
|
|
||
| ### From Defender Monitor to OpenZeppelin Monitor | ||
|
|
||
| OpenZeppelin Monitor offers similar functionality to Defender Monitor: | ||
|
|
||
| - **Event and function monitoring**: Monitor smart contract events and function calls | ||
| - **Custom filtering**: Write custom JavaScript, Python or Bash filters to match specific conditions | ||
| - **Multiple notification channels**: Integrate with Slack, Telegram, Discord, webhooks and emails | ||
|
|
||
| ### Getting Started | ||
|
|
||
| To begin your Monitor migration: | ||
|
|
||
| 1. **Review your existing monitors**: Export your Defender Monitor configurations using the "Download OpenZeppelin Monitor Configurations" button | ||
| 2. **Import your configurations**: Use the exported configurations to recreate your monitors in OpenZeppelin Monitor | ||
| 3. **Set up OpenZeppelin Monitor**: Follow the [installation guide](/monitor) to set up the Monitor. | ||
|
|
||
|  | ||
|
|
||
| The "OpenZeppelin Monitor Configurations" button will download a .zip file containing configuration files for every monitor in your Defender account (If for any reason you don't want a specific monitor to be migrated, we recommend you delete the monitor before clicking on the OpenZeppelin Monitor Configurations button ). These configurations are ready to copy and paste directly into OpenZeppelin Monitor. Before running the monitors, make sure to review and update any placeholder values in the configuration files, such as: | ||
|
|
||
| - API keys and secrets | ||
| - RPC URLs and endpoint addresses | ||
| - Webhook URLs for notifications | ||
| - Service integration credentials (Slack, Telegram, Discord, etc.) | ||
|
|
||
| <Callout type='warn'> | ||
| Custom Actions attached to your Defender monitors will not be automatically migrated. You will need to manually recreate any custom action logic following the [OpenZeppelin Monitor documentation](/monitor) for trigger handlers and custom notifications. | ||
| </Callout> | ||
|
|
||
| Alternatively, if you don't want to download all the monitors configurations at once, you can navigate to each individual monitor and download its configuration separately. This gives you more control over which monitors to migrate and when. | ||
|
|
||
|  | ||
|
|
||
| Here's a video with the process step by step: https://www.loom.com/share/6de3d269f92c4df6abe951af69c64feb | ||
|
|
||
| 4. **Test your monitors**: Verify that alerts trigger correctly before decommissioning Defender monitors | ||
|
|
||
| For detailed migration instructions and support, visit the [OpenZeppelin Monitor documentation](/monitor). | ||
|
|
||
| --- | ||
|
|
||
| ## Relayer Migration | ||
|
|
||
| ### From Defender Relayer to OpenZeppelin Relayer | ||
|
|
||
| OpenZeppelin Relayer offers similar functionality to Defender Relayer: | ||
|
|
||
| - **Transaction relaying**: Submit transactions to supported blockchain networks efficiently | ||
| - **Transaction signing**: Securely sign transactions using configurable key management | ||
| - **Nonce management**: Handle nonce management to ensure transaction order | ||
| - **Gas pricing**: Automatic gas price estimation and configuration | ||
| - **Multi-chain support**: Interact with EVM, Solana, and Stellar networks | ||
| - **SDK integration**: Easily interact with the relayer through a companion JavaScript/TypeScript SDK | ||
| - **Configurable policies**: Define and enforce network-specific policies for transaction processing | ||
|
|
||
| ### Getting Started | ||
|
|
||
| To begin your Relayer migration: | ||
|
|
||
| 1. **Review your existing relayers**: Export your Defender Relayer configurations using the "OpenZeppelin Relayer Configurations" button | ||
|
|
||
|  | ||
|
|
||
| The "OpenZeppelin Relayer Configurations" button will download a .zip file containing configuration files for every relayer in your Defender account (If for any reason you don't want a specific relayer to be migrated, we recommend you delete the relayer before clicking on the OpenZeppelin Relayer Configurations button ). These configurations are ready to copy and paste directly into OpenZeppelin Relayer. Before running the relayers, make sure to review and update any placeholder values in the configuration files, such as: | ||
|
|
||
| - RPC URLs and endpoint addresses | ||
NicoMolinaOZ marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - Signer configurations and private keys | ||
| - Network-specific policies | ||
| - Webhook URLs for notifications | ||
|
|
||
| 2. **Set up OpenZeppelin Relayer**: Follow the [installation guide](/relayer) to deploy the Relayer on your infrastructure | ||
| 3. **Import your configurations**: Use the exported configurations to recreate your relayers in OpenZeppelin Relayer | ||
|
|
||
| 4. **Test your relayers**: Verify that transactions are processed correctly before decommissioning Defender relayers | ||
| 5. **Transfer funds**: Once your OpenZeppelin Relayers are fully configured and running, transfer the funds from your Defender relayers to your new OpenZeppelin Relayer addresses using the Withdraw functionality | ||
| 6. **Gradually move volume**: Shift traffic from Defender relayer to OpenZeppelin Relayer incrementally | ||
|
|
||
| Here's a video with the process step by step: https://www.loom.com/share/cb5e0f5d8c064a71abc8c18fac273cf0 | ||
|
|
||
| ### Understanding Signer Migration | ||
|
|
||
| <Callout type='warn'> | ||
| **Relayer recreation is required due to AWS KMS security constraints** | ||
|
|
||
| Defender Relayers use AWS Key Management Service (AWS KMS) to secure private keys. Due to AWS KMS's security model, **private keys cannot be exported** outside AWS. This means: | ||
|
|
||
| - You cannot export existing Defender Relayer private keys | ||
| - You cannot import Defender Relayer keys into OpenZeppelin Relayer | ||
| - You **must create new relayers with new addresses** when migrating to OpenZeppelin Relayer | ||
|
|
||
| This is a fundamental security feature of AWS KMS that protects your keys from unauthorized access. | ||
| </Callout> | ||
|
|
||
| ### Choosing a Signer Type | ||
|
|
||
| OpenZeppelin Relayer supports multiple signer types to accommodate different security requirements and infrastructure setups. Each relayer must be configured with a signer that manages the private key for transaction signing. | ||
|
|
||
| #### Available Signer Options | ||
|
|
||
| | Signer Type | Description | | ||
| |------------|-------------| | ||
| | **Local** | Encrypted keystore file stored on the filesystem | | ||
| | **AWS KMS** | Amazon Web Services Key Management Service | | ||
| | **Google Cloud KMS** | Google Cloud Key Management Service | | ||
| | **HashiCorp Vault** | Vault secret engine for private key storage | | ||
| | **HashiCorp Vault Transit** | Vault Transit encryption engine | | ||
| | **Turnkey** | Third-party key management service | | ||
| | **Coinbase Developer Platform (CDP)** | Coinbase's managed key solution | | ||
|
|
||
| #### Migration Steps for Signers | ||
|
|
||
| 1. **Select a signer type** that matches your security and infrastructure requirements | ||
| 2. **Generate new keys** using your chosen signer service (refer to the [Signer Configuration documentation](/relayer/configuration/signers) for detailed setup instructions) | ||
| 3. **Configure your relayers** to use the new signers in your OpenZeppelin Relayer configuration | ||
| 4. **Update smart contract permissions**: Since you'll have new addresses, update any: | ||
| - Access control lists | ||
| - Whitelist entries | ||
| - Role assignments | ||
| - Trusted forwarder configurations | ||
| 5. **Transfer funds** from old Defender Relayer addresses to new OpenZeppelin Relayer addresses | ||
| 6. **Test thoroughly** before switching production traffic | ||
|
|
||
| <Callout type='info'> | ||
| For detailed configuration instructions for each signer type, see the [OpenZeppelin Relayer Signer Configuration documentation](/relayer/configuration/signers). | ||
| </Callout> | ||
|
|
||
| ### SDK Migration | ||
|
|
||
| If you are using the [Defender SDK](https://github.com/OpenZeppelin/defender-sdk) (`@openzeppelin/defender-sdk`) to interact with Defender Relayers programmatically, you will need to migrate to the [OpenZeppelin Relayer SDK](https://github.com/OpenZeppelin/openzeppelin-relayer-sdk) (`@openzeppelin/relayer-sdk`). | ||
|
|
||
| #### Installation | ||
|
|
||
| Replace the Defender SDK with the OpenZeppelin Relayer SDK: | ||
|
|
||
| ```bash | ||
| # Remove Defender SDK | ||
| npm uninstall @openzeppelin/defender-sdk @openzeppelin/defender-sdk-relay-client @openzeppelin/defender-sdk-relay-signer-client | ||
|
|
||
| # Install OpenZeppelin Relayer SDK | ||
| npm install @openzeppelin/relayer-sdk | ||
| ``` | ||
|
|
||
| #### Code Migration Examples | ||
|
|
||
| **Sending a Transaction** | ||
|
|
||
| Before (Defender SDK): | ||
|
|
||
| ```jsx | ||
| const { Defender } = require('@openzeppelin/defender-sdk'); | ||
| const client = new Defender({ | ||
| relayerApiKey: 'YOUR_API_KEY', | ||
| relayerApiSecret: 'YOUR_API_SECRET' | ||
| }); | ||
|
|
||
| const tx = await client.relaySigner.sendTransaction({ | ||
| to: '0x...', | ||
| value: '1000000000000000000', | ||
| data: '0x', | ||
| gasLimit: 21000, | ||
| speed: 'fast' | ||
| }); | ||
| ``` | ||
|
|
||
| After (OpenZeppelin Relayer SDK): | ||
|
|
||
| ```typescript | ||
| import { RelayerApi, Configuration } from '@openzeppelin/relayer-sdk'; | ||
|
|
||
| const config = new Configuration({ | ||
| basePath: 'http://localhost:8080/api/v1', | ||
| accessToken: 'YOUR_API_KEY' | ||
| }); | ||
|
|
||
| const relayerApi = new RelayerApi(config); | ||
|
|
||
| const tx = await relayerApi.sendTransaction('your-relayer-id', { | ||
| to: '0x...', | ||
| value: '1000000000000000000', | ||
| data: '0x', | ||
| gas_limit: 21000, | ||
| speed: 'fast' | ||
| }); | ||
| ``` | ||
|
|
||
| **Getting Transaction Status** | ||
|
|
||
| Before (Defender SDK): | ||
|
|
||
| ```jsx | ||
| import { Relayer } from '@openzeppelin/defender-sdk-relay-signer-client'; | ||
| const relayer = new Relayer({ apiKey: API_KEY, apiSecret: API_SECRET }); | ||
| const tx = await relayer.getTransaction(transactionId); | ||
| ``` | ||
|
|
||
| After (OpenZeppelin Relayer SDK): | ||
|
|
||
| ```typescript | ||
| import { RelayerApi, Configuration } from '@openzeppelin/relayer-sdk'; | ||
|
|
||
| const config = new Configuration({ | ||
| basePath: 'http://localhost:8080/api/v1', | ||
| accessToken: 'YOUR_API_KEY' | ||
| }); | ||
|
|
||
| const relayerApi = new RelayerApi(config); | ||
| const tx = await relayerApi.getTransactionById('your-relayer-id', transactionId); | ||
| ``` | ||
|
|
||
| **Listing Relayers** | ||
|
|
||
| Before (Defender SDK): | ||
|
|
||
| ```jsx | ||
| const { Defender } = require('@openzeppelin/defender-sdk'); | ||
| const client = new Defender({ | ||
| apiKey: 'YOUR_API_KEY', | ||
| apiSecret: 'YOUR_API_SECRET' | ||
| }); | ||
|
|
||
| const relayers = await client.relay.list(); | ||
| ``` | ||
|
|
||
| After (OpenZeppelin Relayer SDK): | ||
|
|
||
| ```typescript | ||
| import { RelayerApi, Configuration } from '@openzeppelin/relayer-sdk'; | ||
|
|
||
| const config = new Configuration({ | ||
| basePath: 'http://localhost:8080/api/v1', | ||
| accessToken: 'YOUR_API_KEY' | ||
| }); | ||
|
|
||
| const relayerApi = new RelayerApi(config); | ||
| const relayers = await relayerApi.listRelayers(); | ||
| ``` | ||
|
|
||
| #### API Method Mapping | ||
|
|
||
| | Defender SDK Method | OpenZeppelin Relayer SDK Method | | ||
| |--------------------|--------------------------------| | ||
| | `client.relaySigner.sendTransaction()` | `relayerApi.sendTransaction()` | | ||
| | `relayer.getTransaction()` | `relayerApi.getTransactionById()` | | ||
| | `relayer.list()` | `relayerApi.listTransactions()` | | ||
| | `relayer.replaceTransactionById()` | `relayerApi.replaceTransaction()` | | ||
| | `relayer.cancelTransactionById()` | `relayerApi.cancelTransaction()` | | ||
| | `relayer.sign()` | `relayerApi.sign()` | | ||
| | `relayer.signTypedData()` | `relayerApi.signTypedData()` | | ||
| | `relayer.getRelayer()` | `relayerApi.getRelayer()` | | ||
| | `relayer.getRelayerStatus()` | `relayerApi.getRelayerStatus()` | | ||
|
|
||
| For detailed migration instructions and support, visit the [OpenZeppelin Relayer documentation](/relayer). | ||
|
|
||
| --- | ||
|
|
||
| ## Support and Resources | ||
|
|
||
| ### Documentation | ||
| - [OpenZeppelin Monitor Documentation](/monitor) | ||
| - [OpenZeppelin Relayer Documentation](/relayer) | ||
|
|
||
| ### Getting Help | ||
| If you encounter issues during migration or have questions: | ||
| - Review the respective documentation for each tool | ||
| - Check GitHub repositories for issues and discussions | ||
| - Reach out to the OpenZeppelin community | ||
|
|
||
| ### Migration Checklist | ||
|
|
||
| Use this checklist to track your migration progress: | ||
|
|
||
| #### Monitor Migration | ||
| - [ ] Export Monitor configurations from Defender | ||
| - [ ] Review and update placeholder values (API keys, RPC URLs, etc.) | ||
| - [ ] Set up OpenZeppelin Monitor infrastructure | ||
| - [ ] Import and configure monitors | ||
| - [ ] Recreate custom action logic | ||
| - [ ] Test alert triggers | ||
| - [ ] Run in parallel with Defender Monitor | ||
| - [ ] Switch over and decommission Defender monitors | ||
|
|
||
| #### Relayer Migration | ||
| - [ ] Export Relayer configurations from Defender | ||
| - [ ] Review and update placeholder values (signers, RPC URLs, policies) | ||
| - [ ] Set up OpenZeppelin Relayer infrastructure | ||
| - [ ] Import and configure relayers | ||
| - [ ] Update SDK integration code (if applicable) | ||
| - [ ] Test transaction processing | ||
| - [ ] Run in parallel with Defender Relayers | ||
| - [ ] Transfer funds from Defender Relayers | ||
| - [ ] Gradually move traffic to OpenZeppelin Relayers | ||
| - [ ] Decommission Defender Relayers | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.