Schedule Transaction

The Real blockchain, a decentralized Layer 1 (L1) network, empowers users, developers, and small and medium enterprises (SMEs) to tokenize real-world assets (RWAs) and engage in a global financial ecosystem. One of Real’s advanced features is the ability to schedule transactions, allowing users to automate and plan their on-chain activities with precision. This page explains the concept of scheduling transactions on the Real network, how it works, and how to use it.


Concept of Scheduling Transactions

Scheduling transactions on the Real blockchain refers to the ability to create and queue transactions that will be executed automatically at a specified future time or block height. This feature enables users to plan actions in advance, ensuring they occur at the right moment without requiring manual intervention. Scheduling transactions is particularly useful for automating repetitive tasks, ensuring timely payments, or coordinating complex workflows involving RWAs.

How It Works

Scheduling transactions on Real leverages the network’s smart contract functionality (via CosmWasm) and the underlying Tendermint-based consensus mechanism. Here’s the core concept:

  • Transaction Creation: A user creates a transaction (e.g., transferring $REAL tokens, staking, or tokenizing an RWA) and specifies a future execution condition, such as a specific block height or timestamp.

  • Smart Contract Integration: The transaction is wrapped in a smart contract that enforces the scheduling logic. The contract holds the transaction details and monitors the blockchain for the specified condition.

  • Execution Trigger: Once the condition is met (e.g., the target block height is reached), the smart contract automatically executes the transaction on-chain.

  • Security and Validation: The transaction is signed with the user’s private key at the time of scheduling, ensuring it cannot be altered. Validators verify the transaction when it’s executed, maintaining network security.

Key Features

  • Automation: Schedule recurring payments, staking operations, or RWA tokenization events without manual intervention.

  • Flexibility: Set transactions to execute at a specific block height, timestamp, or even based on external conditions (via oracles, if integrated).

  • Security: Scheduled transactions are cryptographically signed and stored on-chain, preventing tampering or unauthorized execution.

  • Transparency: All scheduled transactions can be viewed and tracked via the Real Mainnet Explorer.

Benefits

  • Efficiency: Automate repetitive tasks, saving time for users, SMEs, and developers.

  • Reliability: Ensure transactions occur at the exact moment they’re needed, even if you’re offline.

  • Use Case Versatility: Ideal for scenarios like subscription payments, vesting schedules for tokenized assets, or timed staking reward claims.

  • Scalability: Reduces the need for manual transaction submissions, improving the user experience as the Real network grows.

Scheduling Transactions on Real

Real provides tools and smart contract templates to schedule transactions easily. Below is an overview of how to schedule a transaction, along with an example use case.

Step 1: Set Up Your Environment

  1. Create an Account: Ensure you have a Real account with $REAL tokens. See our Accounts Guide for instructions.

  2. Install the Real CLI: Download the Real CLI (reald) from real.finance/downloads to interact with the network.

  3. Fund Your Account:

Step 2: Use a Scheduling Smart Contract

Real provides a pre-built CosmWasm smart contract template for scheduling transactions. You can deploy this contract and use it to schedule your transactions.

  1. Deploy the Scheduling Contract:

    • Clone the Real smart contract repository:

      git clone https://github.com/realfinance/real-scheduling-contract.git
    • Compile and deploy the contract using the Real CLI:

      reald tx wasm store scheduling_contract.wasm --from <YOUR_ADDRESS> --chain-id real-mainnet-1 --gas auto --fees 5000ureal

      Note the code_id (e.g., 1) returned by this command.

    • Instantiate the contract:

      reald tx wasm instantiate 1 '{}' --from <YOUR_ADDRESS> --chain-id real-mainnet-1 --label "SchedulingContract" --gas auto --fees 5000ureal

      Note the contract_address (e.g., real1sched...).

  2. Schedule a Transaction: Let’s schedule a transaction to transfer 100 $REAL tokens to another address at a specific block height (e.g., block 100,000).

    • Prepare the transaction message:

      {"transfer": {"recipient": "real1a2b3c4d5e6f7g8h9i0", "amount": "100000000ureal"}}
    • Schedule the transaction using the contract:

      reald tx wasm execute <CONTRACT_ADDRESS> '{"schedule": {"message": {"transfer": {"recipient": "real1a2b3c4d5e6f7g8h9i0", "amount": "100000000ureal"}}, "block_height": 100000}}' --from <YOUR_ADDRESS> --chain-id real-mainnet-1 --gas auto --fees 5000ureal
    • The contract will execute the transfer when block 100,000 is reached.

Step 3: Monitor the Scheduled Transaction

  • Use the Real Mainnet Explorer to track your scheduled transaction:

    • Search for the contract address to view scheduled transactions.

    • Monitor the blockchain’s block height to see when your transaction will execute.

  • Once the block height is reached, the transaction will be executed automatically, and you can verify it on the explorer.

Example Use Case: Automating RWA Vesting

An SME tokenizes a piece of real estate on Real and wants to distribute ownership tokens to investors over time (e.g., 10% of tokens every month for 10 months). They can:

  1. Deploy the scheduling contract.

  2. Schedule 10 transactions, each releasing 10% of the tokens to investors at monthly intervals (based on block height or timestamp).

  3. Investors receive their tokens automatically without the SME needing to manually initiate each transfer.

Best Practices

  • Test on the Testnet First: Schedule transactions on the REAL Testnet to ensure your setup works as expected before deploying on the Mainnet.

  • Set Realistic Conditions: Choose block heights or timestamps that align with your needs. Use the Real Explorer to estimate block times (e.g., ~6 seconds per block).

  • Account for Fees: Ensure your account has enough $REAL tokens to cover scheduling and execution fees.

  • Monitor Execution: Keep an eye on the blockchain to confirm your transaction executes as planned. Check for errors (e.g., insufficient funds) that might cause the transaction to fail.

Limitations

  • Irreversibility: Once a transaction is scheduled and the condition is met, it cannot be canceled unless the smart contract includes a cancellation mechanism.

  • Block Height Dependency: If the network experiences delays or forks, the exact timing of execution may vary slightly.

  • Smart Contract Risks: Ensure the scheduling contract is audited to avoid vulnerabilities that could lead to failed or malicious executions.


Need Help?

If you have questions about scheduling transactions on Real, reach out to our team:

Scheduling transactions on Real enables you to automate and plan your on-chain activities with ease, from RWA tokenization to staking and payments. Start scheduling today to streamline your interactions with the Real ecosystem!

Last updated