Skip to content

ynohtna92/ord20-indexer

Repository files navigation

Ord20 Indexer (ord-20) library

This indexer fully implements the ordinals meta protocol of brc-20/ltc-20/drc-20 to hereby be known as ord-20.

Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Roadmap
  4. Contributing
  5. License
  6. Contact

About The Project

Developers of the meta protocol ord-20 can integrate this indexer in the code according to their needs.

Once the indexer is started and connected to a local ordinals server, it will process each block one by one and populate the postgreSQL database with a detailed list of all token information, holder balances, and inscription transfer history.

Getting Started

Ord20 Indexer and its prerequisites can be installed from the command line.

Prerequisites

  1. Install Rust and its Dependencies

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

    This project is developed with rust and can be built from source.

    # Linux dependencies
    sudo apt install libpq-dev libssl-dev
  2. Install PostgreSQL

  • PostgreSQL (Linux)
    sudo apt-get install postgresql postgresql-client
    Start PostgreSQL CLI as the postgres user
    sudo -u postgres psql
    
    Modify the PostgreSQL password
    sudo -u postgres psql
    \password
    
    # Set a unique password and modify .env otherwise set to 'password'
    
  • PostgreSQL (Mac)
    brew install postgresql
    Start the server:
    brew services start postgresql
    
  1. Install Diesel
    cargo install diesel_cli --no-default-features --features postgres

Installation

  1. Clone the repo and build the binary

    git clone https://github.com/ynohtna92/ord20-indexer.git
    cd ord20-indexer
    cargo build --release
  2. Download Litecoin core 0.21.2.2 from official website https://litecoin.org/

    tar -zxvf litecoin-0.21.2.2-x86_64-linux-gnu.tar.gz
    sudo install -m 0755 -o root -g root -t /usr/local/bin ~/litecoin-0.21.2.2/bin/*
  3. Edit the litecoin.conf file of the full node

    cd ~/.litecoin
    vi litecoin.conf
    

    Add the following configurations and save

    txindex=1
    rpcserialversion=1
    
  4. Run the Litecoin full node until it is fully synchronised (depend on your network, it will generally take up to several hours to days to sync)

  5. Clone the ordinals repo and build the ord server.

    git clone https://github.com/ynohtna92/ord-litecoin.git
    cd ord-litecoin
    git checkout api-15
    cargo build --release
  6. Run the ordinals server, and allow it to fully synchronise.

    ./ord server -j
    
  7. Configure the ord20-indexer in your .env file.

    # The ordinals metaprotocol to index (brc-20, ltc-20, drc-20)
    META_PROTOCOL=ltc-20
    
    # Starting index block height
    START_BLOCK=2465225
    
    # How many blocks to stay behind to reduce the impact of block reorganisations (0 = disabled, 6 = recommended)
    BLOCKS_BEHIND=6
    
    # The ordinals server address (https://ordinals.com/, https://ordinalslite.com/, http://localhost/)
    ORDINALS_BASE_URL=http://localhost/
    
    # The postgres database credentials and url
    DATABASE_URL=postgres://postgres:password@localhost/ord20-indexer
    
  8. Create database and then run the database installation scripts

    sudo -u postgres -p password createdb ord20-indexer
    diesel migration run
    
  9. Run the ord-20 indexer

    ./target/release/ord20-indexer
    

Roadmap

  • Extend the application to cover multiple ordinal meta protocols.
  • Index directly from full nodes using the binary data found in blocks and transactions

See the open issues for a full list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the GNU v3 License. See LICENSE.txt for more information.

Contact

Twitter/X - @anthonyonchain

Project Link: https://github.com/ynohtna92/ord20-indexer.git

(back to top)