Welcome to the world of Trust Ray, an API designed for the Trust Ethereum Wallet that provides seamless access to various features of the Ethereum blockchain. This guide will walk you through the steps to deploy, utilize, and troubleshoot the Trust Ray API, allowing you to harness the full power of Ethereum’s decentralized features.
Features of Trust Ray
- Parsing the entire blockchain
- Retrieving transactions, including operations for ERC20 contract actions
- Retrieving ERC20 token balances
- Push notification service (not yet implemented)
Getting Started
To effectively use the Trust Ray API, you’ll need to follow some steps for deploying it either locally or on Heroku.
Deploy on Heroku
If you prefer a cloud deployment, simply click the button below:
Deploy on Heroku
Locally (Without Docker)
If you’re looking to run Trust Ray locally, follow these steps:
- Install required modules:
$ npm install
- Compile TypeScript:
$ npm run build
- Start the app:
$ node dist/server.js
- Run tests:
$ npm run build && npm test
Using Docker Containers
For a more containerized approach, here are the steps:
- Install Docker and Docker Compose
- Set the environment variable in your terminal:
export COMPOSE_FILE=docker-compose.yml:docker-compose.dev.yml
- Configure the MongoDB URI in your
.env
file:MONGODB_URI=mongodb://mongodb:27017/trust-wallet
- Run the following commands:
- Build the project:
trust build
- Start the app in Docker:
trust run
- Stop Docker containers:
trust stop
- View app logs:
trust logs
Understanding the Code Functionality
To better understand how Trust Ray operates, let’s consider the API as a post office in a busy city. Each time you want to send or receive a package (in this case, a transaction), you need an address (API endpoint) to direct your package to and a mailman (the API itself) who ensures your package reaches its destination quickly and correctly.
- Imagine parsing the blockchain as collecting all the letters (data) from every mailbox (block) around the city (blockchain) to keep track of who sent what and when.
- Retrieving transactions for ERC20 actions is akin to checking which packages contained special delivery options (contract actions), ensuring you know which items were sent under special conditions.
- Keeping track of ERC20 token balances is like maintaining a personal inventory list, where you jot down all the packages you have received.
Troubleshooting
If you encounter issues while using the Trust Ray API, here are some troubleshooting tips:
- Ensure all dependencies are correctly installed by running
$ npm install
. - Double-check your MongoDB URI and correct it if necessary.
- If the app doesn’t start, verify that you’ve successfully built the application with TypeScript.
- When encountering unexpected errors, try running your tests to catch any issues early.
- Consult the [API wiki](https://github.com/TrustWallet/trust-ray/wiki/API) for details on specific endpoints.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Contributing to Trust Ray
We aim to share our knowledge and findings as we develop Trust Ray. Feedback and bug reports are welcomed on GitHub. Be sure to include your operating system, device, version number, and steps to reproduce any reported issues, as all participants are expected to follow our code of conduct.
Conclusion
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.