<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ekiserrepe</title>
    <description>The latest articles on DEV Community by Ekiserrepe (@ekiserrepe).</description>
    <link>https://dev.to/ekiserrepe</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2566188%2F7a495bef-23eb-4ea3-b35b-0f016abf67f4.png</url>
      <title>DEV Community: Ekiserrepe</title>
      <link>https://dev.to/ekiserrepe</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ekiserrepe"/>
    <language>en</language>
    <item>
      <title>Learning Xahau: Building an Automatic NFT Factory with Hooks</title>
      <dc:creator>Ekiserrepe</dc:creator>
      <pubDate>Sat, 14 Mar 2026 20:36:05 +0000</pubDate>
      <link>https://dev.to/ekiserrepe/learning-xahau-building-an-automatic-nft-factory-with-hooks-4j44</link>
      <guid>https://dev.to/ekiserrepe/learning-xahau-building-an-automatic-nft-factory-with-hooks-4j44</guid>
      <description>&lt;p&gt;Welcome to a new chapter of &lt;a href="https://dev.to/ekiserrepe/series/31668"&gt;Learning Xahau&lt;/a&gt;, where we explore the theoretical and practical aspects of the Xahau blockchain. If you are new to the series, I recommend starting with the &lt;a href="https://dev.to/ekiserrepe/learning-xahau-what-is-xahau-104j"&gt;first article&lt;/a&gt; to understand what Xahau is and what makes it different.&lt;/p&gt;

&lt;p&gt;Today we are going to build something concrete: an &lt;strong&gt;automatic NFT factory&lt;/strong&gt;. A Hook that turns a Xahau account into a URIToken vending machine: the user pays, the Hook mints. No marketplace. No backend. No servers. Just on-chain logic.&lt;/p&gt;

&lt;p&gt;The source code is available at: &lt;a href="https://github.com/Ekiserrepe/auto_nft_factory_xahau" rel="noopener noreferrer"&gt;https://github.com/Ekiserrepe/auto_nft_factory_xahau&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  The problem we want to solve
&lt;/h2&gt;

&lt;p&gt;Imagine you are an artist, a project, or simply someone who wants to distribute an NFT collection on Xahau. You have your images uploaded to IPFS, your metadata prepared, and you know exactly how much you want to charge for each piece. Now what?&lt;/p&gt;

&lt;p&gt;The usual options are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Registering on a marketplace&lt;/strong&gt; and giving control of the process to a third-party platform.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Building your own backend&lt;/strong&gt;: a server that listens for incoming payments, mints the corresponding NFT, and sends it to the buyer. This means infrastructure, maintenance, costs, and a centralized point of failure.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of these options are ideal if what you want is autonomy and simplicity. This is where Xahau, with its Hook system, offers a completely different alternative.&lt;/p&gt;




&lt;h2&gt;
  
  
  The solution: a Hook as an automatic factory
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;NFT Factory Hook&lt;/strong&gt; is a smart contract written in C that is installed directly on a Xahau account. From that moment on, every time someone sends an exact payment of XAH to that account, the Hook:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Validates that the received amount exactly matches the configured price.&lt;/li&gt;
&lt;li&gt;Reads the minted NFT counter from the Hook state.&lt;/li&gt;
&lt;li&gt;Increments the counter and verifies that the collection limit has not been exceeded.&lt;/li&gt;
&lt;li&gt;Builds the final URI: base path + zero-padded number + extension.&lt;/li&gt;
&lt;li&gt;Emits a &lt;strong&gt;URIToken Remit&lt;/strong&gt; transaction that mints the NFT and sends it directly to the buyer.&lt;/li&gt;
&lt;li&gt;Stores the new counter in the Hook state for the next mint.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;All of this happens in a single atomic process, without external servers and without human intervention.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is a URIToken?
&lt;/h2&gt;

&lt;p&gt;Before diving into the technical details, it is worth clarifying what &lt;a href="https://dev.to/ekiserrepe/series/31668"&gt;URITokens&lt;/a&gt; are, which is the native NFT standard of Xahau.&lt;/p&gt;

&lt;p&gt;URITokens are &lt;strong&gt;simple and unique objects&lt;/strong&gt; directly linked to an account. Each URIToken has:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;URI&lt;/strong&gt; pointing to the content (image, metadata, etc.), typically stored on IPFS.&lt;/li&gt;
&lt;li&gt;A single owner at any given time.&lt;/li&gt;
&lt;li&gt;The ability to be transferred or burned.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They are easy to index and manage, and thanks to Hooks you can implement custom logic such as royalties or transfer restrictions.&lt;/p&gt;

&lt;p&gt;If you need to find information about NFTs on Xahau for your projects, here are a couple of APIs you can use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://api.xahaudata.com/docs/static/index.html" rel="noopener noreferrer"&gt;Xahau Services&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://xahauexplorer.com/en/learn/the-bithomp-api" rel="noopener noreferrer"&gt;Bithomp - Xahau Explorer&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Xahau &lt;a href="https://xahau.network/docs/protocol-reference/transactions/transaction-types/remit/" rel="noopener noreferrer"&gt;Remit&lt;/a&gt; transaction allows you, in a single operation, to mint a new URIToken and transfer it to the recipient without requiring the recipient to authorize receiving it, as happens with URITokenCreateSellOffer. This is exactly what we use in this Hook.&lt;/p&gt;




&lt;h2&gt;
  
  
  How the Hook works internally
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Configuration parameters
&lt;/h3&gt;

&lt;p&gt;When installing our Hook, we must prepare the following parameters. The Hook is configured at installation time using these four parameters:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Parameter&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Size&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;AMOUNT&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;uint64 big-endian&lt;/td&gt;
&lt;td&gt;8 bytes&lt;/td&gt;
&lt;td&gt;Exact price in XAH drops&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;URI&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;ASCII&lt;/td&gt;
&lt;td&gt;1–200 bytes&lt;/td&gt;
&lt;td&gt;Base IPFS content path (with trailing slash)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;EXT&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;ASCII&lt;/td&gt;
&lt;td&gt;1–16 bytes&lt;/td&gt;
&lt;td&gt;File extension: &lt;code&gt;.json&lt;/code&gt;, &lt;code&gt;.png&lt;/code&gt;, etc.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;NUM&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;uint32 big-endian&lt;/td&gt;
&lt;td&gt;4 bytes&lt;/td&gt;
&lt;td&gt;Maximum number of NFTs in the collection&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For example, for a collection of 100 NFTs priced at 10 XAH each:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;AMOUNT → 0000000000989680   (10,000,000 drops = 10 XAH)
NUM    → 00000064            (100 NFTs)
URI    → ipfs://bafybei.../  (your IPFS CID)
EXT    → .json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can encode your own values here:&lt;br&gt;
&lt;a href="https://transia-rnd.github.io/xrpl-hex-visualizer/" rel="noopener noreferrer"&gt;https://transia-rnd.github.io/xrpl-hex-visualizer/&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Example parameters
&lt;/h3&gt;

&lt;p&gt;To make it easier for you to practice with this exercise, I have uploaded two test NFT collections to IPFS: one with 100 NFTs and another with 10 NFTs.&lt;/p&gt;

&lt;p&gt;100 NFTs (Includes files XXX.json)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ipfs://bafybeig5t3mn2s2mv6ns7o65ee4qz6gw7w47hdovjtmq54qz6fsiv2ctfu/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;10 NFTs (Includes files XX.json)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ipfs://bafybeifhquw7q5wsd3h5t6r5j6mjtvroivfv3du7wbqgl6jbdgyrmbn6vq/&lt;/code&gt;&lt;/p&gt;


&lt;h3&gt;
  
  
  The generated URI format
&lt;/h3&gt;

&lt;p&gt;Each NFT receives a unique URI constructed as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;URI&amp;gt; + &amp;lt;zero-padded counter&amp;gt; + &amp;lt;EXT&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The counter width is automatically calculated from the number of digits in &lt;code&gt;NUM&lt;/code&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;NUM&lt;/th&gt;
&lt;th&gt;Width&lt;/th&gt;
&lt;th&gt;Resulting URI example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;25&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ipfs://.../01.json&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1000&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ipfs://.../0001.json&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;100000&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ipfs://.../000001.json&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This guarantees that NFTs are correctly ordered in any system that indexes by URI.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Hook state
&lt;/h3&gt;

&lt;p&gt;We need to store the number of NFTs minted so far in memory so that the hook does not mint the same NFT twice or skip any. The hook stores this counter value in the variable &lt;code&gt;CNT&lt;/code&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Key&lt;/th&gt;
&lt;th&gt;Size&lt;/th&gt;
&lt;th&gt;Content&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;CNT&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;4 bytes&lt;/td&gt;
&lt;td&gt;Number of the last minted NFT, big-endian uint32&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The state &lt;strong&gt;is only updated after a successful emission&lt;/strong&gt;, so a failed transaction never advances the counter. The first mint starts from 0 and mints number &lt;code&gt;1&lt;/code&gt;. This ensures the hook does not skip NFTs.&lt;/p&gt;

&lt;h3&gt;
  
  
  The minting flow
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Incoming XAH payment
       │
       ▼
Is it exactly AMOUNT drops?  ──No──▶ rollback (payment rejected)
       │ Yes
       ▼
Is CNT + 1 ≤ NUM?  ──No──▶ rollback (collection sold out, payment rejected)
       │ Yes
       ▼
Build URI: base + counter + extension
       │
       ▼
Emit URIToken Remit → NFT minted and sent to buyer
       │
       ▼
Store new CNT in state
       │
       ▼
accept ✓
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An important detail: when the collection is sold out or the payment does not match, the Hook calls &lt;code&gt;rollback&lt;/code&gt;, which &lt;strong&gt;rejects the entire transaction&lt;/strong&gt;. The buyer does not lose their XAH because the payment never gets executed.&lt;/p&gt;

&lt;p&gt;Another detail is that the &lt;code&gt;Remit&lt;/code&gt; transaction used to send the URIToken will send 0.20 XAH to the user so they can accept the NFT in case their balance reaches zero when purchasing the NFT. Therefore you will need to take this into account when setting the NFT price.&lt;/p&gt;




&lt;h2&gt;
  
  
  How to install the Hook
&lt;/h2&gt;

&lt;p&gt;There are two ways to activate the Hook on your account.&lt;/p&gt;

&lt;h3&gt;
  
  
  Option A: Deploy from your own &lt;code&gt;.wasm&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Use &lt;code&gt;create_hook_nft_factory.js&lt;/code&gt; to deploy the Hook from the &lt;code&gt;.wasm&lt;/code&gt; binary you compiled yourself. This option gives you full control over the code running on-chain.&lt;/p&gt;

&lt;p&gt;To compile the source code you need the &lt;a href="https://hooks-toolkit.com/" rel="noopener noreferrer"&gt;hook-toolkit&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;hooks-cli init c nft_factory
&lt;span class="nb"&gt;cd &lt;/span&gt;nft_factory
yarn &lt;span class="nb"&gt;install
&lt;/span&gt;yarn run build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Option B: Install using the already deployed HookHash
&lt;/h3&gt;

&lt;p&gt;If you prefer not to compile, use &lt;code&gt;install_hook_nft_factory.js&lt;/code&gt; to reference the binary that is already deployed on the network. The script points directly to the Hook by its hash, without uploading new code.&lt;/p&gt;

&lt;p&gt;The HookHash corresponding to the source code in this repository is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;6786DE24C37FFCDEED643CED581793D4E47BC54FA0D796D35FEA0CBF1338C19B
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This hash is valid on both &lt;strong&gt;Xahau Testnet&lt;/strong&gt; and &lt;strong&gt;Xahau Mainnet&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You will need to edit each &lt;code&gt;HookParameterValue&lt;/code&gt; with the values that define your collection. In this code, the order is IPFS, EXT, NUM, AMOUNT. Check the &lt;strong&gt;Configuration parameters&lt;/strong&gt; section aboce to see how to fill them using &lt;a href="https://transia-rnd.github.io/xrpl-hex-visualizer/" rel="noopener noreferrer"&gt;https://transia-rnd.github.io/xrpl-hex-visualizer/&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;TransactionType&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;SetHook&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Account&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;my_wallet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;address&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Flags&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hooks&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hook&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookHash&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;6786DE24C37FFCDEED643CED581793D4E47BC54FA0D796D35FEA0CBF1338C19B&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookOn&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFE&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;//Only Payments https://richardah.github.io/xrpl-hookon-calculator/&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookCanEmit&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFFFFFFFFBFFFFF&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;//Can emit remits&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookNamespace&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;crypto&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createHash&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sha256&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;nft_factory&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;digest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hex&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toUpperCase&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Flags&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookParameters&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
              &lt;span class="p"&gt;{&lt;/span&gt;
              &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookParameter&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
              &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookParameterName&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;555249&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;//URI base&lt;/span&gt;
              &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookParameterValue&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;stringToHex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ipfs://bafybeig5t3mn2s2mv6ns7o65ee4qz6gw7w47hdovjtmq54qz6fsiv2ctfu/&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
              &lt;span class="p"&gt;}&lt;/span&gt;
              &lt;span class="p"&gt;},&lt;/span&gt;
              &lt;span class="p"&gt;{&lt;/span&gt;
              &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookParameter&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
              &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookParameterName&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;455854&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;//EXTENSION&lt;/span&gt;
              &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookParameterValue&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2E6A736F6E&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="c1"&gt;//.json&lt;/span&gt;
              &lt;span class="p"&gt;}&lt;/span&gt;
              &lt;span class="p"&gt;},&lt;/span&gt;
              &lt;span class="p"&gt;{&lt;/span&gt;
              &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookParameter&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
              &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookParameterName&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;4E554D&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;//NUMBER OF NFTS&lt;/span&gt;
              &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookParameterValue&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;00000064&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="c1"&gt;//100&lt;/span&gt;
              &lt;span class="p"&gt;}&lt;/span&gt;
              &lt;span class="p"&gt;},&lt;/span&gt;
                            &lt;span class="p"&gt;{&lt;/span&gt;
              &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookParameter&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
              &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookParameterName&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;414D4F554E54&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;//AMOUNT XAH&lt;/span&gt;
              &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookParameterValue&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0000000000989680&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="c1"&gt;// 10000000&lt;/span&gt;
              &lt;span class="p"&gt;}&lt;/span&gt;
              &lt;span class="p"&gt;}&lt;/span&gt;
              &lt;span class="p"&gt;]&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;],&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; This Hook is provided as-is. The author is not responsible for any problems it may cause. It is strongly recommended that you compile and audit your own version. Community forks and improvements are welcome.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Practical considerations
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Always test on testnet first
&lt;/h3&gt;

&lt;p&gt;Before installing the Hook on mainnet, deploy it on testnet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;network&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;wss://xahau-test.net&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Testnet&lt;/span&gt;
&lt;span class="c1"&gt;// const network = 'wss://xahau.network'; // Mainnet&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can obtain a testnet account at &lt;a href="https://xahau-test.net/" rel="noopener noreferrer"&gt;https://xahau-test.net/&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  The business layer perspective
&lt;/h2&gt;

&lt;p&gt;This project is a very direct example of what Xahau enables: &lt;strong&gt;turning an account into an autonomous service&lt;/strong&gt;. There is no database, no API, no server to maintain. The business logic lives on the blockchain and runs by itself.&lt;/p&gt;

&lt;p&gt;This opens the door to scenarios that previously required complex infrastructure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Digital art collection launches&lt;/strong&gt; where the artist only needs an account and a folder on IPFS.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Credential or ticket distribution&lt;/strong&gt; as on-chain verifiable URITokens.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Generative collections&lt;/strong&gt; where metadata for each number is pre-generated and stored on IPFS.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Membership systems&lt;/strong&gt; where each NFT represents an access level.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Game unlockables&lt;/strong&gt; where each NFT represents parts of a game, characters, or items.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The NFT factory is a building block. From here, combining it with additional Hooks, CronSet, adapting it for marketplaces or any other logic is simply a matter of imagination.&lt;/p&gt;




