For the complete documentation index, see llms.txt. This page is also available as Markdown.

Setup Instructions

Setup Instructions for TonRandcast

Prerequisites

Before you begin setting up TonRandcast, ensure you have the following:

  1. System Requirements:

    • A machine with at least 4GB RAM and a stable internet connection.

    • Node.js (v22.0.0 or higher) installed.

    • Access to a TON blockchain wallet and account.

  2. Software Requirements:

    • Blueprint: A development environment for TON smart contracts.

    • Package manager (npm, yarn, or pnpm).

    • Git for version control.

  3. Blockchain Accounts:

    • An Optimism wallet and contract address to monitor events.

    • A TON account for deploying and interacting with the contract.

  4. Access to Dependencies:

    • Ensure you have access to required libraries for TON and Optimism SDKs.

Step-by-Step Setup

1. Create a New Project

Run the following command to create a new project:

This will generate a project scaffold with a simple counter contract example. Replace tact-counter and TonRandcast as needed for customization.

2. Navigate to the Project Directory

Move into the created project directory:

3. Install Dependencies

Install the necessary dependencies for the project:

4. Compile the TonRandcast Contract

Use the Blueprint build command to compile the Tact contract:

This will generate the compiled contract files in the build directory.

5. Deploy the Contract to TON Blockchain

Blueprint provides an easy way to deploy contracts. Use the following command to deploy the contract:

Replace deployTonRandcast with the actual deployment script name for your contract. Ensure you have sufficient TON tokens for the deployment fees.

6. Configure the Node.js Relay

The relay script bridges events from Optimism to TON. Set up the relay by modifying the config.json file with the following details:

  • Optimism RPC URL

  • TON Wallet and Contract Address

  • Event Details (e.g., RollDiceResult, DrawTicketsResult)

Example config.json:

7. Run the Relay Script

Start the relay script to begin monitoring events on Optimism and pushing them to TON:

Monitor the logs to ensure the script is running correctly and processing events.

8. Test the Setup

  1. Trigger a sample event on Optimism (e.g., RollDiceResult).

  2. Verify that the event is captured and mirrored on TON by querying the TonRandcast contract.

Use the TON blockchain explorer to confirm the contract's state.

Optional: Eigenlayer Integration

Coming Soon

Troubleshooting

  • Missing Dependencies: Ensure all required software is installed and accessible from the command line.

  • Insufficient Tokens: Check your TON wallet balance before deploying contracts.

  • Event Monitoring Issues: Verify the Optimism RPC URL and contract address in the relay configuration.

You are now ready to deploy and use TonRandcast. For detailed examples and advanced configurations, refer to the other sections of this documentation.

Last updated