<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Xavier Arias on Medium]]></title>
        <description><![CDATA[Stories by Xavier Arias on Medium]]></description>
        <link>https://medium.com/@xavier_75953?source=rss-292f7d9dcda1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*Fj80MD6cydNEYhvznxFrlg.jpeg</url>
            <title>Stories by Xavier Arias on Medium</title>
            <link>https://medium.com/@xavier_75953?source=rss-292f7d9dcda1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 23:26:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@xavier_75953/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Announcing Web3j Eth2 Beacon Node API Client]]></title>
            <link>https://medium.com/web3labs/announcing-web3j-eth2-beacon-node-api-client-9f821996ba0d?source=rss-292f7d9dcda1------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f821996ba0d</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[open-api]]></category>
            <category><![CDATA[web3j]]></category>
            <dc:creator><![CDATA[Xavier Arias]]></dc:creator>
            <pubDate>Tue, 29 Dec 2020 15:02:35 GMT</pubDate>
            <atom:updated>2021-01-16T01:01:24.436Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fCjY_Fg7CQMsVbvKtKIJnQ.png" /></figure><p>Following the recent <a href="https://beaconcha.in/">launch</a> of the Ethereum 2.0 Beacon Chain, Web3 Labs are very excited to announce our first contribution to the Eth2 ecosystem: the Web3j <a href="https://github.com/web3j/web3j-eth2">Beacon Node API client</a>.</p><p>This client is a thin library that will allow you to interact fluently with the new Eth2 nodes using the methods available in the <a href="https://ethereum.github.io/eth2.0-APIs/">Eth2.0-API</a> specification, including event subscriptions. As a Web3j library we’ve kept everything as simple as possible for users to get them on their way quickly.</p><p>In this article we will guide you through the few steps required to get your application interacting with any Eth2 Beacon Chain Node.</p><h3>Getting started</h3><p>First, you’ll need to add the library to your project, either using Maven:</p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;org.web3j.eth2&lt;/groupId&gt;<br>    &lt;artifactId&gt;beacon-node-api&lt;/artifactId&gt;<br>    &lt;version&gt;1.0.0&lt;/version&gt;<br>&lt;/dependency&gt;</pre><p>or Gradle:</p><pre>implementation ‘org.web3j.eth2:beacon-node-api:1.0.0’</pre><p>At the moment of writing this article, the first released version 1.0.0 corresponds to the Eth2 specification v0.12.2. Check the project <a href="https://github.com/web3j/web3j-eth2/releases">releases page</a> for the last available version.</p><p>Once you have added the library to your project, you can create a client instance pointing to a particular Beacon Chain node in a familiar Web3j-esque way:</p><pre><strong>var</strong> service = <strong>new</strong> BeaconNodeService(“http://...”);<br><strong>var</strong> client = BeaconNodeClientFactory.build(service);</pre><p>And that’s it! At this point, you can start calling the node endpoints, for instance to retrieve the head block:</p><pre><em>client.getBeacon().getBlocks()<br>    .findById(NamedBlockId.HEAD);</em></pre><p>Or to retrieve all current attester slashings:</p><pre><em>client.getBeacon().getPool()<br>    .getAttesterSlashings()<br>    .findAll();</em></pre><p>If you don’t know a Beacon Chain node where you can point your client code, in the next section we’ll guide you through a few simple steps to get a test network up and running.</p><h3>Start a test network</h3><p>In this section we’ll be using the <a href="https://github.com/ConsenSys/teku">Teku</a> Beacon Chain implementation to start a local test network where to point your client code (before this, make sure you are running a <a href="https://www.docker.com/products/docker-desktop">Docker</a> environment).</p><p>First, clone the Teku project in a local folder:</p><pre><em>$ git clone </em><a href="https://github.com/ConsenSys/teku.git"><em>https://github.com/ConsenSys/teku.git</em></a></pre><p>Then start the Beacon Chain local network (check the <a href="https://github.com/ConsenSys/teku/tree/master/test-network">Teku docs</a> for more information on the Docker Testnet):</p><pre><em>$ teku/test-network/launch.sh<br>Recreating test-network_teku1_1 … done<br>Starting test-network_prometheus_1 … done<br>Starting test-network_node-exporter_1 … done<br>Recreating test-network_teku4_1 … done<br>Recreating test-network_teku2_1 … done<br>Recreating test-network_teku3_1 … done<br>Starting test-network_grafana_1 … done</em></pre><p>You’ll get a bunch of logs, but once your network has completely started you’ll be able to point to any of the four nodes at ports 19601, 19602, 19603 and 19604.</p><h3>Listen for events</h3><p>Let’s create a client and listen to some events happening in the test network:</p><pre><strong><em>var</em></strong><em> service = </em><strong><em>new</em></strong><em> BeaconNodeService(“http://localhost:19601/&quot;);<br></em><strong><em>var</em></strong><em> client = BeaconNodeClientFactory.build(service);</em></pre><pre><em>// We want to receive at least one event<br></em><strong><em>var</em></strong><em> latch = </em><strong><em>new</em></strong><em> CountDownLatch(1);</em></pre><pre><em>// At the moment we are interested in any topic<br></em><strong><em>var</em></strong><em> topics = EnumSet.allOf(BeaconEventType.</em><strong><em>class</em></strong><em>);</em></pre><pre><em>// Then subscribe to each event<br>client.getEvents().onEvent(topics, event -&gt; {<br>     System.out.println(“Received event: “ + event);<br>     latch.countDown();<br>});</em></pre><pre><em>// Wait for the event<br>latch.await();</em></pre><p>When running this code, you should be able to see some logs showing the interaction between your client and the local node:</p><pre><em>00:15:47.744 [jersey-client-async-executor-0] DEBUG org.web3j.eth2.api.BeaconNodeService — 2 * Sending client request on thread jersey-client-async-executor-0<br>2 &gt; GET </em><a href="http://localhost:19601/eth/v1/events?topics=head%2Cblock%2Cattestation%2Cvoluntary_exit%2Cfinalized_checkpoint%2Cchain_reorg"><em>http://localhost:19601/eth/v1/events?topics=head%2Cblock%2Cattestation%2Cvoluntary_exit%2Cfinalized_checkpoint%2Cchain_reorg</em></a><em><br>2 &gt; Accept: text/event-stream</em></pre><pre><em>00:15:51.420 [jersey-client-async-executor-0] DEBUG org.web3j.eth2.api.BeaconNodeService — 2 * Client response received on thread jersey-client-async-executor-0<br>2 &lt; 200<br>2 &lt; Cache-Control: no-cache<br>2 &lt; Connection: close<br>2 &lt; Content-Type: text/event-stream;charset=utf-8<br>2 &lt; Date: Thu, 10 Dec 2020 23:15:47 GMT<br>2 &lt; Server: Javalin<br>event: head<br>data: {“slot”:”33207&quot;,”block”:”0x1829e81553bb76ed92a7ae2d671e018b219b7eeee0cea80fac12b2a7d6924826&quot;,”state”:”0xe7339bff5fbb2a30f039a900532cb936e6afbd40ef1fd41cb645687659d8833a”,”epoch_transition”:false,”previous_duty_dependent_root”:”0xd34981d5ab59d4d091992099cedea95236dfcc2252f55f53e282ee847fb426e8&quot;,”current_duty_dependent_root”:”0x626db3e484c19fa8f0c57ca6c390bfa8a61313564d61f4c68764239a4e0c966e”}</em></pre><p>As you can see, when running this example the first event we received was a <em>head</em> event. This happens after a validator committee attests for a head block at every slot (typically every few seconds).</p><p>You can easily modify the above example to work with other topics such as epoch finality checkpoints, validator attestations or new blocks by specifying different sets of Beacon event types.</p><p>You’re now well on your way for exploring Eth2 data! We’d love to hear how you find the library and what you’re building with it. Feel free to jump onto our <a href="https://community.web3labs.com/c/web3j/">Community Forum</a> to chat to us about it and check out the project docs at <a href="https://github.com/web3j/web3j-eth2/">https://github.com/web3j/web3j-eth2/</a>.</p><p>As the Eth2 landscape evolves we will be continuing to support it via Web3j at Web3 Labs. We hope that you’re excited as we are about the network launch and look forward to seeing more great features emerge in the future!</p><p>This post first appeared on the Web3 Labs blog at <a href="https://blog.web3labs.com/announcing-web3j-eth2-beacon-node-api-client">https://blog.web3labs.com/announcing-web3j-eth2-beacon-node-api-client</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f821996ba0d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/web3labs/announcing-web3j-eth2-beacon-node-api-client-9f821996ba0d">Announcing Web3j Eth2 Beacon Node API Client</a> was originally published in <a href="https://medium.com/web3labs">Web3 Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing web3j — Aion integration]]></title>
            <link>https://medium.com/web3labs/announcing-web3j-aion-integration-9be0150bd0f5?source=rss-292f7d9dcda1------2</link>
            <guid isPermaLink="false">https://medium.com/p/9be0150bd0f5</guid>
            <category><![CDATA[aion-network]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[web3j]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Xavier Arias]]></dc:creator>
            <pubDate>Wed, 04 Sep 2019 17:14:46 GMT</pubDate>
            <atom:updated>2020-12-21T19:15:05.556Z</atom:updated>
            <content:encoded><![CDATA[<h3>Announcing Web3j — Aion integration</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/158/1*cL55_rcPr5fumLWj9u5U1g@2x.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/123/1*bvBBmXTYY3C9bnh83EWZ3A.png" /></figure><p>After intense collaboration with the<a href="https://aion.network/"> Aion network</a> team, Web3 Labs is proud to announce the availability of the <a href="https://github.com/web3j/aion">Web3j Aion</a> integration to support the<a href="https://github.com/aionnetwork/AVM"> Aion Virtual Machine</a> (AVM). The AVM is a JVM-compliant blockchain execution environment that unlocks the entire Java ecosystem and enables you to write smart contracts in Java.</p><p>Developed under the<a href="https://aion.network/bounty/"> Aion Bounties &amp; Grants program</a>, the <em>Web3j Aion</em> project is now part of the web3j ecosystem of interoperable tools integrated with the blockchain infrastructure and is <strong>publicly</strong> available in <a href="https://mvnrepository.com/artifact/org.web3j.aion">Maven Central</a> and <a href="https://bintray.com/web3j/maven/org.web3j.aion">jCenter</a> repositories.</p><h3>The web3j Aion project</h3><p>It has been great working with a group of like-minded engineers. Like the <a href="https://aion.network/team/">Aion team</a>, we are passionate technologists who strive to keep blockchain technology simple and share the common belief about the <a href="https://blog.aion.network/aion-virtual-machine-avm-why-java-and-the-jvm-240b78ad8a77">future of Java</a> and the JVM for the blockchain.</p><p>When we started the <a href="https://github.com/web3j/web3j-aion">web3j-aion</a> project our intentions were clear. We wanted to make it easier for Java/JVM developers who work with Ethereum to use the Aion blockchain network in a way that complemented the Aion stack. Also, we wanted to help unblock developers building dApps, whilst promoting open-source.</p><p>The <a href="https://github.com/web3j/web3j-aion">web3j-aion</a> project adds to the existing Aion Java development stack: a <a href="https://www.bloxbean.com/portfolio-item/aion4j-maven-plugin/">Maven plugin</a> and <a href="https://plugins.jetbrains.com/plugin/12047-aion4j-avm-integration">IntelliJ Idea plugin</a>. By integrating with the familiar Web3j API, the Aion network becomes accessible for developers who already use web3j to work with Ethereum. This brings similar capabilities of the JavaScript <a href="https://docs.aion.network/docs/aion-web3">web3-aion</a> and <a href="https://docs.aion.network/docs/ethersjs">Ethers.js</a> libraries to the Java ecosystem.</p><p>It also grows the number of <a href="http://web3j.io/">Web3j</a> integrations available for a diverse array of blockchain clients and platforms, which already includes Parity, Geth and <a href="https://github.com/PegaSysEng/pantheon">Pantheon</a>, and <a href="https://github.com/web3j/quorum">Quorum</a>.</p><h3>Getting started</h3><p>To get up and running quickly, we created the Web3j Aion<a href="https://github.com/web3j/web3j-aion-samples"> samples repository</a>. It allows you to understand the entire lifecycle of your blockchain code and Aion smart contracts, from development to deployment. Running the following commands will enable you to get a Java Aion smart contract up and running in a few steps:</p><h4>Clone the samples repository</h4><pre>git clone git@github.com:web3j/web3j-aion-samples.git<br>cd web3j-aion-samples</pre><h4>Compile the HelloWorld contract</h4><p>To simplify the starting process, in the samples project we have included a test module. This contains a simple<a href="https://docs.aion.network/docs/contract-fundamentals"> Java contract</a> that you can modify and run so that you can get familiar with the Web3j for Aion development environment:</p><pre><strong>public class</strong> HelloAvm {<br>    <strong>private static</strong> String <em>myStr </em>= “Hello AVM”;</pre><pre>    @Callable<br>    <strong>public static void</strong> sayHello() {<br>        Blockchain.<em>println</em>(“Hello Avm”);<br>    }</pre><pre>    @Callable<br>    <strong>public static</strong> String greet(String name) {<br>        <strong>return</strong> “Hello “ + name;<br>    }</pre><pre>    ...<br>}</pre><p>This contract, generated with the<a href="https://github.com/bloxbean/avm-archetype"> <em>aion4j</em> Maven archetype</a>, demonstrates a very basic interaction with a contract by printing some logs, greeting with a given name and getting/setting a text stored as the contract state. To compile it, from the samples project run the commands:</p><pre>cd hello-world-avm<br>./mvnw initialize<br>./mvnw install<br>cd ..</pre><h4>Generate the HelloWorld contract wrapper</h4><p>Once the contract compilation is complete, the created artefacts will be in the target folder of the Maven project. Use them as the input for the contract wrapper generation task, which you can run with the command:</p><pre>./gradlew generateContractWrappers</pre><p>This task runs the web3j Aion<a href="https://github.com/web3j/web3j-aion/tree/master/codegen"> command-line tools</a> to generate the<a href="https://docs.web3j.io/smart_contracts.html#deploying-and-interacting-with-smart-contracts"> Web3j contract wrapper</a>. You can use this to deploy and interact with the smart contract:</p><pre>// Create an Aion instance with a node URL<br>Aion aion = Aion.<em>build</em>(<strong>new</strong> HttpService(&quot;...&quot;));</pre><pre>// Create a manager for local transaction signing with a private key<br><strong>var</strong> manager = <strong>new</strong> AionTransactionManager(<br>    aion, <strong>new</strong> Ed25519KeyPair(&quot;...&quot;), VirtualMachine.<em>AVM<br></em>);</pre><pre>// Deploy the HelloAvm contract<br><strong>var</strong> contract = HelloAvm.deploy(<br>    aion, manager, AionGasProvider.INSTANCE<br>).send();</pre><pre>// Call greet and receive &quot;Hello John&quot;<br><strong>var</strong> result = contract.call_greet(&quot;John&quot;).send();</pre><p>For more details on running an end-to-end test using this contract wrapper on an Aion network, check the <a href="https://github.com/web3j/web3j-aion-samples">project documentation</a> and the <a href="https://docs.aion.network/docs/tutorials-web3j">Web3j Aion tutorial</a>. Check also the official <a href="https://medium.com/@aion_network/web3j-is-now-live-on-aion-network-7180bd393463">Aion blog post</a> on the project announcement.</p><h3>What’s next?</h3><p>We’re really excited with this support for Aion in Web3j, and keen to hear from you, the community on how you’re finding it.</p><p>If you have any suggestions for the project, please create a <a href="https://github.com/web3j/aion/issues">new issue</a>, or even better submit a pull request!. We will be happy to integrate improvements and new features to the library.</p><p>This post first appeared on the Web3 Labs blog at <a href="https://blog.web3labs.com/announcing-web3j-aion-integration">https://blog.web3labs.com/announcing-web3j-aion-integration</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9be0150bd0f5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/web3labs/announcing-web3j-aion-integration-9be0150bd0f5">Announcing web3j — Aion integration</a> was originally published in <a href="https://medium.com/web3labs">Web3 Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>