&lt;h2&gt;
  
  
  Web Service for Non-Coders
&lt;/h2&gt;

&lt;p&gt;Not everyone has, or wants to have, the technical knowledge required to manage a hook. For this reason, I have created a front-end that allows users to generate collections and have a minting page for anyone who wants to experiment with the hook. The address is: &lt;a href="https://nft.xahau.love/" rel="noopener noreferrer"&gt;https://nft.xahau.love/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fewh9km1xetvgz669d10t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fewh9km1xetvgz669d10t.png" alt=" " width="800" height="729"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Xahau NFT Pop-Up Shop allows users, through a simple form, to install, modify, or remove a Hook on a Xahau Mainnet/Testnet account provided through Xaman. This means you don’t have to deal with servers or password management within them.&lt;/p&gt;

&lt;p&gt;The website also generates a unique page, based on the Xahau address and the selected network, where others can mint NFTs from the collection through Xaman.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm7iqf4zlvflcomaa46qm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm7iqf4zlvflcomaa46qm.png" alt=" " width="800" height="755"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This project is purely educational. I am aware that some members of the Xahau community are working on a marketplace for URITokens on Xahau, and I hope to see and enjoy it soon.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The NFT Factory Hook demonstrates that you do not need a marketplace or a backend to launch an NFT collection on Xahau. With a properly configured Hook, your account becomes an autonomous vending machine: it receives the exact payment, mints the NFT, and delivers it, all within the same transaction and without human intervention. Of course, a marketplace offers additional services beyond minting third-party tokens, such as visibility and marketing. Marketplaces on Xahau can also be managed by Hooks.&lt;/p&gt;

&lt;p&gt;The code for this exercise is open and available at&lt;br&gt;
&lt;a href="https://github.com/Ekiserrepe/auto_nft_factory_xahau" rel="noopener noreferrer"&gt;https://github.com/Ekiserrepe/auto_nft_factory_xahau&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I invite you to test it on testnet, audit it, and most importantly, build better versions.&lt;/p&gt;

&lt;p&gt;As always: we are still in the early days of Xahau. The tools are there. What is missing are the ideas—and those are up to you.&lt;/p&gt;




&lt;h2&gt;
  
  
  Possible improvements and ideas
&lt;/h2&gt;

&lt;p&gt;Mientras estaba escribiendo este artículo se me han ocurrido los siguientes puntos de mejoras o ideas:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a front-end to give other people the ability to mint their own collections.&lt;/li&gt;
&lt;li&gt;Add improvements to the Hook for error handling. For example, stopping the collection emission if an error is detected or resetting the minted NFT counter.&lt;/li&gt;
&lt;li&gt;Generate a version with time-based bidding. Users send their bids to the minting account, and when the time period ends, the NFT is issued to the highest bidder while the funds are returned to the non-winning bidders.&lt;/li&gt;
&lt;li&gt;A middleman version. Improve the Hook and add a service fee for minting NFTs on behalf of others.&lt;/li&gt;
&lt;li&gt;Static or dynamic blacklisting, for example: once an address receives an NFT, it is no longer allowed to purchase another NFT from that collection.&lt;/li&gt;
&lt;li&gt;Handle PreAuth cases&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Acknowledgements
&lt;/h2&gt;

&lt;p&gt;Thanks to &lt;a href="https://x.com/Handy_4ndy" rel="noopener noreferrer"&gt;Handy_4ndy&lt;/a&gt; for his library &lt;a href="https://github.com/Handy4ndy/XahauHooks101" rel="noopener noreferrer"&gt;XahauHooks101&lt;/a&gt;, which made this project possible.&lt;/p&gt;




&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Repository: &lt;a href="https://github.com/Ekiserrepe/auto_nft_factory_xahau" rel="noopener noreferrer"&gt;https://github.com/Ekiserrepe/auto_nft_factory_xahau&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Official Xahau website: &lt;a href="https://xahau.network/" rel="noopener noreferrer"&gt;https://xahau.network/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Official documentation: &lt;a href="https://xahau.network/docs" rel="noopener noreferrer"&gt;https://xahau.network/docs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Hooks Builder: &lt;a href="https://builder.xahau.network/" rel="noopener noreferrer"&gt;https://builder.xahau.network/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Handy_Andy's Hooks101: &lt;a href="https://github.com/Handy4ndy/XahauHooks101" rel="noopener noreferrer"&gt;https://github.com/Handy4ndy/XahauHooks101&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Xahau Discord: &lt;a href="https://discord.gg/ds7nb93mYj" rel="noopener noreferrer"&gt;https://discord.gg/ds7nb93mYj&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Xahaud on GitHub: &lt;a href="https://github.com/Xahau/xahaud" rel="noopener noreferrer"&gt;https://github.com/Xahau/xahaud&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;X / Twitter: &lt;a href="https://x.com/XahauNetwork" rel="noopener noreferrer"&gt;https://x.com/XahauNetwork&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>blockchain</category>
      <category>nft</category>
      <category>web3</category>
      <category>xahau</category>
    </item>
    <item>
      <title>Learning Xahau: Automating Reward Claims with Hooks and CronSet</title>
      <dc:creator>Ekiserrepe</dc:creator>
      <pubDate>Sat, 22 Nov 2025 13:21:02 +0000</pubDate>
      <link>https://dev.to/ekiserrepe/learning-xahau-automating-reward-claims-with-hooks-and-cronset-n4k</link>
      <guid>https://dev.to/ekiserrepe/learning-xahau-automating-reward-claims-with-hooks-and-cronset-n4k</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;If you've been following the &lt;a href="https://xahau.network" rel="noopener noreferrer"&gt;Xahau&lt;/a&gt; blockchain, you know that claiming rewards is a fundamental part of participating in the ecosystem. Every account that opts in can claim rewards approximately every 30 days. But here's the thing: manually tracking when to claim and executing transactions every month can become tedious. The closest thing that exists today is the fantastic &lt;a href="https://help.xaman.app/app/all-about-xapps/xahau-xapps/balance-adjustment" rel="noopener noreferrer"&gt;Balance Adjustment&lt;/a&gt; app for &lt;a href="https://xaman.app/" rel="noopener noreferrer"&gt;Xaman&lt;/a&gt;, which sends you a push notification as the date approaches so you can claim your XAH. What if we could automate this entire process?&lt;/p&gt;

&lt;p&gt;Today, I'm excited to share a complete example solution that automates reward claiming on Xahau using Hooks and CronSet transactions. This tutorial covers the entire lifecycle of reward automation. Of course, it's an example meant to inspire others to build better solutions.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem We're Solving
&lt;/h2&gt;

&lt;p&gt;Let me paint you a picture. You have multiple Xahau accounts, each eligible for rewards every 30 days, 2 hours, and 13 minutes (precisely 2,599,980 seconds). Missing a claim means delaying your rewards. Tracking multiple accounts manually? That's a recipe for mistakes and missed opportunities.&lt;/p&gt;

&lt;p&gt;The traditional approach requires:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Remembering when each account last claimed&lt;/li&gt;
&lt;li&gt;Calculating the next eligible time&lt;/li&gt;
&lt;li&gt;Being available to submit transactions at the right moment&lt;/li&gt;
&lt;li&gt;Repeating this process indefinitely&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There has to be a better way, right?&lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution: Combining Hooks with CronSet
&lt;/h2&gt;

&lt;p&gt;You can find the repository with the entire process at this link: &lt;a href="https://github.com/Ekiserrepe/cron-claimreward-xahau" rel="noopener noreferrer"&gt;https://github.com/Ekiserrepe/cron-claimreward-xahau&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Our automated reward claiming system leverages two powerful Xahau features:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Hooks&lt;/strong&gt;: Smart contracts that execute automatically on transactions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CronSet&lt;/strong&gt;: Scheduled transactions that run at predetermined intervals&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;By combining these technologies, we create a "set it and forget it" system that claims your rewards automatically for months or even years ahead.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the Architecture
&lt;/h2&gt;

&lt;p&gt;The system consists of several interconnected components:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Account Setup → Hook Installation → Cron Scheduling → Automated Execution
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each component plays a crucial role:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. The ClaimReward Hook (C Code)
&lt;/h3&gt;

&lt;p&gt;The heart of our automation is a Hook written in C that executes ClaimReward transactions automatically. This hook is a  simplified copy of the &lt;a href="https://github.com/Xahau/TreasuryHook/" rel="noopener noreferrer"&gt;TreasuryHook&lt;/a&gt; which I recommend checking out.&lt;/p&gt;

&lt;p&gt;The Hook hash (&lt;code&gt;805351CE26FB79DA00647CEFED502F7E15C2ACCCE254F11DEFEDDCE241F8E9CA&lt;/code&gt;) is consistent across both testnet and mainnet, ensuring reliability and trustworthiness.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;"hookapi.h"&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="c1"&gt;// Macro to flip endianness for 32-bit values&lt;/span&gt;
&lt;span class="cp"&gt;#define FLIP_ENDIAN(x) ((((x) &amp;amp; 0xFF000000) &amp;gt;&amp;gt; 24) | \
                        (((x) &amp;amp; 0x00FF0000) &amp;gt;&amp;gt; 8)  | \
                        (((x) &amp;amp; 0x0000FF00) &amp;lt;&amp;lt; 8)  | \
                        (((x) &amp;amp; 0x000000FF) &amp;lt;&amp;lt; 24))
