# Transactions

A ITransaction is an interface for building, signing, and validating transactions.

The ITransaction in the Hive Ecosystem, provided by the Wax library, is a tool for creating and managing transactions on the Hive blockchain. It offers functionalities for building, signing, validating, and converting transactions.

# Transaction signing

Signing a transaction is a crucial step in ensuring its authenticity and integrity. The ITransaction interface provides methods for signing transactions using dedicated signers. This process involves creating a digital signature that verifies the transaction's origin and prevents tampering.

In our examples, we used a Beekeeper package that provides security in storing your keys. With it, you can easily import keys stored in your wallet and use them to sign transaction digests (signing-ready hashes). Beekeeper is available in multiple languages:

In our test environment, we have used Beekeeper in runner.js. Thanks to this functionality, to execute code examples, you can utilize specific functionalities of Beekeeper (wallet, privateKey, etc.) by simply destructuring the object available in globalThis:

/*
Here are presented all the available variables that can be used in the examples:

  `signer1`    - Beekeeper signer holding wallet with imported private key for publicKey1
  `signer2`    - Beekeeper signer holding wallet with imported private key for publicKey2
  `wallet`     - Raw Beekeeper wallet instance holding both keys for example usage of manually
                 signing using transaction digest (in both: legacy and HF26 ways)
  `publicKey1` - Public key corresponding to the first imported private key
  `publicKey2` - Public key corresponding to the second imported private key
*/
const { signer1, signer2, wallet, publicKey1, publicKey2 } = globalThis.snippetsBeekeeperData;
Test it yourself on github codespace: src/python/beekeeper_initialize.py
from beekeepy import Beekeeper

with Beekeeper.factory() as bk:
    # Create a new session to work with wallets
    session = bk.create_session()

    # Create a wallet with a given name and password
    wallet = session.create_wallet(name="my-wallet-name", password="my-wallet-password")

    # Import a private key into the wallet
    wallet.import_key(private_key="5KgfcV9bgEen3v9mxkoGw6Rhuf2giDRZTHZjzwisjkrpF4FUh3N")
    # Check if the wallet contains the matching private key
    assert wallet.has_matching_private_key(key="STM5gQPYm5bs9dRPHpqBy6dU32M8FcoKYFdF4YWEChUarc9FdYHzn")

    # Unlock the wallet so it can be used for signing and other operations
    wallet.unlock(password="my-wallet-password")
    # Ensure the wallet is unlocked
    assert wallet.is_unlocked()

    # At this point, the wallet is ready