Skip to content

mochimodev/exchange-tools

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Exchange tools for MCM3.0

Tool 1

A command-line tool that takes in a raw WOTS+ Public Key as 4416 Hex characters, and converts it into a MCM 3.0 address. The output can be either in Hex format (padded to 2x20 bytes) or in Base58 format with checksum.

Usage

# Build the tool
cd tool-1
go build

# Run the tool with hex output (default)
./tool-1 -wots <4416_character_hex_string>

# Run the tool with base58 output
./tool-1 -wots <4416_character_hex_string> -base58

The base58 output format includes a CRC16-XMODEM checksum and is useful for:

  • Human-readable address format
  • Error detection through checksum verification
  • Shorter representation of addresses
  • Compatibility with wallet displays and QR codes

Example outputs for the same address:

# Hex format
./tool-1 -wots <address>
> 9f810c2447a76e93b17ebff96c0b29952e4355f1

# Base58 format
./tool-1 -wots <address> -base58
> kHtV35ttVpyiH42FePCiHo2iFmcJS3

Tool 2

A command-line tool that generates WOTS Keypairs and their corresponding MCM 3.0 address, output as a JSON object in the format:

{
  "accounts": [
    {
      "mcmAccountNumber": "0000000000000000000000000000000000000000", // 20 bytes, padded hex
      "wotsPublicKey": "0000... (2208 bytes of padded hex)", // 2208 bytes, padded hex
      "wotsSecretKey": "00... (32 bytes of padded hex)" // 32 bytes, padded hex
    },
    {
      "mcmAccountNumber": "0000000000000000000000000000000000000001", // 20 bytes, padded hex
      "wotsPublicKey": "0000... (2208 bytes of padded hex)", // 2208 bytes, padded hex
      "wotsSecretKey": "00... (32 bytes of padded hex)" // 32 bytes, padded hex
    },
    // ... more accounts
  ]
}

Usage

# Build the tool
cd tool-2
go build

# Generate a single account
./tool-2

# Generate multiple accounts
./tool-2 -n 5  # Generates 5 accounts

Tool 3

A command-line tool that creates and signs Mochimo transactions, outputting them in a format compatible with the MeshAPI /construction/submit endpoint. The tool handles all cryptographic operations locally and produces a JSON output ready for network submission.

Usage

# Build the tool
cd tool-3
go build

# Run the tool with required parameters
./tool-3 \ 
  -src <20_bytes_hex>          # Source account address (TAG) \
  -source-pk <2208_bytes_hex>  # Source WOTS public key \
  -change-pk <2208_bytes_hex>  # Change WOTS public key \
  -balance <uint64>            # Source balance in nanoMCM \
  -dst <20_bytes_hex>          # Destination account address \
  -amount <int64>              # Amount to send in nanoMCM \
  -secret <32_bytes_hex>       # Secret key for signing \
  -memo "Optional memo"        # Optional transaction memo \
  -fee 500                     # Optional: Transaction fee in nanoMCM (default: 500)

Example Output

The tool outputs a JSON object ready for submission to the MeshAPI. Here's a sample interaction:

$ ./tool-3 -src 81998859591cf1f35fc174a40e14c8138e2a5e03 \
          -source-pk <2208_bytes_public_key> \
          -change-pk <2208_bytes_public_key> \
          -balance 10000 \
          -dst f5fc0d11f423e7849bd908dc8bbcabf3002ac0aa \
          -amount 8999 \
          -secret <32_bytes_secret> \
          -memo "TEST"

Resolving TAG 81998859591cf1f35fc174a40e14c8138e2a5e03
Resolved TAG 81998859591cf1f35fc174a40e14c8138e2a5e03 to address 0x81998...652e1 with amount 8999
{
  "network_identifier": {
    "blockchain": "mochimo",
    "network": "mainnet"
  },
  "signed_transaction": "000000008199885959...000000"
}

The tool performs several validations:

  • Verifies the source has sufficient balance for amount + fee
  • Validates that the secret key matches the source public key
  • Confirms all input parameters are of correct length
  • Checks that addresses are properly formatted

Common errors you might encounter:

Error: Insufficient balance to send amount and fee
Error: Public key does not match source address
Error: Source account address is required
Error: Invalid memo
Failed to resolve TAG: TAG not found
Failed to create transaction: exit status 1
Resolved TAG <address> to address 0x... (0) with amount <amount>  # TAG resolution success
Failed to resolve TAG <address>: TAG not found                    # TAG resolution failure

Tool 4

A utility tool that converts between hex format (40 characters representing 20 bytes) and base58 format with integrated checksum for MCM 3.0 addresses.

Usage

# Build the tool
cd tool-4
go build

# Convert hex to base58
./tool-4 -hex <40_character_hex_string>

# Convert base58 to hex
./tool-4 -base58 <base58_string>

Wallet Tool

An example MCM Wallet tool that also allows the sending of transactions to multiple-destinations using CSV files. Potentially useful for wallet developers or at-scale payment senders like exchanges.

About

Wallet tools utilized by exchanges to create addresses, submit transactions, and monitor them

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Go 100.0%