&lt;/span&gt;
&lt;span class="c1"&gt;// ClaimReward transaction template&lt;/span&gt;
&lt;span class="kt"&gt;uint8_t&lt;/span&gt; &lt;span class="n"&gt;ctxn&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;251&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="cm"&gt;/* size,upto */&lt;/span&gt;
&lt;span class="cm"&gt;/* 3,    0, tt = ClaimReward      */&lt;/span&gt;   &lt;span class="mh"&gt;0x12U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x00U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x62U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="cm"&gt;/* 5,    3  flags                 */&lt;/span&gt;   &lt;span class="mh"&gt;0x22U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x00U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x00U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x00U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x00U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="cm"&gt;/* 5,    8, sequence              */&lt;/span&gt;   &lt;span class="mh"&gt;0x24U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x00U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x00U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x00U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x00U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="cm"&gt;/* 6,   13, firstledgersequence   */&lt;/span&gt;   &lt;span class="mh"&gt;0x20U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x1AU&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x00U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x00U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x00U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x00U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="cm"&gt;/* 6,   19, lastledgersequence    */&lt;/span&gt;   &lt;span class="mh"&gt;0x20U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x1BU&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x00U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x00U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x00U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x00U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="cm"&gt;/* 9,   25, fee                   */&lt;/span&gt;   &lt;span class="mh"&gt;0x68U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x40U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x00U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x00U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x00U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x00U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x00U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x00U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x00U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="cm"&gt;/* 35,  34, signingpubkey         */&lt;/span&gt;   &lt;span class="mh"&gt;0x73U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x21U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="cm"&gt;/* 22,  69, account               */&lt;/span&gt;   &lt;span class="mh"&gt;0x81U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x14U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="cm"&gt;/* 22,  91, issuer                */&lt;/span&gt;   &lt;span class="mh"&gt;0x84U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x14U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0xB5U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0xF7U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x62U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x79U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x8AU&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x53U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0xD5U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x43U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0xA0U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x14U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0xCAU&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0xF8U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0xB2U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x97U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0xCFU&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0xF8U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0xF2U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0xF9U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x37U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0xE8U&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="cm"&gt;/* 138, 113  emit details          */&lt;/span&gt;  &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                                       &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                                       &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="cm"&gt;/* 0,  251                        */&lt;/span&gt; 
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="cp"&gt;#define CFLS_OUT (ctxn + 15U)
#define CLLS_OUT (ctxn + 21U)
#define CFEE_OUT (ctxn + 26U)
#define CACCOUNT_OUT (ctxn + 71U)
#define CEMIT_OUT (ctxn + 113U)
&lt;/span&gt;
&lt;span class="cp"&gt;#define BE_DROPS(drops)\
{\
        uint64_t drops_tmp = drops;\
        uint8_t* b = (uint8_t*)&amp;amp;drops;\
        *b++ = 0b01000000 + (( drops_tmp &amp;gt;&amp;gt; 56 ) &amp;amp; 0b00111111 );\
        *b++ = (drops_tmp &amp;gt;&amp;gt; 48) &amp;amp; 0xFFU;\
        *b++ = (drops_tmp &amp;gt;&amp;gt; 40) &amp;amp; 0xFFU;\
        *b++ = (drops_tmp &amp;gt;&amp;gt; 32) &amp;amp; 0xFFU;\
        *b++ = (drops_tmp &amp;gt;&amp;gt; 24) &amp;amp; 0xFFU;\
        *b++ = (drops_tmp &amp;gt;&amp;gt; 16) &amp;amp; 0xFFU;\
        *b++ = (drops_tmp &amp;gt;&amp;gt;  8) &amp;amp; 0xFFU;\
        *b++ = (drops_tmp &amp;gt;&amp;gt;  0) &amp;amp; 0xFFU;\
}
&lt;/span&gt;
&lt;span class="c1"&gt;// Callback function&lt;/span&gt;
&lt;span class="kt"&gt;int64_t&lt;/span&gt; &lt;span class="nf"&gt;cbak&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint32_t&lt;/span&gt; &lt;span class="n"&gt;reserve&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;accept&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="kt"&gt;uint32_t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="s"&gt;"Callback completed"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;__LINE__&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Main hook function using state_foreign for custom namespace&lt;/span&gt;
&lt;span class="kt"&gt;int64_t&lt;/span&gt; &lt;span class="nf"&gt;hook&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint32_t&lt;/span&gt; &lt;span class="n"&gt;reserved&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Proceed with ClaimReward emission&lt;/span&gt;
    &lt;span class="kt"&gt;uint32_t&lt;/span&gt; &lt;span class="n"&gt;current_ledger&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ledger_seq&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="kt"&gt;uint32_t&lt;/span&gt; &lt;span class="n"&gt;fls&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;current_ledger&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;uint32_t&lt;/span&gt; &lt;span class="n"&gt;lls&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fls&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="n"&gt;etxn_reserve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kt"&gt;uint8_t&lt;/span&gt; &lt;span class="n"&gt;emithash&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

    &lt;span class="n"&gt;hook_account&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="kt"&gt;uint32_t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="n"&gt;CACCOUNT_OUT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="kt"&gt;uint32_t&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)(&lt;/span&gt;&lt;span class="n"&gt;CFLS_OUT&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;FLIP_ENDIAN&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fls&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="kt"&gt;uint32_t&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)(&lt;/span&gt;&lt;span class="n"&gt;CLLS_OUT&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;FLIP_ENDIAN&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lls&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;etxn_details&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="kt"&gt;uint32_t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="n"&gt;CEMIT_OUT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;138U&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="kt"&gt;int64_t&lt;/span&gt; &lt;span class="n"&gt;fee&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;etxn_fee_base&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="kt"&gt;uint32_t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="n"&gt;ctxn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;sizeof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctxn&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="n"&gt;BE_DROPS&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fee&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="kt"&gt;uint64_t&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)(&lt;/span&gt;&lt;span class="n"&gt;CFEE_OUT&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fee&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;emit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SBUF&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;emithash&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint32_t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="n"&gt;ctxn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;sizeof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctxn&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;rollback&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="kt"&gt;uint32_t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="s"&gt;"AutoReward: Failed to emit claim transaction."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;__LINE__&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="n"&gt;accept&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="kt"&gt;uint32_t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="s"&gt;"AutoReward: Claim emitted successfully."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;39&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;__LINE__&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;_g&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Account Configuration Scripts
&lt;/h3&gt;

&lt;p&gt;Before automating, we need to prepare the account properly:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;accountSet.js&lt;/strong&gt;: Configures basic account settings&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;checkAccount.js&lt;/strong&gt;: Analyzes account status and calculates optimal claiming times&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;installHook.js&lt;/strong&gt;: Deploys the ClaimReward Hook to your account&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. The CronSet Orchestrator
&lt;/h3&gt;

&lt;p&gt;This is where the magic happens. The CronSet transaction schedules automatic executions with these key parameters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;StartTime&lt;/strong&gt;: When to begin automated claiming&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DelaySeconds&lt;/strong&gt;: The interval between claims (2,603,580 seconds with safety margin)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;RepeatCount&lt;/strong&gt;: How many times to repeat (up to 256, covering over 21 years!)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Technical Deep Dive
&lt;/h2&gt;

&lt;p&gt;Let's explore the critical timing calculations that make this system reliable:&lt;/p&gt;

&lt;h3&gt;
  
  
  Understanding Xahau Time
&lt;/h3&gt;

&lt;p&gt;Xahau uses its own epoch, starting 946,684,800 seconds after Unix epoch. This means we need to convert between Unix timestamps and Xahau time:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;RIPPLED_EPOCH_OFFSET&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;946684800&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;xahauTime&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;unixTime&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;RIPPLED_EPOCH_OFFSET&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The Safety Margin Philosophy
&lt;/h3&gt;

&lt;p&gt;The official reward delay is 2,599,980 seconds (30 days, 2 hours, 13 minutes). However, our system adds a 1-hour safety margin, resulting in 2,603,580 seconds. Why?&lt;/p&gt;

&lt;p&gt;Network conditions, ledger closing times, and transaction queues can introduce minor delays. By adding this buffer, we ensure our automated claims always execute successfully rather than failing due to timing edge cases. (Feel free to remove or edit it)&lt;/p&gt;

&lt;h3&gt;
  
  
  Calculating Next Claim Time
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;checkAccount.js&lt;/code&gt; script performs sophisticated calculations:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Checks current RewardTime from account data&lt;/li&gt;
&lt;li&gt;Adds the delay period (2,599,980 seconds)&lt;/li&gt;
&lt;li&gt;Converts to human-readable format&lt;/li&gt;
&lt;li&gt;Suggests both exact time and safety-margin time&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This dual approach lets users choose between aggressive timing (exact) or conservative timing (with 1 hour buffer).&lt;/p&gt;

&lt;h2&gt;
  
  
  Real-World Implementation
&lt;/h2&gt;

&lt;p&gt;Let me walk you through setting up automated claiming for a real account:&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Initial Setup
&lt;/h3&gt;

&lt;p&gt;First, clone the repository and install dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/Ekiserrepe/cron-claimreward-xahau.git
&lt;span class="nb"&gt;cd &lt;/span&gt;cron-claimreward-xahau
npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Configure Your Account
&lt;/h3&gt;

&lt;p&gt;Edit the seed in &lt;code&gt;accountSet.js&lt;/code&gt; and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;xahau&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;xahau&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;derive&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;utils&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;signAndSubmit&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;xrpl-accountlib&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;seed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sYourSeedHere&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Replace with your actual seed, get one at https://xahau-test.net/&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;network&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;wss://xahau-test.net&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;setAccountFlag&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;xahau&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;network&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;derive&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;familySeed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;seed&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;algorithm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;secp256k1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Account: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;address&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Connected to Xahau&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;networkInfo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;utils&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;txNetworkAndAccountValues&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;network&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;prepared&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;TransactionType&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;AccountSet&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Account&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;address&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;SetFlag&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// asfTshCollect - Enable Transaction Signature Hook Collection&lt;/span&gt;
      &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;networkInfo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;txValues&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Prepared AccountSet transaction:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prepared&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;tx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;signAndSubmit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prepared&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;network&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Transaction result:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Error:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;finally&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;disconnect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Disconnected from Xahau&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;setAccountFlag&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This prepares your account for Hook installation. Setting the flag 11 'asfTshCollect' allows you to interact with cron transactions and hook executions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Install the Hook
&lt;/h3&gt;

&lt;p&gt;Deploy the ClaimReward Hook to your account:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;xahau&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;xahau&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;derive&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;utils&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;signAndSubmit&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;xrpl-accountlib&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;seed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sYourSeedHere&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Replace with your actual seed, get one at https://xahau-test.net/&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;network&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;wss://xahau-test.net&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;installHook&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;xahau&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;network&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;derive&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;familySeed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;seed&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;algorithm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;secp256k1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Account: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;address&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Connected to Xahau&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;networkInfo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;utils&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;txNetworkAndAccountValues&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;network&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;prepared&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;TransactionType&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;SetHook&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Account&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;address&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hooks&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hook&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookHash&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;805351CE26FB79DA00647CEFED502F7E15C2ACCCE254F11DEFEDDCE241F8E9CA&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookNamespace&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0000000000000000000000000000000000000000000000000000000000000000&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookOn&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFBFFFFF&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookCanEmit&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFFFFFFFFFFFFFFFBFFFFF&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;//Can emit ClaimReward&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Flags&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;],&lt;/span&gt;
      &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;networkInfo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;txValues&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Prepared SetHook transaction:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prepared&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;tx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;signAndSubmit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prepared&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;network&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Transaction result:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Error:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;finally&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;disconnect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Disconnected from Xahau&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;installHook&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Hook is now ready to execute claims when triggered. The Flag 4 is needed to allow the cron transaction to trigger the hook execution.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Analyze Your Account
&lt;/h3&gt;

&lt;p&gt;Run the account checker to get precise timing information:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Client&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;xahau&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Constants&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;RIPPLED_EPOCH_OFFSET&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;946684800&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;REWARD_DELAY_SECONDS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2599980&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// 30 days, 2 hours, 13 minutes&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;checkAccount&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;wss://xahau-test.net&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;address&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;yourAddress&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Connected to Xahau Testnet&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;request&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
      &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;account_info&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;account&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;address&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;ledger_index&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;validated&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;=== ACCOUNT INFO ===&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Address:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;address&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Balance:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;account_data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Balance&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;drops&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Balance (XAH):&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;parseInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;account_data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Balance&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;1000000&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;XAH&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Sequence:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;account_data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Sequence&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;RewardTime:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;account_data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;RewardTime&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Not set (not opted in)&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;RewardLgrFirst:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;account_data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;RewardLgrFirst&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Not set&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;RewardLgrLast:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;account_data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;RewardLgrLast&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Not set&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s1"&gt;Account exists:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Is opted in to rewards:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;!!&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;account_data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;RewardTime&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Calculate next claim time if opted in&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;account_data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;RewardTime&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;rewardTime&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;parseInt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;account_data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;RewardTime&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;nextClaimTime&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;rewardTime&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;REWARD_DELAY_SECONDS&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;nextClaimDate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;nextClaimTime&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;RIPPLED_EPOCH_OFFSET&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

      &lt;span class="c1"&gt;// Calculate with 1 hour safety margin&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;nextClaimTimeSafe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;nextClaimTime&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;3600&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// +1 hour (3600 seconds)&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;nextClaimDateSafe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;nextClaimTimeSafe&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;RIPPLED_EPOCH_OFFSET&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

      &lt;span class="c1"&gt;// Format date as YYYY/MM/DD, time as 12-hour format&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;formatDate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;year&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getFullYear&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;month&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getMonth&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;padStart&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;0&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;day&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getDate&lt;/span&gt;&lt;span class="p"&gt;()).&lt;/span&gt;&lt;span class="nf"&gt;padStart&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;0&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;timeString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLocaleTimeString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;en-US&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="na"&gt;hour&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;numeric&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="na"&gt;minute&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;2-digit&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="na"&gt;second&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;2-digit&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="na"&gt;hour12&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
        &lt;span class="p"&gt;});&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;year&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;month&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;day&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;, &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;timeString&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;};&lt;/span&gt;

      &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s1"&gt;=== NEXT CLAIM INFO ===&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Next Claim Date:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;formatDate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;nextClaimDate&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
      &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s1"&gt;⭐ For cronSet.js:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;StartTime:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;nextClaimTime&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;StartTime + 1 hour (for safety):&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;nextClaimTimeSafe&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;-&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;formatDate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;nextClaimDateSafe&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

      &lt;span class="c1"&gt;// Calculate DelaySeconds for 30 days, 3 hours, 13 minutes&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;delaySeconds&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;13&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s1"&gt;DelaySeconds (30d 3h 13m):&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;delaySeconds&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Error:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;finally&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;disconnect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;checkAccount&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You'll see output like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;=== NEXT CLAIM INFO ===
Next Claim Date: 2025/12/21, 1:09:41 PM
⭐ For cronSet.js:
StartTime: 819634181
StartTime + 1 hour (for safety): 819637781
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 5: Schedule Automation
&lt;/h3&gt;

&lt;p&gt;Edit &lt;code&gt;cronSet.js&lt;/code&gt; with the calculated StartTime from last code (or 0 if its the first time you are opt-in your rewards) and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;xahau&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;xahau&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;derive&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;utils&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;signAndSubmit&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;xrpl-accountlib&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;seed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sYourSeedHere&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Replace with your seed&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;network&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;wss://xahau-test.net&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;createCronSet&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;xahau&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;network&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;derive&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;familySeed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;seed&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;algorithm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;secp256k1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Account: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;address&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Connected to Xahau&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;networkInfo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;utils&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;txNetworkAndAccountValues&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;network&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Convert current time to Ripple Epoch (seconds since January 1, 2000 00:00 UTC)&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;RIPPLE_EPOCH_OFFSET&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;946684800&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;currentUnixTime&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;startTimeRippleEpoch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;currentUnixTime&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;RIPPLE_EPOCH_OFFSET&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Start in 1 minute&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;prepared&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;TransactionType&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;CronSet&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Account&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;address&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Your Hook address&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;StartTime&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="c1"&gt;//Check checkAccount.js to get your StartTime number if you already opt-in, Or use 0 for immediate start if you didn't top-in yet.&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;RepeatCount&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;256&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Max number of times to repeat the task&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;DelaySeconds&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2603580&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// 30 days, 3 hours, 13 minutes (Regular claim interval + 1 hour safety margin)&lt;/span&gt;
      &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;networkInfo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;txValues&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Prepared CronSet transaction:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prepared&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;tx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;signAndSubmit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prepared&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;network&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Transaction result:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Error:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;finally&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;disconnect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Disconnected from Xahau&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;createCronSet&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Congratulations! Your rewards will now be claimed automatically.&lt;/p&gt;

&lt;h2&gt;
  
  
  Advanced Considerations
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Handling First-Time Users
&lt;/h3&gt;

&lt;p&gt;If you've never opted into rewards before, use &lt;code&gt;StartTime: 0&lt;/code&gt; in your CronSet configuration. This triggers an immediate first claim and starts your reward cycle.&lt;/p&gt;

&lt;h3&gt;
  
  
  Choosing RepeatCount Wisely
&lt;/h3&gt;

&lt;p&gt;Each repeat covers approximately 30 days. Here's a quick reference:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;12 repeats = ~1 year of automation&lt;/li&gt;
&lt;li&gt;24 repeats = ~2 years&lt;/li&gt;
&lt;li&gt;256 repeats (maximum) = ~21 years&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Consider your long-term commitment to the network when choosing this value.&lt;/p&gt;

&lt;h3&gt;
  
  
  Network Selection
&lt;/h3&gt;

&lt;p&gt;Always test on testnet first:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;network&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;wss://xahau-test.net&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Testing&lt;/span&gt;
&lt;span class="c1"&gt;// const network = 'wss://xahau.network'; // Production&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Monitoring Your Automation
&lt;/h3&gt;

&lt;p&gt;Even with automation, periodic checks are wise:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Verify CronSet transactions are executing&lt;/li&gt;
&lt;li&gt;Check account balance for fees&lt;/li&gt;
&lt;li&gt;Monitor Hook execution logs&lt;/li&gt;
&lt;li&gt;Validate reward accumulation&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The Business Layer Perspective
&lt;/h2&gt;

&lt;p&gt;This automated reward system exemplifies what I discussed in my previous article about building business layers on Xahau. By abstracting the complexity of reward claiming into an automated system, we're creating infrastructure that enables:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Portfolio Management&lt;/strong&gt;: Manage multiple accounts efficiently&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Institutional Adoption&lt;/strong&gt;: Enterprises can automate treasury operations&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User Experience&lt;/strong&gt;: Remove friction from reward claiming&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalability&lt;/strong&gt;: Handle hundreds of accounts without manual intervention&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Security Considerations
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Hook Verification
&lt;/h3&gt;

&lt;p&gt;The provided Hook hash is public and verifiable. If you prefer maximum security, compile the &lt;code&gt;claimReward.c&lt;/code&gt; file yourself and verify the hash matches or create a new one!&lt;/p&gt;

&lt;h3&gt;
  
  
  Transaction Fees
&lt;/h3&gt;

&lt;p&gt;Ensure your account maintains sufficient XAH balance for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CronSet execution fees&lt;/li&gt;
&lt;li&gt;ClaimReward transaction fees&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Troubleshooting Common Issues
&lt;/h2&gt;

&lt;h3&gt;
  
  
  "Account not eligible for rewards yet"
&lt;/h3&gt;

&lt;p&gt;Solution: Wait for the exact RewardTime + delay period, or use the safety margin suggestion.&lt;/p&gt;

&lt;h3&gt;
  
  
  "Insufficient balance for fees"
&lt;/h3&gt;

&lt;p&gt;Solution: Maintain at least 10 XAH for fee reserves.&lt;/p&gt;

&lt;h3&gt;
  
  
  "Hook is not being triggered"
&lt;/h3&gt;

&lt;p&gt;Solution: Ensure account is properly configured with &lt;code&gt;accountSet.js&lt;/code&gt; first and you installed your hook with proper HookOn and HookCanEmit and Flags values.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Bigger Picture
&lt;/h2&gt;

&lt;p&gt;This automated reward system represents more than just convenience,  it's a glimpse into the future of blockchain automation. By combining Hooks (smart contracts) with CronSet (scheduled execution), we're creating autonomous financial systems that operate without human intervention.&lt;/p&gt;

&lt;p&gt;Imagine scaling this concept:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Automated DeFi strategies&lt;/li&gt;
&lt;li&gt;Scheduled payment distributions&lt;/li&gt;
&lt;li&gt;Autonomous treasury management&lt;/li&gt;
&lt;li&gt;Self-executing compliance operations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The infrastructure we're building today lays the foundation for tomorrow's decentralized autonomous organizations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Future Enhancements
&lt;/h2&gt;

&lt;p&gt;While the current system is production-ready, several enhancements could add value:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Multi-account Management&lt;/strong&gt;: Handle multiple accounts from a single interface&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Notification System&lt;/strong&gt;: Alert users when claims execute&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Analytics Dashboard&lt;/strong&gt;: Track reward accumulation over time&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dynamic Optimization&lt;/strong&gt;: Adjust timing based on network conditions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integration APIs&lt;/strong&gt;: Connect with existing portfolio management tools&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Automating reward claims on Xahau isn't just about saving time, it's about building reliable, scalable infrastructure for the future of finance solutions. By combining Hooks and CronSet transactions, we've created a system that runs autonomously for years, ensuring you never miss a reward claim again.&lt;/p&gt;

