I'm looking to write a custom Ardor bundler to only bundle transactions that have the following properties:

  • Bundle transactions that are being sent to a specific account only.
  • Bundle transactions where the sender holds a specific type of asset or monetary system coin.
  • Bundle transactions only if that user hasn't sent more than 10 transactions in the past hour.

I couldn't find any code snippets of how to go about setting these custom Ardor bundlers.

2 Answers 2


Here's a simple code snippet which allows you to bundle transactions if the recipients have the asset you specified in their account.

package nxt.customfilter;

import nxt.account.Account;
import nxt.blockchain.Bundler;
import nxt.blockchain.ChildTransaction;
import nxt.db.DbIterator;
import nxt.ae.Asset;

public class FilterByAsset implements Bundler.Filter {

    public boolean ok(Bundler bundler, ChildTransaction childTransaction) {
        String assetID = "Insert Your Asset ID Here";
        try (DbIterator iterateAssets = Account.getAccountAssets(childTransaction.getRecipientId(),0,Integer.MAX_VALUE)) {
            while (iterateAssets.hasNext()) {
                if(iterateAssets.next().toString().contains(assetID)) return true;
        return false;

customfilter is a folder I created inside src/java/nxt

So you would create a file and name it FilterByAsset.java inside customfilter and paste the above codes.

finally, add nxt.bundlingFilter=nxt.customfilter.FilterByAsset to conf/nxt.properties and compile.

getAccountAssets method return all the assets in the recipient account and prints out accound_id, asset_id, quantity, and unconfirmedQuantity.


Take a look at the bundler filter shipped with Ardor: src/java/nxt/addons/AccountPropertyBundler.java and PersonalBundler.java

You need to be familiar with internal Ardor interfaces in order to write your own bundler filter. The bundler filter runs as part of the server and is loaded during server initialization.

You specify a custom bundler in nxt.properties by setting nxt.bundlingFilter.

  • what do you set nxt.bundlingFilter to in the conf file? Commented Jan 30, 2018 at 5:00
  • You set nxt.bundlingFilter to the class name of the bundler filter that you want to use. For example, if I wrote a filter called CustomFilter, then I would set nxt.bundlingFilter to org.scripterron.CustomFilter where org.scripterron is my Java package and CustomFilter is the class. Commented Jan 30, 2018 at 17:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.