Skip to content
Demo code for "What you might not know about VeChainThor yet (Part III) - TX Fee Delegation (VIP-191)"
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Demo Code for Article "What you might not know about VeChainThor yet (Part III) - Transaction Fee Delegation (VIP-191)"


This is a demo to demonstrate the TX-fee-delegation mechanism (both VIP-191 and MPP) on VeChainThor. The demo is built using tools connex-framework and connex.driver-nodejs that implement the Connex interface in a NodeJS environment.

Connex Interface for VIP-191

There are two extra things you need to do on top of the normal procedure of constructing a TX using Connex:

  1. Create your own function with the following definition:

    function (unsignedTx: { raw: string, origin: string }): Promise<{ signature: string }>

    This function is typically responsible for passing data to the gas-payer, waiting for its response and returns a Promise, if resolved, carrying the gas-payer's signature.

  2. Pass the function to the instance of Connex.Vendor.TxSigningService, as you've already created for TX construction, via the delegate method. For instance, you may add a line such as:


That's it!

Note that the function I made in the demo code is NOT a typical function you would see in a real application. It is created purely for this demo and should not be considered as an example of creating such a function.


Download the code via

git clone

After that, install all the required packages and you are good to go.


The private keys hard coded in the code are for this demo only. Please avoid using it in any other circumstances.

You can’t perform that action at this time.