&lt;p&gt;The code is open source and available at &lt;a href="https://github.com/Ekiserrepe/cron-claimreward-xahau" rel="noopener noreferrer"&gt;github.com/Ekiserrepe/cron-claimreward-xahau&lt;/a&gt;. I encourage you to explore it, test it on testnet, and create new improvements.&lt;/p&gt;

&lt;p&gt;Remember: the best automation is the one you set up once and forget about. With this system, your Xahau rewards practically claim themselves.&lt;/p&gt;

&lt;h2&gt;
  
  
  Acknowledgments
&lt;/h2&gt;

&lt;p&gt;Special thanks to &lt;a href="https://x.com/angell_denis" rel="noopener noreferrer"&gt;Denis Angell&lt;/a&gt; and &lt;a href="https://x.com/Satish_nl" rel="noopener noreferrer"&gt;Satish&lt;/a&gt; from XRPL Labs for their pioneering work on Hooks and assistance in developing this solution. &lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>web3</category>
      <category>automation</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Learning Xahau: Automating Hook Execution with Cron Transactions</title>
      <dc:creator>Ekiserrepe</dc:creator>
      <pubDate>Fri, 14 Nov 2025 20:09:16 +0000</pubDate>
      <link>https://dev.to/ekiserrepe/learning-xahau-automating-hook-execution-with-cron-transactions-14n1</link>
      <guid>https://dev.to/ekiserrepe/learning-xahau-automating-hook-execution-with-cron-transactions-14n1</guid>
      <description>&lt;p&gt;Welcome to a new chapter of Learning Xahau, where we explore the theoretical and practical aspects of the Xahau blockchain. If you're new to Xahau, I recommend checking out &lt;a href="https://dev.to/ekiserrepe/learning-xahau-what-is-xahau-104j"&gt;the first article in the series&lt;/a&gt; to understand the basics.&lt;/p&gt;

&lt;p&gt;Today, we're diving into &lt;strong&gt;Cron Transactions&lt;/strong&gt;—a powerful feature that brings scheduled automation to the Xahau blockchain. If you've ever wondered how to make your Hooks execute automatically at specific intervals without manual intervention, this article is for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Are Cron Transactions?
&lt;/h2&gt;

&lt;p&gt;If you're familiar with Unix/Linux systems, you've probably heard of cron jobs—scheduled tasks that run automatically at specified times. Xahau brings this concept to the blockchain with &lt;code&gt;CronSet&lt;/code&gt; transactions, allowing you to schedule Hook callbacks at regular intervals.&lt;/p&gt;

&lt;p&gt;Think of Cron Transactions as your blockchain alarm clock. Instead of waking you up, they wake up your Hooks and tell them: "Hey, it's time to execute your logic!" This happens automatically, on-chain, without needing external triggers or services.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Do We Need Cron Transactions?
&lt;/h2&gt;

&lt;p&gt;In traditional blockchain environments, smart contracts typically react to external transactions. Someone or something needs to call them. This creates several challenges:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Manual Intervention&lt;/strong&gt;: Regular tasks require someone to trigger them manually&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;External Dependencies&lt;/strong&gt;: You need off-chain services (bots, servers) to trigger on-chain actions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost Inefficiency&lt;/strong&gt;: Each manual trigger costs transaction fees&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reliability Issues&lt;/strong&gt;: External services can fail, forget, or experience downtime&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cron Transactions solve these problems by moving the scheduling logic on-chain. Your Hook can be programmed to execute at specific intervals, creating truly autonomous on-chain processes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real-World Use Cases
&lt;/h2&gt;

&lt;p&gt;Before diving into the technical implementation, let's explore practical scenarios where Cron Transactions shine:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Automated Reward Distribution
&lt;/h3&gt;

&lt;p&gt;Imagine a staking system where rewards need to be calculated and distributed daily. Instead of running an external bot, a Cron Transaction can trigger your Hook every 24 hours to process rewards automatically.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Regular Data Updates
&lt;/h3&gt;

&lt;p&gt;If you're using Remarks (as discussed in &lt;a href="https://dev.to/ekiserrepe/learning-xahau-storing-on-chain-data-with-remarks-463i"&gt;my previous article&lt;/a&gt;) to create a price oracle, Cron Transactions can update prices at regular intervals without external intervention.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Subscription Management
&lt;/h3&gt;

&lt;p&gt;For subscription-based services, Cron Transactions can automatically check and process payments, update subscription statuses, or trigger access revocations when subscriptions expire.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Automated Maintenance Tasks
&lt;/h3&gt;

&lt;p&gt;Hooks that need to perform cleanup operations, reset counters, or archive old data can use Cron Transactions to execute these tasks periodically.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Cron Transactions Work
&lt;/h2&gt;

&lt;p&gt;The workflow for implementing Cron Transactions involves several steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Install a Hook&lt;/strong&gt; with the &lt;code&gt;hsfCOLLECT&lt;/code&gt; flag enabled&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enable Transaction Signature Hook Collection&lt;/strong&gt; on your account&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Create a CronSet transaction&lt;/strong&gt; with your scheduling parameters&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Let Xahau handle the rest&lt;/strong&gt;—your Hook will execute automatically&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let's break down each component:&lt;/p&gt;

&lt;h3&gt;
  
  
  The CronSet Transaction Structure
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;TransactionType&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;CronSet&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Account&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;rYourAccountAddress&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;StartTime&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;816348759&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;      &lt;span class="c1"&gt;// When to start (Ripple Epoch)&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;RepeatCount&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;             &lt;span class="c1"&gt;// How many times to execute&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;DelaySeconds&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;120&lt;/span&gt;           &lt;span class="c1"&gt;// Interval between executions&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;StartTime&lt;/strong&gt;: When the first execution should occur (0 for immediate start)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;RepeatCount&lt;/strong&gt;: Total number of times the Hook should be triggered&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DelaySeconds&lt;/strong&gt;: Time interval between each execution&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Important: Ripple Epoch Time
&lt;/h3&gt;

&lt;p&gt;Xahau uses Ripple Epoch time, which counts seconds from January 1, 2000 (not Unix time which starts from 1970). Here's how to convert:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;RIPPLE_EPOCH_OFFSET&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;946684800&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;rippleEpochTime&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;RIPPLE_EPOCH_OFFSET&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Hands-On Implementation
&lt;/h2&gt;

&lt;p&gt;Now let's get practical. The &lt;a href="https://github.com/Ekiserrepe/cron-transaction-xahau" rel="noopener noreferrer"&gt;cron-transaction-xahau repository&lt;/a&gt; provides ready-to-use examples for implementing Cron Transactions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Prerequisites
&lt;/h3&gt;

&lt;p&gt;First, you'll need a Xahau testnet account. Get one at &lt;a href="https://xahau-test.net" rel="noopener noreferrer"&gt;https://xahau-test.net&lt;/a&gt; which will provide you with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An account address (starts with 'r')&lt;/li&gt;
&lt;li&gt;A seed/secret (starts with 's')&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Security Note&lt;/strong&gt;: Never share your seed! It's your private key. The examples use testnet seeds, but in production, use environment variables or secure key management.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Install a Hook with Collection Enabled
&lt;/h3&gt;

&lt;p&gt;The Hook must be installed with the &lt;code&gt;hsfCOLLECT&lt;/code&gt; flag (value: 4) to enable callback functionality:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;xahau&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;xahau&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;derive&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;utils&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;signAndSubmit&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;xrpl-accountlib&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;seed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;yourSeed&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Replace with your actual seed, get one at https://xahau-test.net/&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;network&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;wss://xahau-test.net&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;installHook&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;xahau&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;network&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;derive&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;familySeed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;seed&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;algorithm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;secp256k1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Account: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;address&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Connected to Xahau&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;networkInfo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;utils&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;txNetworkAndAccountValues&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;network&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;prepared&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;TransactionType&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;SetHook&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Account&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;address&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hooks&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hook&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookHash&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;83A41BE45166B33E66EF653512396409E1BF9FA85A7C15D0ABC81C24E2890CB3&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookNamespace&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0000000000000000000000000000000000000000000000000000000000000000&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookOn&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFBFFFFF&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Flags&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;],&lt;/span&gt;
      &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;networkInfo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;txValues&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Prepared SetHook transaction:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prepared&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;tx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;signAndSubmit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prepared&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;network&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Transaction result:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Error:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;finally&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;disconnect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Disconnected from Xahau&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;installHook&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3: Enable Account Collection
&lt;/h3&gt;

&lt;p&gt;Your account needs the &lt;code&gt;asfTshCollect&lt;/code&gt; flag enabled:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;xahau&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;xahau&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;derive&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;utils&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;signAndSubmit&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;xrpl-accountlib&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;seed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;yourSeed&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Replace with your actual seed, get one at https://xahau-test.net/&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;network&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;wss://xahau-test.net&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;setAccountFlag&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;xahau&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;network&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;derive&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;familySeed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;seed&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;algorithm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;secp256k1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Account: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;address&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Connected to Xahau&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;networkInfo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;utils&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;txNetworkAndAccountValues&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;network&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;prepared&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;TransactionType&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;AccountSet&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Account&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;address&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;SetFlag&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// asfTshCollect - Enable Transaction Signature Hook Collection&lt;/span&gt;
      &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;networkInfo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;txValues&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Prepared AccountSet transaction:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prepared&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;tx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;signAndSubmit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prepared&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;network&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Transaction result:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Error:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;finally&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;disconnect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Disconnected from Xahau&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;setAccountFlag&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4: Schedule Your Cron Job
&lt;/h3&gt;

&lt;p&gt;Once your Hook is installed and your account is configured, create the CronSet transaction:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;xahau&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;xahau&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;derive&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;utils&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;signAndSubmit&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;xrpl-accountlib&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;seed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;yourSeed&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Replace with your seed&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;network&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;wss://xahau-test.net&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;createCronSet&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;xahau&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;network&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;derive&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;familySeed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;seed&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;algorithm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;secp256k1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Account: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;address&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Connected to Xahau&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;networkInfo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;utils&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;txNetworkAndAccountValues&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;network&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Convert current time to Ripple Epoch (seconds since January 1, 2000 00:00 UTC)&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;RIPPLE_EPOCH_OFFSET&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;946684800&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;currentUnixTime&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;startTimeRippleEpoch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;currentUnixTime&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;RIPPLE_EPOCH_OFFSET&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Start in 1 minute&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;prepared&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;TransactionType&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;CronSet&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Account&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;address&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Your Hook address&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;StartTime&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;startTimeRippleEpoch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Or use 0 for immediate start&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;RepeatCount&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Number of times to repeat the task&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;DelaySeconds&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;120&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// 2 minutes&lt;/span&gt;
      &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;networkInfo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;txValues&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Prepared CronSet transaction:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prepared&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;tx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;signAndSubmit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prepared&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;network&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Transaction result:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Error:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;finally&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;disconnect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Disconnected from Xahau&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;createCronSet&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This schedules your Hook to execute based on your specified parameters.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5: Monitor and Manage
&lt;/h3&gt;

&lt;p&gt;You can check your scheduled executions on explorers like &lt;a href="https://xahau-testnet.xrplwin.com" rel="noopener noreferrer"&gt;XRPLWin&lt;/a&gt;. To stop a scheduled Cron job:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;xahau&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;xahau&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;derive&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;utils&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;signAndSubmit&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;xrpl-accountlib&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;seed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;yourSeed&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Replace with your seed&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;network&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;wss://xahau-test.net&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;removeCronSet&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;xahau&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;network&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;derive&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;familySeed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;seed&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;algorithm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;secp256k1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Account: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;address&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Connected to Xahau&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;networkInfo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;utils&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;txNetworkAndAccountValues&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;network&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;prepared&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;TransactionType&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;CronSet&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Account&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;address&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Your Hook address&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Flags&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// tfCronUnset - this removes the cron job&lt;/span&gt;
      &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;networkInfo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;txValues&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Prepared CronUnset transaction:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prepared&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;tx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;signAndSubmit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prepared&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;network&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Transaction result:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Error:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;finally&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;disconnect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Disconnected from Xahau&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;removeCronSet&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  The No-Code Alternative: HookStore
&lt;/h2&gt;

&lt;h3&gt;
  
  
  For Non-Technical Users
&lt;/h3&gt;

&lt;p&gt;Not everyone is comfortable working with code, and that's perfectly fine! The Xahau ecosystem provides user-friendly alternatives for those who want to leverage the power of Cron Transactions without diving into technical implementation.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;HookStore&lt;/strong&gt; (&lt;a href="https://hookstore.xahau.network" rel="noopener noreferrer"&gt;https://hookstore.xahau.network&lt;/a&gt;) is a public marketplace where developers publish their Hooks, making them accessible to everyone through a simple interface. Think of it as an "app store" for Xahau Hooks.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using Ping-Cron Through Xaman
&lt;/h3&gt;

&lt;p&gt;Our process is available on the HookStore as &lt;strong&gt;Ping-Cron&lt;/strong&gt;, which you can find at:&lt;br&gt;
👉 &lt;a href="https://hookstore.xahau.network/hooks/ping-cron" rel="noopener noreferrer"&gt;https://hookstore.xahau.network/hooks/ping-cron&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This process is specifically designed for implementing Cron functionality without writing a single line of code. Here's what makes it special:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Xaman Integration&lt;/strong&gt;: The entire process is managed through the Xaman wallet app—no terminal, no coding required&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Visual Interface&lt;/strong&gt;: Configure your scheduling parameters through an intuitive interface&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One-Click Installation&lt;/strong&gt;: Install the Hook directly to your account with proper configuration&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automatic Setup&lt;/strong&gt;: The HookStore handles all the technical details, including flags and parameters&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  How It Works for End Users
&lt;/h3&gt;

&lt;p&gt;The process is remarkably simple:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Open the HookStore link&lt;/strong&gt; in your browser&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Review the Hook details&lt;/strong&gt; including what it does&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Click on Install&lt;/strong&gt; below the README notes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Configure your schedule&lt;/strong&gt; using the provided interface:

&lt;ul&gt;
&lt;li&gt;Set when you want it to start&lt;/li&gt;
&lt;li&gt;Choose how many times it should run&lt;/li&gt;
&lt;li&gt;Define the interval between executions&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sign the transactions&lt;/strong&gt; in Xaman&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Done!&lt;/strong&gt; Your example is installed and working!&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Benefits of Using HookStore
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No Technical Knowledge Required&lt;/strong&gt;: Perfect for business users, traders, and anyone who needs automation without coding&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verified Hooks&lt;/strong&gt;: Hooks on the HookStore are reviewed and documented&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Community Support&lt;/strong&gt;: Each Hook has its own page with descriptions and usage instructions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Safe Testing&lt;/strong&gt;: You can try Hooks on testnet before using them on mainnet&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  When to Choose HookStore vs. Custom Implementation
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Use HookStore when:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need a quick solution without development time&lt;/li&gt;
&lt;li&gt;You're not comfortable with coding&lt;/li&gt;
&lt;li&gt;You want to test functionalities before building custom solutions&lt;/li&gt;
&lt;li&gt;You need standard automation patterns that already exist&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Build custom implementations when:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need specific business logic not available in existing Hooks&lt;/li&gt;
&lt;li&gt;You want complete control over the Hook's behavior&lt;/li&gt;
&lt;li&gt;You're building a unique application with proprietary features&lt;/li&gt;
&lt;li&gt;You need to optimize for specific performance requirements&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The beauty of Xahau is that both approaches are valid and serve different audiences. The HookStore democratizes access to blockchain automation, while custom development enables innovation and specialized solutions.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Bigger Picture
&lt;/h2&gt;

&lt;p&gt;Cron Transactions represent a significant step toward truly autonomous blockchain applications. Combined with Xahau's other features like Hooks, Remarks, and URITokens, developers can build sophisticated decentralized applications that operate independently.&lt;/p&gt;

