Code Monkey home page Code Monkey logo

race-ronin-chain's Introduction

Labs

Chainstack is the leading suite of services connecting developers with Web3 infrastructure

         

Supported protocolsChainstack blogChainstack docsBlockchain API referenceStart for free

Race Ronin Chain

An (almost) on-chain game where you race the Ronin chain based on block hashes using the Foundry framework.

See the full details in the Chainstack Developer Portal — Ronin: On-Chain meta racing game

Prerequisites

Before you start, ensure you have the following:

  • Chainstack account: Needed to deploy a Ronin node. Start for free.
  • Foundry: Used for compiling, testing, and deploying the contract. Follow the installation instructions here.
  • web3.py: Necessary for participation and winner calculation & submission scripts. Installation can be done via pip: pip install web3.

Quick Start

  1. Clone the repository: Access all necessary files for the game.

    git clone https://github.com/Chainstacklabs/race-ronin-chain.git
    cd race-ronin-chain
    
  2. Add your Chainstack RPC node: Add your Chainstack RPC node URL to the foundry.toml file.

    [profile.default]
    version = "0.8.19"
    src = "src"
    out = "out"
    libs = ["lib"]
    eth_rpc_url = "CHAINSTACK_NODE_ENDPOINT"
    
  3. Generate the contract ABI: If you modify the contract, generate a new ABI with:


forge build --silent && jq '.abi' ./out/RaceRoninChain.sol/RaceRoninChain.json > ./abi/RaceRoninChain.abi

  1. Deploy the contract: Ronin does not support EIP-1559, so use legacy transactions.

forge create src/RaceRoninChain.sol:RaceRoninChain --private-key YOUR_PRIVATE_KEY --constructor-args TREASURY_ADDRESS --legacy

Replace YOUR_PRIVATE_KEY with your deployer private key and TREASURY_ADDRESS with the address to receive the house fees.

  1. Interact with the contract: Use the provided Python scripts to enter races and compute & submit winners.
  • enter_race.py: For generating predictions and entering races.
  • compute_stats_and_submit_winner.py: For calculating and submitting race winners.

Ensure to provide necessary variables like private keys, addresses, and Chainstack

endpoints within the scripts.


race-ronin-chain's People

Contributors

akegaviar avatar soos3d avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.