Skip to main content
This guide uses the existing Ethereum implementation as a reference for adding a new blockchain to the VisualSign parser system.

Prerequisites

  • Rust development environment
  • Access to the visualsign-parser workspace
  • Access to the visualsign-display workspace (for UI testing in step 6)
  • Understanding of the target blockchain’s transaction format

Step 1: Copy visualsign-unspecified as starting point

  1. Navigate to the chain parsers directory:
  2. Copy the unspecified template:
    Replace <your-chain> with your blockchain name (e.g., visualsign-cosmos, visualsign-aptos)
  3. Update the new chain’s Cargo.toml:
  4. Add your new chain to the workspace Cargo.toml:

Step 2: Implement required traits

In your new chain’s src/lib.rs, implement the required traits:

Transaction trait

The Transaction trait defines how to parse raw transaction data:

VisualSignConverter trait

The VisualSignConverter trait handles the conversion to human-readable format:

Step 3: Write tests

Create comprehensive tests in your chain parser:

Step 4: Add to registry

  1. Add your chain to the proto definition in proto/parser/parser.proto:
  2. Regenerate proto code:
  3. Update src/parser/app/src/chain_conversion.rs:
  4. Add your chain to the registry enum in src/visualsign/src/registry.rs:
  5. Add your chain dependency to src/parser/app/Cargo.toml:
  6. Register your converter in src/parser/app/src/routes/parse.rs:

Step 5: Test with gRPC or parser CLI

You can test in two ways - either run the gRPC service for the app which requires building the whole stack, or call the parser_cli directly.

Option A: gRPC parser

  1. Build and run the parser service:
  2. Test your implementation with grpcurl:

Option B: Parser CLI

Step 6: Test UI rendering

  1. Navigate to the visualsign-display repository
  2. Update the display service to handle your new chain type
  3. Test the end-to-end flow by sending transactions through the display interface
  4. Verify that your parsed transaction displays correctly in the UI with proper formatting and all relevant transaction details

Using existing Rust libraries

When a well-established Rust library exists for your blockchain, use it directly in your implementation:

Advanced: FFI integration

If no suitable Rust library exists and you need to use an implementation in another language (like Go), you can use FFI. The visualsign-goethereum implementation serves as an example:
  1. Create a build.rs file that compiles your foreign library:
  2. Create bindings for the foreign functions:
FFI adds complexity and should only be used when no suitable Rust library exists.

Testing your implementation

  1. Run unit tests:
  2. Run integration tests:
  3. Test with real transaction data using the gRPC interface
  4. Verify output formatting in the display UI
Your new chain should now be fully integrated into the VisualSign parser system.