&lt;p&gt;This automation capability opens doors for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;DeFi protocols&lt;/strong&gt; with automated rebalancing&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gaming systems&lt;/strong&gt; with scheduled events&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Supply chain solutions&lt;/strong&gt; with periodic updates&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Governance mechanisms&lt;/strong&gt; with automated proposal processing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As I mentioned in &lt;a href="https://dev.to/ekiserrepe/learning-xahau-the-importance-of-building-your-own-business-layer-1e6g"&gt;my article about building your own business layer&lt;/a&gt;, Xahau empowers developers to create their own logic without permission. Cron Transactions extend this freedom by adding the dimension of time-based automation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts and Resources
&lt;/h2&gt;

&lt;p&gt;Cron Transactions showcase Xahau's commitment to providing developers with powerful, practical tools. By moving scheduling on-chain, Xahau eliminates external dependencies and creates truly autonomous applications.&lt;/p&gt;

&lt;p&gt;The complete working code for this article is available at:&lt;br&gt;
👉 &lt;a href="https://github.com/Ekiserrepe/cron-transaction-xahau" rel="noopener noreferrer"&gt;https://github.com/Ekiserrepe/cron-transaction-xahau&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Remember, we're still in the early days of Xahau. If you have ideas for using Cron Transactions in innovative ways, now is the perfect time to experiment and potentially become a pioneer in this space.&lt;/p&gt;

&lt;p&gt;Feel free to reach out with questions, or join the &lt;a href="https://discord.gg/ds7nb93mYj" rel="noopener noreferrer"&gt;Xahau Contributors Discord server&lt;/a&gt;, where we'll be happy to help you implement your automated Hook solutions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://xahau.network/" rel="noopener noreferrer"&gt;Official Website&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://xahau.network/docs" rel="noopener noreferrer"&gt;Official Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://builder.xahau.network/" rel="noopener noreferrer"&gt;Hooks Builder&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://discord.gg/ds7nb93mYj" rel="noopener noreferrer"&gt;Discord Server&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/Xahau/xahaud" rel="noopener noreferrer"&gt;Xahaud&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://x.com/XahauNetwork" rel="noopener noreferrer"&gt;X Account&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>automation</category>
      <category>tutorial</category>
      <category>web3</category>
      <category>blockchain</category>
    </item>
    <item>
      <title>HookCanEmit, an Extra Step Towards Making Xahau a Safer Place</title>
      <dc:creator>Ekiserrepe</dc:creator>
      <pubDate>Sat, 14 Jun 2025 11:24:01 +0000</pubDate>
      <link>https://dev.to/ekiserrepe/hookcanemit-an-extra-step-towards-making-xahau-a-safer-place-5cn8</link>
      <guid>https://dev.to/ekiserrepe/hookcanemit-an-extra-step-towards-making-xahau-a-safer-place-5cn8</guid>
      <description>&lt;p&gt;Welcome to a new chapter of Learning Xahau, a space where you’ll find in-depth articles about Xahau—both theoretical and practical—designed for all audiences. If this is your first time here and you want to learn the basics, I recommend checking out the first article in the Learning Xahau series.&lt;/p&gt;

&lt;p&gt;Today we’re talking about &lt;code&gt;HookCanEmit&lt;/code&gt;, a new optional parameter we can use when installing Hooks. If you’re not familiar with Hooks or Xahau, I’ll start with a brief introduction.&lt;/p&gt;

&lt;p&gt;Xahau is an independent decentralized blockchain based on the XRP Ledger codebase. What makes Xahau special is the introduction of innovations not available on the XRP Ledger, such as Hooks—a technology that enables the creation of smart contracts in a simpler, safer, and regulation-friendly way compared to the EVM vision.&lt;/p&gt;

&lt;p&gt;Hooks are pieces of code you can write yourself or use from other users on the network. To make your Hook available on Xahau, you must first go through a process called Create, where the Hook is uploaded to Xahau for the first time. This creates a &lt;code&gt;HookHash&lt;/code&gt;, an ID that you can share if you want others to install it. Once a Hook is created, any further use of it is considered an Install operation. Both Create and Install operations use the &lt;code&gt;SetHook&lt;/code&gt; transaction, but it’s important to distinguish between them if you ever need help or need to explain where you're stuck.&lt;/p&gt;

&lt;p&gt;Since we're talking about Hooks, it’s worth noting that Hooks do not exist independently in Xahau—they are installed on Xahau accounts. Each account can have up to 10 Hooks installed. Think of Hooks as plug-ins that give Xahau accounts new behaviors—they gain “superpowers” that let them react to specific transaction types in ways they normally wouldn’t.&lt;/p&gt;

&lt;p&gt;Back to installing Hooks: you may have guessed that to install a third-party Hook, you’ll need its &lt;code&gt;HookHash&lt;/code&gt;. HookHashes look something like this: &lt;code&gt;610F33B8EBF7EC795F822A454FB852156AEFE50BE0CB8326338A81CD74801864&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Although some developers may publish their source code and you can compile the file to see if you get the same &lt;code&gt;HookHash&lt;/code&gt; to confirm that it is the same code the developer shows you, it may happen that a user does not have access to the source code of a Hook they want to install. This could occur for many reasons: it's impossible to locate the hook's creator or their repository, the creator does not want someone to copy the hook's logic because it is part of their business or they charge a fee and don't want others to remove the commission request from the business. Contractually, the developed hook is not allowed to be published, and many other reasons. So it is possible that a user finds themselves in the dilemma of whether or not to install a hook. They could be guided by the creator's reputation or the popularity of the hook, but they can never be 100% sure that the code does what it says or that the code only does what it claims to do.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;HookCanEmit&lt;/code&gt;, the reason for this article, adds an extra optional security step for when you need to install a Hook. HookCanEmit is one of the latest improvements added in Xahau in the &lt;code&gt;2025.5.1-release+1762&lt;/code&gt; release of the xahaud software. &lt;code&gt;HookCanEmit&lt;/code&gt; allows the user to decide what type of transactions they want to allow when this Hook is executed. It is similar to the &lt;code&gt;HookOn&lt;/code&gt; parameter, which indicates what type of transactions the Hook should be triggered by. More info: &lt;a href="https://docs.xahau.network/concepts/hookon-field" rel="noopener noreferrer"&gt;https://docs.xahau.network/concepts/hookon-field&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If I want to install a hook (whose code I cannot verify or do not understand the source code) that automates NFT minting processes, what I do not expect (or want) is for the hook to send payments out of my account without me knowing, or create buy or sell offers for tokens, which are other types of transactions the account can generate. Therefore, if we use the &lt;code&gt;HookCanEmit&lt;/code&gt; field, we could block these types of transactions and only allow NFT creation. This avoids erroneous or malicious behaviors that someone could introduce into their hooks.&lt;/p&gt;

&lt;p&gt;You can generate a &lt;code&gt;HookCanEmit&lt;/code&gt; value using &lt;a href="https://x.com/RichardXRPL" rel="noopener noreferrer"&gt;Richard Holland&lt;/a&gt;’s calculator: &lt;a href="https://richardah.github.io/xrpl-hookon-calculator/" rel="noopener noreferrer"&gt;https://richardah.github.io/xrpl-hookon-calculator/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3785qys5jchtcrkd6cyx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3785qys5jchtcrkd6cyx.png" alt="HookOn (&amp;amp; HookCanEmit) Calculator" width="612" height="809"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As we can see in the image, if we want our Hook to only be able to emit transactions of the &lt;code&gt;Payment&lt;/code&gt; type, we should check the option and copy the result provided by the page. In this case, we click PAYMENT and the result is this code: &lt;code&gt;FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFE&lt;/code&gt; (ignore 0x part)&lt;/p&gt;

&lt;p&gt;If we want it to only work with the NFT minting transaction, we select URITOKEN_MINT and it results in the following code: &lt;code&gt;FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDFBFFFFF&lt;/code&gt; (ignore 0x part)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5dzeduh0b2l2kmpzt7fn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5dzeduh0b2l2kmpzt7fn.png" alt="Allowing NFT minting" width="597" height="809"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Time to Get Hands-On
&lt;/h2&gt;

&lt;h3&gt;
  
  
  First Test, blocking all types of transactions that can be emitted
&lt;/h3&gt;

&lt;p&gt;Let's confirm that what we say is true. For this, I will use my &lt;a href="https://github.com/Ekiserrepe/forwarder-hook" rel="noopener noreferrer"&gt;Forwarder Hook&lt;/a&gt;  that serves to forward a payment that enters the account where this hook is installed. We use this hook because by its nature it will have to emit a &lt;code&gt;Payment&lt;/code&gt; transaction if it receives funds and has configured addresses to which to forward this money. In the Xahau Testnet, I created the account &lt;code&gt;rMLRy72cWuPgCBxjni7e84ThuwRsBDta9p&lt;/code&gt; and install the hook adding the &lt;code&gt;HookCanEmit&lt;/code&gt; &lt;code&gt;FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFF&lt;/code&gt; to prevent the hook from emitting, since with this code we do not allow any type of emission.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;TransactionType&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;SetHook&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Account&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;your_address&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Flags&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hooks&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hook&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookHash&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;319E16820BAEF9A08C51F52C97338D4CF09E6E53991B4131820A079721C64EA1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookNamespace&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0000000000000000000000000000000000000000000000000000000000000000&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookOn&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFFF7FFFFFBFFFFE&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookCanEmit&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFF&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;],&lt;/span&gt;
      &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;networkInfo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;txValues&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We confirm that the transaction has been successful in XRPLWin: &lt;a href="https://xahau-testnet.xrplwin.com/tx/31F8C8948C678347CDFC25CC2C59608BD413778BEDDB9B61435F7F6B3111D90C#overview" rel="noopener noreferrer"&gt;https://xahau-testnet.xrplwin.com/tx/31F8C8948C678347CDFC25CC2C59608BD413778BEDDB9B61435F7F6B3111D90C#overview&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Forwarder Hook needs to pre-configure an address to which we want to forward what enters the account where we are installing the hook, so we are going to configure this one: &lt;code&gt;rf1NrYAsv92UPDd8nyCG4A3bez7dhYE61r&lt;/code&gt; which using the &lt;a href="https://transia-rnd.github.io/xrpl-hex-visualizer/" rel="noopener noreferrer"&gt;XRPL Hex Visualizer&lt;/a&gt; tells us that in Hex it would be &lt;code&gt;4B50699E253C5098DEFE3A0872A79D129172F496&lt;/code&gt;. We can use this transaction:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;TransactionType&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Invoke&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nx"&gt;Account&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;your_address&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nx"&gt;Flags&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nx"&gt;HookParameters&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="na"&gt;HookParameter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;HookParameterName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;414444&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;HookParameterValue&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;D53F733E54B866B9FBDB85762071832B03A56C76&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="na"&gt;HookParameter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;HookParameterName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;4E554D&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;HookParameterValue&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;00&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="p"&gt;],&lt;/span&gt;
      &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;networkInfo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;txValues&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We execute the transaction and check that everything went well; we should receive a message that the address has been added like this:  &lt;a href="https://xahau-testnet.xrplwin.com/tx/4F8B247877BFC44B033C14ED1C5945B395F95C38261AB2FA2067D782BAD94043" rel="noopener noreferrer"&gt;https://xahau-testnet.xrplwin.com/tx/4F8B247877BFC44B033C14ED1C5945B395F95C38261AB2FA2067D782BAD94043&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frjjrzyqwfijljtkz684k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frjjrzyqwfijljtkz684k.png" alt="The address has been added to the Forwarder Hook" width="312" height="215"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now the acid test: let's check that &lt;code&gt;HookCanEmit&lt;/code&gt; works as expected. The account &lt;code&gt;rMLRy72cWuPgCBxjni7e84ThuwRsBDta9p&lt;/code&gt; should not allow the Forwarder Hook to emit an outgoing transaction from the account. Let's see. The account receives a payment of 1 XAH from the account &lt;code&gt;rBHk1ekqaVkKzkrsivbajrw5ZE3omR23Ax&lt;/code&gt; but was not able to emit the money forwarding to the account &lt;code&gt;rf1NrYAsv92UPDd8nyCG4A3bez7dhYE61r&lt;/code&gt; as the hook was expected to do.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frwv5zz25py9f5e1wxev0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frwv5zz25py9f5e1wxev0.png" alt="The account received a Payment but was not able to forward the Payment" width="800" height="204"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In fact, the hook believes that the execution was correct, emitting the forwarding transaction and returning a success message, but our "firewall" &lt;code&gt;HookCanEmit&lt;/code&gt; stopped the transaction. Here you can see how the hook thinks everything went fine.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7eft5fhibkj8fovhw6kd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7eft5fhibkj8fovhw6kd.png" alt="The hook thinks everything went ok" width="725" height="293"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Second test, let's allow it to emit payments.
&lt;/h3&gt;

