If you’ve ever wanted to dive into the world of ERC-20 tokens, you’re in the right place! This article will guide you through the process of using a RESTful service built with Spring Boot and web3j to create and manage your own ERC-20 tokens. We’ll cover everything from building the application to troubleshooting common issues, so you can become a pro in no time!
What You Need
Building the Application
Let’s kick off our journey by building the application. This is similar to laying the foundation of a house before you can start decorating it. To create a runnable JAR file, execute the following command:
bash ./gradlew clean build
Running the Application
Once built, you need to run your application. Think of it as flipping the switch to light up that house you just built. Use the command below to start the service:
bash java -jar build/libs/azure-demo-0.1.jar
The application by default logs to a file named erc20-web3j.log.
Configuration
Configuration is crucial as it dictates how your application will interact with the Ethereum or Quorum nodes. Below are the default properties used by this application:
- Port for service to bind to: 8080
- Log file path and name: logs/erc20-rest-service.log
- Node Endpoint: http://localhost:22000
- From Address: 0xed9d02e382b34818e88b88a309c7fe71e65f419d
You can override these properties by creating a file named application.properties in the root directory of your application or use a YAML configuration with application.yml.
Using the Application
All available application endpoints are documented using Swagger. You can access the Swagger UI at http://localhost:8080/swagger-ui.html. This interface allows you to easily perform POST and GET requests to deploy, transact, and query the state of your ERC-20 tokens.

Docker Deployment
Using Docker makes it even easier to deploy an instance of your service. It’s like having a portable home that can go wherever you want! Follow these steps to get started:
First, build the Dockerfile:
docker build -f docker/Dockerfile -t blk-io/erc20-service .
Then, run it with default configuration:
docker run -p 8080:8080 -v $PWD/logs:logs blk-io/erc20-service
Or customize your configuration:
export PORT=8081
docker run -p $PORT:$PORT -v $PWD/logs:logs \
-e ENDPOINT=http://localhost:22001 \
-e FROMADDR=0xca843569e3427144cead5e4d5999a3d0ccf92b8e \
-e PORT=$PORT \
blk-io/erc20-service
Troubleshooting
Encounter an issue during setup? Don’t worry; it happens to the best of us! Here are some troubleshooting ideas:
- Ensure that your Ethereum or Quorum node is running and accessible at the specified endpoint.
- Check the logs in erc20-web3j.log for any error messages that might give a clue.
- Verify that the address you are using has been unlocked in your client.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Conclusion
Congratulations! You now have a solid foundation in creating and managing ERC-20 tokens using this RESTful service. As new developments arise, remember that 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.