DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • Distributed Tracing System (Spring Cloud Sleuth + OpenZipkin)
  • Using Kong Ingress Controller with Spring Boot Services
  • Component Tests for Spring Cloud Microservices
  • Migration of Microservice Applications From WebLogic to Openshift

Trending

  • Efficient API Communication With Spring WebClient
  • How To Introduce a New API Quickly Using Quarkus and ChatGPT
  • Introducing Graph Concepts in Java With Eclipse JNoSQL
  • Supervised Fine-Tuning (SFT) on VLMs: From Pre-trained Checkpoints To Tuned Models
  1. DZone
  2. Coding
  3. Frameworks
  4. Spring Boot and web3j: Easy Microservices for Ethereum Blockchain

Spring Boot and web3j: Easy Microservices for Ethereum Blockchain

web3j seamlessly integrates with Spring Frameworks. Simply create a new Spring Boot app, add the starter to your configuration, and create a service with web3j.

By 
Conor Svensson user avatar
Conor Svensson
·
Apr. 06, 17 · Tutorial
Likes (8)
Comment
Save
Tweet
Share
11.9K Views

Join the DZone community and get the full member experience.

Join For Free

web3j now seamlessly integrates with the Spring Framework thanks to the web3j Spring Boot Starter.

Using Spring Boot, it's trivial to create production-ready services using web3j to work with the Ethereum blockchain.

Start by creating a new Spring Boot application. Then add the web3j-spring-boot-starter to your Gradle or Maven configuration:

dependencies {
    compile 'org.web3j:web3j-spring-boot-starter:1.0.0'
    ...
}

Now, create a service using web3j, and Spring will create and configure the web3j instance for you!

@Service
public class Web3jSampleService {
 
    @Autowired
    private Web3j web3j;
 
    public String getClientVersion() throws IOException {
        Web3ClientVersion web3ClientVersion = web3j.web3ClientVersion().send();
        return web3ClientVersion.getWeb3ClientVersion();
    }
}

The default HTTP endpoint of your Ethereum client is used (http://localhost:8545). However, you can easily change this in your application properties file.

# An infura endpoint
web3j.client-address = https://morden.infura.io/<your token id>
 
# Or, an IPC endpoing
web3j.client-address = /path/to/file.ipc

Code for this example is available here. For further information on it, check out the web3j project home page and the spring-boot-starter project.

Spring Framework Spring Boot Ethereum Blockchain microservice

Published at DZone with permission of Conor Svensson, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Distributed Tracing System (Spring Cloud Sleuth + OpenZipkin)
  • Using Kong Ingress Controller with Spring Boot Services
  • Component Tests for Spring Cloud Microservices
  • Migration of Microservice Applications From WebLogic to Openshift

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!