&lt;p&gt;In this case, we are going to delete the hook and reinstall it. That way we learn more operations with this test. Here would be the transaction that uninstalls the hook:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;TransactionType&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;SetHook&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Account&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;your_address&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Flags&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nx"&gt;Hooks&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;        
        &lt;span class="p"&gt;{&lt;/span&gt;                        
            &lt;span class="na"&gt;Hook&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="na"&gt;CreateCode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="na"&gt;Flags&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
      &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;networkInfo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;txValues&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we can confirm that the hook has been uninstalled: &lt;a href="https://xahau-testnet.xrplwin.com/tx/B8E94645D10E403ABA60525372208BDA90248C14118231E7047174AA7E233533" rel="noopener noreferrer"&gt;https://xahau-testnet.xrplwin.com/tx/B8E94645D10E403ABA60525372208BDA90248C14118231E7047174AA7E233533&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we are going to install the hook again but granting permission for &lt;code&gt;Payment&lt;/code&gt; transactions. To do this, we go to the calculator &lt;a href="https://richardah.github.io/xrpl-hookon-calculator/" rel="noopener noreferrer"&gt;https://richardah.github.io/xrpl-hookon-calculator/&lt;/a&gt; and activate the Payment button, which results in this code: &lt;code&gt;FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFE&lt;/code&gt;. Remember to ignore the 0x.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F96hc6ldnqr2s0i2l7j0u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F96hc6ldnqr2s0i2l7j0u.png" alt="Allowing Payments" width="604" height="807"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We generate a &lt;code&gt;SetHook&lt;/code&gt; transaction to install the hook with permission in &lt;code&gt;HookCanEmit&lt;/code&gt; for &lt;code&gt;Payment&lt;/code&gt; emissions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;TransactionType&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;SetHook&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Account&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;your_address&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Flags&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hooks&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hook&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookHash&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;319E16820BAEF9A08C51F52C97338D4CF09E6E53991B4131820A079721C64EA1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookNamespace&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0000000000000000000000000000000000000000000000000000000000000000&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookOn&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFFF7FFFFFBFFFFE&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;HookCanEmit&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFE&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;],&lt;/span&gt;
      &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;networkInfo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;txValues&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once installed, we can go check the transaction on XRPLWin and confirm that we have done it correctly. &lt;a href="https://xahau-testnet.xrplwin.com/tx/0A2F2243963533F716A1D11C08786B41AE366E7CD5753AA7EB4B9D7EEF0555D9" rel="noopener noreferrer"&gt;https://xahau-testnet.xrplwin.com/tx/0A2F2243963533F716A1D11C08786B41AE366E7CD5753AA7EB4B9D7EEF0555D9&lt;/a&gt;. If we click on the Information block in the Summary, we see the "Allowed emission types" section where the transaction type &lt;code&gt;ttPayment&lt;/code&gt; is marked as valid.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fokul3kexddp2xo94nbic.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fokul3kexddp2xo94nbic.png" alt="Checking which transaction type is allowed" width="732" height="464"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Everything is ready, let's send a transaction to the hook's account to see if now it is able to forward it. If you deleted the namespace, remember you will have to repeat the process of adding a forwarding account for the forwarder hook. If you followed the steps just like I did, you won’t have to do it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0xhv84zkl00adj24t5za.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0xhv84zkl00adj24t5za.png" alt="This time the hook has been able to emit a Payment transaction" width="800" height="226"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This time, &lt;code&gt;HookCanEmit&lt;/code&gt; allows us to perform payment emissions from the hook, so the operation was completed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final words and code
&lt;/h2&gt;

&lt;p&gt;As you can see, &lt;code&gt;HookCanEmit&lt;/code&gt; is an extra step that all Xahau users can use to avoid surprises or unexpected behavior. Just as we should have digital hygiene with our passwords on the Internet, we must also make responsible use of the configuration of the hooks we install in order to work more securely and enjoy the opportunities Xahau offers us.&lt;/p&gt;

&lt;p&gt;The code used in this article is available at: &lt;a href="https://github.com/Ekiserrepe/Xahau-HookCanEmit-Example" rel="noopener noreferrer"&gt;https://github.com/Ekiserrepe/Xahau-HookCanEmit-Example&lt;/a&gt; in case you need it.&lt;/p&gt;

&lt;p&gt;Feel free to reach out with questions, or join the &lt;a href="https://discord.gg/ds7nb93mYj" rel="noopener noreferrer"&gt;Xahau Contributors Discord server&lt;/a&gt;, where we’ll be happy to help.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Links&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://xahau.network/" rel="noopener noreferrer"&gt;Official Website&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.xahau.network/" rel="noopener noreferrer"&gt;Official Docs&lt;/a&gt;&lt;br&gt;
&lt;a href="https://builder.xahau.network/" rel="noopener noreferrer"&gt;Hooks Builder&lt;/a&gt;&lt;br&gt;
&lt;a href="https://discord.gg/ds7nb93mYj" rel="noopener noreferrer"&gt;Discord Server&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/Xahau/xahaud" rel="noopener noreferrer"&gt;Xahaud&lt;/a&gt;&lt;br&gt;
&lt;a href="https://x.com/XahauNetwork" rel="noopener noreferrer"&gt;X Account&lt;/a&gt;&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>web3</category>
      <category>smartcontract</category>
      <category>xahau</category>
    </item>
    <item>
      <title>Learning Xahau: Storing On-Chain Data with Remarks</title>
      <dc:creator>Ekiserrepe</dc:creator>
      <pubDate>Mon, 09 Jun 2025 20:03:50 +0000</pubDate>
      <link>https://dev.to/ekiserrepe/learning-xahau-storing-on-chain-data-with-remarks-463i</link>
      <guid>https://dev.to/ekiserrepe/learning-xahau-storing-on-chain-data-with-remarks-463i</guid>
      <description>&lt;p&gt;Welcome to Learning Xahau, a series of articles designed to help you better understand the Xahau blockchain from both theoretical and practical perspectives—accessible to all audiences.&lt;/p&gt;

&lt;p&gt;Xahau is an independent blockchain based on the XRP Ledger codebase, enriched with many new features, such as Hooks—a new, simpler, and more secure vision for implementing smart contracts that diverges from the traditional EVM concept.&lt;br&gt;
If you're eager to learn more about Xahau, be sure to explore the other articles in the Learning Xahau series.&lt;/p&gt;
&lt;h2&gt;
  
  
  Introduction to Remarks
&lt;/h2&gt;

&lt;p&gt;In this article, we’ll cover Remarks, a new feature introduced for the first time in version &lt;code&gt;2025.5.1-release+1762&lt;/code&gt; of &lt;a href="https://github.com/Xahau/xahaud" rel="noopener noreferrer"&gt;xahaud&lt;/a&gt; (the software that powers the Xahau network).&lt;br&gt;
Remarks are a form of annotation that can be added to Xahau objects. &lt;strong&gt;These annotations follow a key-value format&lt;/strong&gt;. This means you use one variable to identify a field (the key) and assign it a desired value. For example: "Name (key): Jose (value)".&lt;br&gt;
&lt;strong&gt;Each Xahau object can store up to 32 Remarks.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Depending on the object, either the owner or the issuer has permission to write Remarks to it. Additionally, each Remark can be set as mutable or immutable using the &lt;code&gt;tfInmutable&lt;/code&gt; flag. This is especially useful for dynamic objects like NFTs.&lt;/p&gt;

&lt;p&gt;You can check the list of object types and who is allowed to write Remarks to them in the official documentation:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl5lf716mrmol4a9s594j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl5lf716mrmol4a9s594j.png" alt="Image description" width="792" height="641"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you'd like to dive deeper into the technical side of Remarks, we recommend the dedicated &lt;a href="https://docs.xahau.network/technical/protocol-reference/transactions/transaction-types/setremarks" rel="noopener noreferrer"&gt;SetRemarks transaction&lt;/a&gt; documentation on Xahau Docs.&lt;/p&gt;

&lt;p&gt;Here’s an example of a SetRemarks transaction:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"TransactionType"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"SetRemarks"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Account"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Flags"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"ObjectID"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"AABBCCDDEEFF00112233445566778899AABBCCDDEEFF00112233445566778899"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Remarks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Remark"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"RemarkName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"CAFE"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"RemarkValue"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"DEADBEEF"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"Flags"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In all &lt;code&gt;SetRemarks&lt;/code&gt; transactions, you must specify the target object in the &lt;code&gt;ObjectID&lt;/code&gt; field. Then, define the Remarks you wish to include. The &lt;code&gt;Flags&lt;/code&gt; field determines whether the Remark is mutable (0 for mutable, 1 for immutable).&lt;br&gt;
Both &lt;code&gt;RemarkName&lt;/code&gt; (key) and &lt;code&gt;RemarkValue&lt;/code&gt; (value) must be written in hexadecimal.&lt;br&gt;
If you leave the &lt;code&gt;RemarkValue&lt;/code&gt; empty, the Remark will be deleted.&lt;/p&gt;

&lt;h2&gt;
  
  
  Practical Use Cases for Remarks
&lt;/h2&gt;

&lt;p&gt;Remarks are ideal for storing small pieces of data on-chain, removing the need to manage databases.&lt;br&gt;
By eliminating the dependency on external connections and storing data directly on Xahau, processes become easier—just remember the 32-entry limit per object.&lt;/p&gt;

&lt;p&gt;Here are a few practical examples of how Remarks can be used (feel free to share your ideas to include them in this article):&lt;/p&gt;

&lt;h3&gt;
  
  
  Tagging Accounts or Indicating Status
&lt;/h3&gt;

&lt;p&gt;Xahau addresses aren’t user-friendly by default. That’s why apps like &lt;a href="https://xaman.app" rel="noopener noreferrer"&gt;Xaman&lt;/a&gt; let you assign aliases to Xahau addresses to improve usability. With Remarks, you can now tag your accounts on-chain, and view them in an explorer.&lt;br&gt;
&lt;em&gt;Note: This data is public, so avoid storing private or sensitive information for security reasons.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Another use case is indicating a &lt;strong&gt;status&lt;/strong&gt;.&lt;br&gt;
Let’s say one of your Xahau accounts has several Hooks installed that power a complex process. If you need to update or replace one or more of these Hooks, the process might go offline temporarily. A &lt;code&gt;Status&lt;/code&gt; Remark like &lt;code&gt;"Active"&lt;/code&gt;, &lt;code&gt;"Closed"&lt;/code&gt;, or &lt;code&gt;"Under Maintenance"&lt;/code&gt; can notify others of the current state.&lt;br&gt;
If properly documented, third-party services can use this information to avoid interacting with an inactive account.&lt;/p&gt;

&lt;p&gt;For example, I’ve set &lt;code&gt;"Status"&lt;/code&gt;: &lt;code&gt;"Open"&lt;/code&gt; for the account &lt;code&gt;rMLVXQxGXWrYnJXgEDL2qDqC48gMs4bJv&lt;/code&gt; on the Xahau Testnet.&lt;br&gt;
You can check it here: &lt;a href="https://xahau-testnet.xrplwin.com/tx/863389E180428B213D5E3062BFCBA452471AA6CA0229C49A40DE4835B767E1E1#overview" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr2afbj8ru56c4is7zbs8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr2afbj8ru56c4is7zbs8.png" alt="Image description" width="592" height="369"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  NFTs and On-Chain Metadata
&lt;/h3&gt;

&lt;p&gt;Xahau supports the &lt;code&gt;URIToken&lt;/code&gt; object for NFTs.&lt;br&gt;
If you're coming from the XRP Ledger ecosystem, you'll know that most NFT metadata is stored off-chain in a JSON file linked via IPFS. This means additional infrastructure is needed to retrieve and interpret that JSON file—something that can be tedious and error-prone.&lt;/p&gt;

&lt;p&gt;Here’s an example from my Power Zerps collection on the XRP Ledger. It’s a series of tokusatsu-inspired warriors, each with unique attributes like attack, defense, and health stats used in gameplay.&lt;br&gt;
Most metadata is stored off-chain in the JSON file, accessible through the URI field:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F02dj91wj3wf3xarmkgqq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F02dj91wj3wf3xarmkgqq.png" alt="Image description" width="800" height="750"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Opening the JSON reveals details such as &lt;code&gt;"Helmet"&lt;/code&gt;, &lt;code&gt;"Body Armor"&lt;/code&gt;, &lt;code&gt;"Color"&lt;/code&gt;, &lt;code&gt;"Attack"&lt;/code&gt;, &lt;code&gt;"Defense"&lt;/code&gt;, &lt;code&gt;"Health"&lt;/code&gt;, and &lt;code&gt;"Magic"&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp038u6l3vxwwiy8qlph9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp038u6l3vxwwiy8qlph9.png" alt="Image description" width="800" height="572"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before Remarks, if I wanted to use this data in a game, I couldn’t do it purely on-chain. I’d have to maintain a database, detect the NFT via blockchain queries, and cross-reference that with the metadata.&lt;/p&gt;

&lt;p&gt;With Remarks, the entire process is simpler. I can store this data on-chain, with no need for a database.&lt;br&gt;
As the issuer, I can embed attributes into each NFT as I mint them, and they’ll always be available. Since Remarks can also be mutable, I can make dynamic attributes for my NFTs—such as leveling up in an RPG game, or evolving traits.&lt;/p&gt;

&lt;p&gt;You could even use Remarks to indicate fallback sources for metadata or other explorer-friendly enhancements.&lt;/p&gt;

&lt;p&gt;Here’s an example of how the Power Zerp’s attributes appear in a test URIToken, viewable on &lt;a href="https://xahau-testnet.xrplwin.com/nft/A9F9E86C51165A38B66FD704962C19712881E2D6592A6406277F36AFAB2FE08F" rel="noopener noreferrer"&gt;XRPLWin&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwmt8ydzyicvk1unx3b82.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwmt8ydzyicvk1unx3b82.png" alt="Image description" width="800" height="757"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We focused on a gaming use case, but this can be applied to any environment where annotations or object tagging is needed.&lt;br&gt;
Imagine financial products that need identifiers, real-world assets represented on-chain with updatable traits, open or closed loans, new or used cars, or even a price oracle whose value is updated every few seconds.&lt;/p&gt;

&lt;p&gt;As I always say: your imagination is the limit.&lt;/p&gt;

&lt;h3&gt;
  
  
  Update: Price Oracle
&lt;/h3&gt;

&lt;p&gt;Here’s a new example with code for a Price Oracle.&lt;br&gt;
In this case, it’s a URIToken where we update the price and last update timestamp using Remarks.&lt;br&gt;
Repo: &lt;a href="https://github.com/Ekiserrepe/xahaupriceoracle-remarks" rel="noopener noreferrer"&gt;https://github.com/Ekiserrepe/xahaupriceoracle-remarks&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can check the updates live: &lt;a href="https://xahau-testnet.xrplwin.com/account/rsPUkjW4ukdwKEP6EqhRfsUN9cqqQr9rkr" rel="noopener noreferrer"&gt;https://xahau-testnet.xrplwin.com/account/rsPUkjW4ukdwKEP6EqhRfsUN9cqqQr9rkr&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftokvj484jxwbr4dp9oib.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftokvj484jxwbr4dp9oib.png" alt="Image description" width="539" height="473"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts &amp;amp; Sample Code
&lt;/h2&gt;

&lt;p&gt;As you can see, Remarks are a simple yet powerful addition to Xahau with great potential for tagging or storing small amounts of on-chain information.&lt;/p&gt;

&lt;p&gt;If you want to experiment with Remarks but aren’t sure where to start, here’s a GitHub repository with sample code to help you begin:&lt;br&gt;
👉 &lt;a href="https://github.com/Ekiserrepe/setRemarks-example-Xahau" rel="noopener noreferrer"&gt;https://github.com/Ekiserrepe/setRemarks-example-Xahau&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Feel free to reach out with questions, or join the &lt;a href="https://discord.gg/ds7nb93mYj" rel="noopener noreferrer"&gt;Xahau Contributors Discord server&lt;/a&gt;, where we’ll be happy to help.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Links&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://xahau.network/" rel="noopener noreferrer"&gt;Official Website&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.xahau.network/" rel="noopener noreferrer"&gt;Official Docs&lt;/a&gt;&lt;br&gt;
&lt;a href="https://builder.xahau.network/" rel="noopener noreferrer"&gt;Hooks Builder&lt;/a&gt;&lt;br&gt;
&lt;a href="https://discord.gg/ds7nb93mYj" rel="noopener noreferrer"&gt;Discord Server&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/Xahau/xahaud" rel="noopener noreferrer"&gt;Xahaud&lt;/a&gt;&lt;br&gt;
&lt;a href="https://x.com/XahauNetwork" rel="noopener noreferrer"&gt;X Account&lt;/a&gt;&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>web3</category>
      <category>xahau</category>
      <category>programming</category>
    </item>
    <item>
      <title>Learning Xahau: Time as a Variable for Your Business</title>
      <dc:creator>Ekiserrepe</dc:creator>
      <pubDate>Fri, 06 Jun 2025 19:10:53 +0000</pubDate>
      <link>https://dev.to/ekiserrepe/learning-xahau-time-as-a-variable-for-your-business-2a6c</link>
      <guid>https://dev.to/ekiserrepe/learning-xahau-time-as-a-variable-for-your-business-2a6c</guid>
      <description>&lt;p&gt;In this Learning Xahau article, we’ll talk about how we can use time as a variable in our project or business without being forced to use an Escrow-type transaction, thanks to the many features of Hooks, the smart contract technology used by Xahau.&lt;/p&gt;

&lt;p&gt;If you're new here and don’t yet know what the Xahau blockchain is, it’s a fork of the XRP Ledger base code that includes some improvements not available in the XRP Ledger—like Hooks, which allow Xahau users to implement complex logic easily (smart contracts). If you want more information, I recommend checking out the first article in this series: &lt;a href="https://dev.to/ekiserrepe/learning-xahau-what-is-xahau-104j"&gt;"Learning Xahau 1"&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you're coming from the XRP Ledger world, you know that you can’t implement custom logic directly on-chain. The only native transaction that allows the use of time in XRP Ledger (and also in Xahau) would be Escrow. Escrows allow locking amounts of the native token (in XRP Ledger) or any token (in Xahau), based on two possible conditions: time-based (lock these funds until a specific date/time), or conditional release, which is somewhat inaccurately named—it essentially unlocks when a "secret" is submitted. Escrows can also combine both conditions. One could argue that the Check transaction type is also time-based since you can add an expiration condition, but that’s not the focus of this article.&lt;/p&gt;

&lt;p&gt;In XRP Ledger, if you want to create time-based (or any custom logic) for your transactions, events, accounts, etc., you must build your own backend outside the blockchain. This means you need:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A server and configure it.&lt;/li&gt;
&lt;li&gt;A backend that stays connected and doesn't fail at critical moments.&lt;/li&gt;
&lt;li&gt;To store secret keys of your accounts on your own or someone else’s server—with all the risks that entails.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In short:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Server management.&lt;/li&gt;
&lt;li&gt;Persistent connection to the network.&lt;/li&gt;
&lt;li&gt;Private key storage risk.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In Xahau, however, you can create all the conditional logic you want inside a hook, deploy it to your own Xahau account, and everything works on Xahau. The hook can always listen to relevant transactions and execute your desired logic—without your interaction.&lt;/p&gt;

&lt;p&gt;This means:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You don’t need a server.&lt;/li&gt;
&lt;li&gt;You don’t need backend knowledge.&lt;/li&gt;
&lt;li&gt;Your secret keys are never exposed.&lt;/li&gt;
&lt;li&gt;Your service only stops if Xahau stops working.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Given these advantages, it makes sense to think of use cases or businesses where time is an important or necessary variable. Some examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An event happens on a specific date (or multiple).&lt;/li&gt;
&lt;li&gt;An event is triggered only after some delay.&lt;/li&gt;
&lt;li&gt;An event occurs only during a defined window of time.&lt;/li&gt;
&lt;li&gt;An event stops after a certain period or date.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Time isn’t just a useful variable—it can be combined with other conditions, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Triggering different transactions depending on the amount.&lt;/li&gt;
&lt;li&gt;Allowlisting or blocklisting sender or recipient addresses.&lt;/li&gt;
&lt;li&gt;Requiring a fee for acting as an intermediary.&lt;/li&gt;
&lt;li&gt;Creating custom rules or constraints.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The possibilities are nearly endless.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to test time in Xahau?
&lt;/h2&gt;

&lt;p&gt;You can start using the &lt;a href="https://builder.xahau.network/" rel="noopener noreferrer"&gt;Xahau Hooks Builder&lt;/a&gt;, an online IDE to develop and test hooks. There’s also the &lt;a href="https://hooks-toolkit.com/" rel="noopener noreferrer"&gt;Hooks Toolkit&lt;/a&gt;, a desktop SDK.&lt;/p&gt;

&lt;p&gt;Let’s create a hook in the &lt;a href="https://builder.xahau.network/" rel="noopener noreferrer"&gt;Xahau Hooks Builder&lt;/a&gt; and try the &lt;a href="https://docs.xahau.network/technical/hooks-functions/ledger/ledger_last_time" rel="noopener noreferrer"&gt;ledger_last_time()&lt;/a&gt; function, which returns the timestamp at the moment the hook is called.&lt;/p&gt;

&lt;p&gt;Here’s the &lt;a href="https://github.com/Ekiserrepe/timestamp-hook-xahau-example" rel="noopener noreferrer"&gt;full hook code&lt;/a&gt; so you can copy, paste, and modify it in the &lt;a href="https://builder.xahau.network/" rel="noopener noreferrer"&gt;Xahau Hooks Builder&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="c1"&gt;//Get timestamp from the last ledger&lt;/span&gt;
    &lt;span class="kt"&gt;int64_t&lt;/span&gt; &lt;span class="n"&gt;ts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ledger_last_time&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="n"&gt;TRACEVAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ts&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpm8c17bv712kno4n47kv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpm8c17bv712kno4n47kv.png" alt="Image description" width="600" height="139"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, we've created a variable called &lt;strong&gt;ts&lt;/strong&gt; that stores the execution timestamp (technically of the last closed ledger, but we’ll keep it simple). &lt;strong&gt;The timestamp is the number of seconds since a reference date&lt;/strong&gt;. In our example, the timestamp is 802547943, which corresponds to June 6, 2025.&lt;/p&gt;

&lt;p&gt;If we go to &lt;a href="https://transia-rnd.github.io/xrpl-time-visualizer/" rel="noopener noreferrer"&gt;XRPL Time Visualizer&lt;/a&gt; by &lt;a href="https://x.com/angell_denis" rel="noopener noreferrer"&gt;Denis Angell&lt;/a&gt;, enter the timestamp, and click "From XRPL Time", it will return the current date.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The Xahau/XRPL timestamp is not the same as Unix time. To convert it to Unix time, you must add 946684800 to your timestamp, since Xahau’s base date is Jan 1, 2000, while Unix time starts on Jan 1, 1970 at 00:00:00 UTC.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdar3oimryoy5m6pc8wxe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdar3oimryoy5m6pc8wxe.png" alt="Image description" width="731" height="331"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s create a variable representing 2 minutes. Since the timestamp is in seconds, we can set it to 120 seconds or 2 * 60. We can use this variable later to add it to other timestamp variables and create conditions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="c1"&gt;//Set a variable representing 2 minutes&lt;/span&gt;
    &lt;span class="kt"&gt;int64_t&lt;/span&gt; &lt;span class="n"&gt;two_min&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;TRACEVAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;two_min&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F53dxvw60g3d3sb9h09bi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F53dxvw60g3d3sb9h09bi.png" alt="Image description" width="438" height="26"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can also declare a fixed timestamp for use as a base. In this case, we assign the value &lt;code&gt;802549410&lt;/code&gt; to &lt;strong&gt;my_ts&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;    &lt;span class="c1"&gt;//Set my own ts&lt;/span&gt;
    &lt;span class="kt"&gt;int64_t&lt;/span&gt; &lt;span class="n"&gt;my_ts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;802549410&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;TRACEVAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_ts&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc5f7b3l7hdtb36vqudym.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc5f7b3l7hdtb36vqudym.png" alt="Image description" width="473" height="38"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also save a timestamp in a namespace—"simple key-value tables where we store data on Xahau". For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;    &lt;span class="c1"&gt;//Save my_ts in a namespace&lt;/span&gt;
    &lt;span class="n"&gt;state_set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SVAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_ts&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;SBUF&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dest_param&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can verify on the &lt;a href="https://xahau-testnet.xrplwin.com/" rel="noopener noreferrer"&gt;Xahau Testnet de XRPLWin&lt;/a&gt; that your account has a declared namespace where the timestamp was saved:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx89j1wul8rgr7awbenj4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx89j1wul8rgr7awbenj4.png" alt="Image description" width="800" height="511"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, the stored value is &lt;code&gt;A2EED52F00000000&lt;/code&gt;, which we need to convert from HEX to a readable format. Using the &lt;a href="https://transia-rnd.github.io/xrpl-hex-visualizer/" rel="noopener noreferrer"&gt;XRPL Hex Visualizer&lt;/a&gt;, enter the value and click "From Hex". You’ll see it returns &lt;code&gt;802549410&lt;/code&gt;, just like the value we saved in the hook.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxroy6yuemnghv9y8d9xw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxroy6yuemnghv9y8d9xw.png" alt="Image description" width="632" height="330"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Of course, we can also retrieve our timestamp from the namespace later, using this code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;    &lt;span class="c1"&gt;//Get my_ts from my namespace&lt;/span&gt;
    &lt;span class="kt"&gt;int64_t&lt;/span&gt; &lt;span class="n"&gt;get_ts&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SVAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;get_ts&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;SBUF&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dest_param&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="n"&gt;TRACEVAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;get_ts&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Famgdpmot1pu7tk4hj9t2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Famgdpmot1pu7tk4hj9t2.png" alt="Image description" width="488" height="40"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From here on, with these tools, your imagination is the limit. If you want to continue building and have any questions you can join to the &lt;a href="https://discord.gg/ds7nb93mYj" rel="noopener noreferrer"&gt;Discord Xahau Builders&lt;/a&gt; server.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Links&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://xahau.network/" rel="noopener noreferrer"&gt;Official Website&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.xahau.network/" rel="noopener noreferrer"&gt;Official Docs&lt;/a&gt;&lt;br&gt;
&lt;a href="https://builder.xahau.network/" rel="noopener noreferrer"&gt;Hooks Builder&lt;/a&gt;&lt;br&gt;
&lt;a href="https://discord.gg/ds7nb93mYj" rel="noopener noreferrer"&gt;Discord Server&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/Xahau/xahaud" rel="noopener noreferrer"&gt;Xahaud&lt;/a&gt;&lt;br&gt;
&lt;a href="https://x.com/XahauNetwork" rel="noopener noreferrer"&gt;X Account&lt;/a&gt;&lt;/p&gt;

</description>
      <category>xahau</category>
      <category>blockchain</category>
      <category>web3</category>
      <category>smartcontract</category>
    </item>
    <item>
      <title>Learning Xahau: Inflation and Deflation as Core Elements of Its Design</title>
      <dc:creator>Ekiserrepe</dc:creator>
      <pubDate>Wed, 21 May 2025 15:42:09 +0000</pubDate>
      <link>https://dev.to/ekiserrepe/learning-xahau-inflation-and-deflation-as-core-elements-of-its-design-54l4</link>
      <guid>https://dev.to/ekiserrepe/learning-xahau-inflation-and-deflation-as-core-elements-of-its-design-54l4</guid>
      <description>&lt;p&gt;&lt;strong&gt;In today's world, the word "inflation" sparks fear wherever it is mentioned.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It is felt on supermarket shelves, in transportation, energy and gas bills, in the consumption and acquisition of services and properties, in life expectancy, and even in birth rates. Inflation is part of our daily lives due to a variety of national and international factors. It has reshaped our routines and the way we work.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Inflation is the sustained and widespread increase in the prices of goods and services within an economy over time.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This means that, as time goes by, the purchasing power of money decreases, as more money is required to buy the same products or services.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When we bring inflation into the blockchain world, it becomes a topic of interest and concern for users.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Blockchains are designed for different purposes, and understanding the specific use case of the blockchain we intend to use is essential for the project, business, or service we want to build on it. When we talk about inflation in the context of blockchain, we are usually referring to whether the protocol can generate new tokens—potentially increasing the supply—or whether there are mechanisms in place that may result in a certain level of inflation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Take Bitcoin as an example.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Initially introduced as a peer-to-peer electronic payment system, it has evolved into a store of value for many of its users. Observing the market, Bitcoin’s price behavior, and its most common use cases, we can conclude that users have largely chosen to treat it as an investment asset due to its non-inflationary nature. There will only ever be 21 million bitcoins, and some of these will be permanently inaccessible due to lost private keys or forgotten passwords. For many, this effectively makes Bitcoin deflationary.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Xahau, on the other hand, is currently inflationary.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This feature was deliberately included in the blockchain’s design from the outset, and this article aims to explain why.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Xahau excels as a robust payment system—it is extremely fast, efficient, and highly cost-effective.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It also features a decentralized exchange at its core, allowing users to trade assets with each other in real time. The technology behind Xahau has been tested in real-world environments for over a decade, which reinforces its reliability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What and Why was Xahau created?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Xahau is an evolution of the XRP Ledger, enhanced with smart logic features known as Hooks. Hooks are programmable rules that can be attached to user accounts, enabling anything from simple to highly complex automated processes—similar to what other networks refer to as smart contracts. Hooks open up new possibilities on Xahau, allowing users to accept or reject incoming or outgoing transactions, automate tasks, and help enforce regulations and laws across multiple jurisdictions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Most simple actions on Xahau consume (or temporarily reserve) XAH, the network’s native token.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These fees and reserves are typically negligible and barely noticeable in users' balances. This mechanism gives value to the requested transactions and the computational resources required to execute them, while also protecting the network from high-frequency transaction attacks. However, when it comes to Hooks, transactions can become significantly more complex. They may generate additional transactions, queue processes, store data on-chain, and require more processing power. Therefore, it is reasonable for these more complex Hooks to carry a higher cost.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This brings us back to the question of inflation on Xahau.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To make the execution of more sophisticated processes sustainable, Xahau allows users to claim a monthly balance adjustment (always positive), currently amounting to approximately 4% annually. This balance adjustment provides users with additional XAH to continue their ongoing processes and execute complex logic on the network, without the risk of depleting their balance due to Hook-related fees—while still upholding the principle that everything comes at a cost.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This mild inflation also influences other aspects of Xahau beyond Hooks.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Users are encouraged to actively use their XAH instead of letting it sit idle—unlike in many other blockchains. For example, Bitcoin could be described as a value network where users are incentivized to hold rather than spend, undermining its original purpose as a payment system. Similarly, on the XRP Ledger, the average user often prefers to hold XRP in hopes of appreciation, rather than using it for transactions or services. This limits overall network activity. Xahau, by contrast, is a system built for active use, where network participation is incentivized. Its mild inflation encourages users to make continuous use of their balance, as it will gradually lose value if left untouched. This mechanism is a brilliant part of Xahau’s design, ensuring steady engagement and avoiding the network becoming dormant during off-peak periods.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It would not be fair to discuss inflation on Xahau without mentioning the deflationary mechanisms that introduce scarcity.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Some actions in Xahau require users to reserve or lock portions of their XAH, which are excluded from inflation adjustments. Examples of such deflationary actions include the creation of URITokens (NFTs), setting up trustlines, configuring multi-signature lists, placing offers on the decentralized exchange, issuing checks, creating escrows, and other protocol features currently available or to be introduced in the future.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deflationary pressure doesn’t come only from the protocol itself.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Users developing their own applications and businesses within or based on Xahau also contribute to deflation, at varying rates and scales. Some processes or services may consume more XAH than is gained through inflation, whether continuously or sporadically. This dynamic can have a positive impact on the valuation of XAH: as the circulating supply decreases, the value of each unit may increase, enabling more transactions with fewer tokens.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In conclusion, Xahau’s inflation mechanism is an intelligent way to encourage network engagement and the creation of complex logic using Hooks—without users fearing that their balances will be exhausted too quickly.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;At the same time, it incentivizes making these processes as efficient as possible to avoid excessive fees. If poorly optimized, Hooks could consume users’ balances too rapidly, rendering the inflationary support insufficient and preventing abuse of the mechanism.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do I claim the balance adjustment to receive my monthly XAH?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To claim the XAH corresponding to your account, you must first opt in with a ClaimReward transaction of type Opt-In: &lt;a href="https://docs.xahau.network/technical/protocol-reference/transactions/transaction-types/claimreward" rel="noopener noreferrer"&gt;https://docs.xahau.network/technical/protocol-reference/transactions/transaction-types/claimreward&lt;/a&gt;. You will be able to claim your XAH every 30 days, 2 hours, and 13 minutes by calling this type of transaction again.&lt;br&gt;
If you're not comfortable managing the transaction yourself, you can always use the &lt;a href="https://xumm.app/detect/xapp:xahau.balanceadjustment" rel="noopener noreferrer"&gt;Balance Adjustment&lt;/a&gt; xApp from &lt;a href="https://xaman.app/" rel="noopener noreferrer"&gt;Xaman&lt;/a&gt; by following this tutorial: &lt;a href="https://help.xaman.app/app/all-about-xapps/xahau-xapps/balance-adjustment" rel="noopener noreferrer"&gt;https://help.xaman.app/app/all-about-xapps/xahau-xapps/balance-adjustment&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Learning Xahau Articles&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/ekiserrepe/learning-xahau-the-importance-of-building-your-own-business-layer-1e6g"&gt;Learning Xahau: The importance of building your own business layer&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/ekiserrepe/learning-xahau-what-is-xahau-104j"&gt;Learning Xahau: What is Xahau?&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/ekiserrepe/learning-xahau-inflation-and-deflation-as-core-elements-of-its-design-54l4"&gt;Learning Xahau: Inflation and Deflation as Core Elements of Its Design&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Links&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://xahau.network/" rel="noopener noreferrer"&gt;Official Website&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.xahau.network/" rel="noopener noreferrer"&gt;Official Docs&lt;/a&gt;&lt;br&gt;
&lt;a href="https://builder.xahau.network/" rel="noopener noreferrer"&gt;Hooks Builder&lt;/a&gt;&lt;br&gt;
&lt;a href="https://discord.gg/ds7nb93mYj" rel="noopener noreferrer"&gt;Discord Server&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/Xahau/xahaud" rel="noopener noreferrer"&gt;Xahaud&lt;/a&gt;&lt;br&gt;
&lt;a href="https://x.com/XahauNetwork" rel="noopener noreferrer"&gt;X Account&lt;/a&gt;&lt;/p&gt;

</description>
      <category>xahau</category>
      <category>blockchain</category>
      <category>xah</category>
      <category>web3</category>
    </item>
    <item>
      <title>Learning Xahau: The importance of building your own business layer.</title>
      <dc:creator>Ekiserrepe</dc:creator>
      <pubDate>Wed, 14 May 2025 08:30:47 +0000</pubDate>
      <link>https://dev.to/ekiserrepe/learning-xahau-the-importance-of-building-your-own-business-layer-1e6g</link>
      <guid>https://dev.to/ekiserrepe/learning-xahau-the-importance-of-building-your-own-business-layer-1e6g</guid>
      <description>&lt;p&gt;In the previous article &lt;a href="https://dev.to/ekiserrepe/learning-xahau-what-is-xahau-104j"&gt;Learning Xahau: What is Xahau?&lt;/a&gt;, we described what Xahau is and what it is not in general terms. The article defined Xahau as an independent blockchain based on the original XRP Ledger code, with several added features—one of the most important being Hooks, a new way to implement advanced logic within Xahau. Compared to other popular blockchain networks, we could say that Hooks are like smart contracts in EVM-based networks, but with a completely different philosophy and approach, tailored to Xahau’s technology.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://dev.to/ekiserrepe/learning-xahau-what-is-xahau-104j"&gt;previous article&lt;/a&gt; also pointed out the need to add “smart contract” technology to Xahau, since it was not originally available in the XRP Ledger. But we should not reduce Xahau to a simple XRP Ledger + smart contracts formula. Let’s dive deeper into why this addition is necessary and how it benefits all network participants—from individual users to large corporations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Pre-Xahau Days&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In my &lt;a href="https://www.youtube.com/watch?v=0hnGjU54KvY&amp;amp;t=24s" rel="noopener noreferrer"&gt;talk at APEX 2024&lt;/a&gt;, I discussed the current state of the XRP Ledger, where different proposals must compete for the same slice of the pie. Whenever a new feature is introduced to the XRP Ledger, different entities try to build interfaces around it, which forces these actors to compete to offer the best service to the end user. Clear examples include the many NFT marketplaces or services that enable interaction with AMMs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi4hfxz24kuls9yfm52ly.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi4hfxz24kuls9yfm52ly.png" alt="The Pre-Xahau Era" width="800" height="464"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Due to the lack of advanced logic in the XRP Ledger, every new feature must be integrated directly into its core code and go through a validator consensus process, requiring more than 80% agreement for at least 14 consecutive days. So, every update to the XRP Ledger becomes a difficult and prolonged process. Furthermore, not just anyone can propose, develop, and have their code accepted into the XRP Ledger. Contributions from the community have been rare. It’s usually much easier for Ripple, as a major actor in the network, to propose and implement changes. This greatly speeds up development but clearly highlights the lack of decentralization. Independent developers can’t afford to invest months or years (and money) developing improvements without guarantees that their code will be accepted and included in the XRP Ledger. (This is precisely what happened with the original Hooks proposal, which eventually became the Xahau blockchain.)&lt;/p&gt;

&lt;p&gt;Another issue with the XRP Ledger is that every feature aims to be as efficient as possible, which is great for the end user, but makes it nearly impossible for companies and businesses to monetize their use of the XRP Ledger—unless they create interfaces or interpretations that simplify things for thousands of users. And not only do they have to focus on interfaces, but they must also compete in that narrow niche with others, since there are very few ways to build on the XRP Ledger. If a development such as NFTs or the AMM has already been implemented, it is very unlikely that another proposal with similar characteristics from an external team will be approved—especially considering that the original implementation is already optimized to run on the XRP Ledger without third-party fees. And even if the new proposal is more efficient, it can be argued that the new logic could jeopardize the blockchain itself and prevent it from reaching the end user. A dead end.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The importance of building your own business layer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For all these reasons, it’s time to take a close look at Xahau. For the first time in a blockchain based on XRP Ledger technology, anyone can create advanced logic thanks to Hooks—what I like to call &lt;strong&gt;“The Business Layer”&lt;/strong&gt;. Why is this insteresting? Because those interested in building businesses don’t need to ask anyone for permission to build on Xahau. Thanks to Hooks, anyone can implement their own business logic and charge for it (if they want). Major actors in Xahau can’t stop you—they can’t block your business layer from working or prevent you from charging for it. You can create new features or processes and profit from them. There’s no need to wait to submit a proposal, hope it gets approved, and pray validators support your amendment—Hooks eliminate that entire process.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu9wm94jniyjbnfab637l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu9wm94jniyjbnfab637l.png" alt="Image description" width="800" height="1200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The business layer doesn’t just let you create exclusive logic for your own operations. You can share your Hooks with others, and each time your Hook runs, it can include a fee (optional) that is sent to your account. And if you don’t have ideas of your own, you can always earn money by coding Hooks for clients who don’t have the time to do it themselves.&lt;/p&gt;

&lt;p&gt;If you don’t like the publicly available Hooks, you can always create a new version with your own improvements. If you see that a third party is running a business using Hooks and you don’t agree with their approach, you can always offer better Hooks. In other blockchains with smart contracts (such as the boom of Uniswap clones), this is a common practice. But in an XRP Ledger ecosystem, this is the first time we’re allowed to run our own business layer directly on the blockchain itself—Xahau.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Xahau era begins&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Xahau created its first ledger on Mainnet on October 30, 2023. This makes Xahau a newborn blockchain. If something in this post caught your attention, I forgot to mention that Xahau is the perfect ground to plant your ideas. Since it has only been live for a short time, very few projects have dared to take the leap. This gives those eager to build the opportunity to become pioneers in Xahau and set the path for others to follow. If you have an idea, now is the time. It doesn’t have to be innovative or revolutionary—even simple projects are viable options, as they’ve likely never been brought to Xahau before. From here, I encourage you to take action.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Learning Xahau Articles&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/ekiserrepe/learning-xahau-the-importance-of-building-your-own-business-layer-1e6g"&gt;Learning Xahau: The importance of building your own business layer&lt;br&gt;
&lt;/a&gt;&lt;a href="https://dev.to/ekiserrepe/learning-xahau-what-is-xahau-104j"&gt;Learning Xahau: What is Xahau?&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/ekiserrepe/learning-xahau-inflation-and-deflation-as-core-elements-of-its-design-54l4"&gt;Learning Xahau: Inflation and Deflation as Core Elements of Its Design&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Links&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://xahau.network/" rel="noopener noreferrer"&gt;Official Website&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.xahau.network/" rel="noopener noreferrer"&gt;Official Docs&lt;/a&gt;&lt;br&gt;
&lt;a href="https://builder.xahau.network/" rel="noopener noreferrer"&gt;Hooks Builder&lt;/a&gt;&lt;br&gt;
&lt;a href="https://discord.gg/ds7nb93mYj" rel="noopener noreferrer"&gt;Discord Server&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/Xahau/xahaud" rel="noopener noreferrer"&gt;Xahaud&lt;/a&gt;&lt;br&gt;
&lt;a href="https://x.com/XahauNetwork" rel="noopener noreferrer"&gt;X Account&lt;/a&gt;&lt;/p&gt;

</description>
      <category>xahau</category>
      <category>xah</category>
      <category>web3</category>
      <category>blockchain</category>
    </item>
    <item>
      <title>Learning Xahau: What is Xahau?</title>
      <dc:creator>Ekiserrepe</dc:creator>
      <pubDate>Mon, 12 May 2025 17:27:02 +0000</pubDate>
      <link>https://dev.to/ekiserrepe/learning-xahau-what-is-xahau-104j</link>
      <guid>https://dev.to/ekiserrepe/learning-xahau-what-is-xahau-104j</guid>
      <description>&lt;p&gt;Welcome to Learning Xahau, a series of posts where we’ll try to explain the Xahau blockchain, its features, how it works, and even build our own examples in a way that’s accessible to everyone.&lt;/p&gt;

&lt;p&gt;In today’s article, we’ll broadly discuss what Xahau is — and what it isn’t — debunk some common misconceptions, and dive into a few basic concepts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Xahau?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Xahau is a layer 1 blockchain built from the XRP Ledger codebase, enhanced with features and improvements that are not present in the original XRP Ledger. Its native token is called XAH, and the blockchain has been live on mainnet since October 30, 2023.&lt;/p&gt;

&lt;p&gt;Xahau shines for its speed, low cost and efficiency already proven for more than ten years based on the original XRP Ledger code.&lt;/p&gt;

&lt;p&gt;Xahau is perfect for moving and exchanging value. Organizations, financial institutions and individuals can benefit from its features.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Xahau?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Xahau was not planned to exist but fate decided that it would. For several years, the &lt;a href="https://xaman.app/" rel="noopener noreferrer"&gt;XRPL-Labs&lt;/a&gt; team decided to devise and implement a smart-contracts solution for the XRP Ledger blockchain under the name Hooks. The solution was never merged into the XRP Ledger blockchain, so the work of years was going to be forgotten as it would not fulfill its ultimate goal. That is why, a modification of the XRP Ledger code base was made, new features were added and the Hooks solution was implemented, which would allow to see advanced logic in a blockchain based on XRP Ledger technology under a new name, Xahau.&lt;/p&gt;

&lt;p&gt;Xahau was able to see the light of day thanks to the work of the Xahau Launch Alliance, a now disbanded organization to which several players who supported the launch of Xahau belonged.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What features does Xahau have—and what doesn’t it have?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As mentioned above, Xahau is not a simple copy of the XRP Ledger with smart contract capabilities added via Hooks. Although the codebases share similarities in how they operate, there are clear differences that, at the time of writing, can be summarized as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;URITokens:&lt;/strong&gt; A new concept of NFTs, different from what’s available on the XRP Ledger. These are simpler to manage and index, but do not natively support royalties like XRP Ledger NFTs. However, thanks to Hooks, you can create your own custom royalty logic.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Hooks:&lt;/strong&gt; Advanced pieces of code created by yourself or third parties, installable on Xahau accounts (up to 10 per account). Hooks are autonomous and don’t require network consensus to be activated. As long as a Hook has no errors and compiles correctly, it can be installed on Xahau. Hooks enable a business logic layer not possible on the XRP Ledger.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Governance Game:&lt;/strong&gt; Different committees vote on decisions within the Xahau network, allowing for greater democratization.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Claim Reward:&lt;/strong&gt; Xahau has an annual inflation rate of 4%, which benefits all Xahau users. The XAH you hold determines the share of monthly rewards you can claim, if desired.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Faster amendment approval:&lt;/strong&gt; XRP Ledger requires 14 days of positive votes above threshold to activate an amendment. Xahau only requires 5 days.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Different supply:&lt;/strong&gt; Xahau launched with 600 million XAH and has an annual growth close to 4%. As of May 12, 2025, there are 627,711,384 XAH in circulation. You can check the current supply at this API: &lt;a href="https://data.xahau.network/docs#tag/ledgers/GET/ledgers/supply_info" rel="noopener noreferrer"&gt;Xahau API Supply Info&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Escrows for IOUs:&lt;/strong&gt; In addition to creating escrows for XAH, you can also manage escrows for other tokens of any kind (this is not possible on the XRP Ledger).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Remits:&lt;/strong&gt; A transaction type that allows users to send multiple payment types, mint a URIToken, transfer a list of URITokens, and activate an account—all at once.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In addition to these unique features, Xahau shares the following characteristics with the XRP Ledger:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Token creation (IOUs):&lt;/strong&gt; Xahau allows users to issue tokens representing real or fictional assets.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;DEX:&lt;/strong&gt; A native decentralized exchange that allows creating offers for tokens, XAH, or URITokens.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Multisigning:&lt;/strong&gt; Xahau supports multi-signature account control.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Payment Channels&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some native XRP Ledger implementations like the AMM haven’t been adopted by Xahau yet, though alternative approaches are being developed as seen in the proposal &lt;a href="https://github.com/XRPLF/XRPL-Standards/discussions/165" rel="noopener noreferrer"&gt;XAS-1&lt;/a&gt; or in &lt;a href="https://xahau-testnet.xrplwin.com/hooks/amm" rel="noopener noreferrer"&gt;XRPLWin Xahau Testnet Explorer&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The base codes of Xahau and XRP Ledger are diverging, as both chains are following different paths. New features in XRP Ledger won’t automatically appear in Xahau, since the code is no longer the same. However, thanks to Hooks, many features that would take months to be introduced into the XRP Ledger core and require validator approval can be implemented in Xahau within days or weeks—without requiring validator consensus.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Xahau not?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Xahau is not a Layer 2 of the XRP Ledger. Xahau is an independent blockchain with its own token. There is no connectivity between Xahau and the XRP Ledger, so it’s not a sidechain either.&lt;/p&gt;

&lt;p&gt;While Xahau did initially launch with a mechanism called Burn2Mint—which allowed users to burn XRP in exchange for XAH on the Xahau network—this mechanism has been disabled. Therefore, it's incorrect to consider Xahau a sidechain of the XRP Ledger (or vice versa).&lt;/p&gt;

&lt;p&gt;The XAH available on the XRP Ledger DEX is not native XAH—just as the BTC or ETH on XRP Ledger are not real BTC or ETH. They are IOUs issued within XRP Ledger. XAH on the XRP Ledger is not eligible for ClaimReward. To benefit, you must move that XAH to the Xahau network. There is a xApp in Xaman called &lt;a href="https://help.xaman.app/app/all-about-xapps/xahau-xapps/xah-teleport" rel="noopener noreferrer"&gt;XAH Teleport&lt;/a&gt; that allows you to transfer XAH from XRP Ledger to your Xahau account.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Learning Xahau Articles&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/ekiserrepe/learning-xahau-the-importance-of-building-your-own-business-layer-1e6g"&gt;Learning Xahau: The importance of building your own business layer&lt;br&gt;
&lt;/a&gt;&lt;a href="https://dev.to/ekiserrepe/learning-xahau-what-is-xahau-104j"&gt;Learning Xahau: What is Xahau?&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/ekiserrepe/learning-xahau-inflation-and-deflation-as-core-elements-of-its-design-54l4"&gt;Learning Xahau: Inflation and Deflation as Core Elements of Its Design&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Links&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://xahau.network/" rel="noopener noreferrer"&gt;Official Website&lt;/a&gt;&lt;br&gt;
&lt;a href="https://docs.xahau.network/" rel="noopener noreferrer"&gt;Official Docs&lt;/a&gt;&lt;br&gt;
&lt;a href="https://builder.xahau.network/" rel="noopener noreferrer"&gt;Hooks Builder&lt;/a&gt;&lt;br&gt;
&lt;a href="https://discord.gg/ds7nb93mYj" rel="noopener noreferrer"&gt;Discord Server&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/Xahau/xahaud" rel="noopener noreferrer"&gt;Xahaud&lt;/a&gt;&lt;br&gt;
&lt;a href="https://x.com/XahauNetwork" rel="noopener noreferrer"&gt;X Account&lt;/a&gt;&lt;/p&gt;

</description>
      <category>xahau</category>
      <category>xah</category>
      <category>blockchain</category>
      <category>web3</category>
    </item>
  </channel>
</rss>
