The Ripple wiki has a page about demurrage currencies being a possibility in Ripple. However, it's not entirely clear whether this feature is already implemented in the server or client, and if so, how to properly use it.

Can one create a demurrage currency in Ripple, and if so, how does one do it?

  • 1
    I'm fairly certain that demurrage support is not completed in the client yet but that it is expected to be one of the next (if not, the next) significant feature rolled out. – David Schwartz Jul 13 '14 at 1:29

You can find an answer with an example here: https://gist.github.com/justmoon/8597643

Type 0x01 means demurraging currency:

01 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __

CURCODE- DATE------- RATE------------------- RESERVED---

CURCODE - Three character uppercase ASCII.

DATE - DEPRECATED Demurrage start date (Ripple epoch; seconds since 2000) -> There is no reason to choose one reference date over another so this feature will be removed.

For now just make sure you ALWAYS set the date to 00 00 00 00

RATE - Demurrage rate, defined as e-folding time in seconds (IEEE 754 double-precision floating-point)

RESERVED - Reserved for future use, duh

Note: Date and rate are four-byte aligned, rate is eight-byte aligned, for easy parsing on 32/64 bit CPUs.

Demurrage example:

01 58 41 55 00 00 00 00 C1 F7 6F F6 EC B0 BA C6 00 00 00 00

// Calculating the demurrage rate //

// We want 0.5% per year. There are 31536000 in a year, so the e-folding time in seconds is:

31536000 / ln(0.995) = -6291418827.045599

// In plain English: The nominal amount of this asset will decrease (hence the minus sign) e times (≈2.71828) every 6291418827.045599 seconds

// As hex (IEEE double): http://gregstoll.dyndns.org/~gregstoll/floattohex/


// Final currency code 0158415500000000C1F76FF6ECB0BAC600000000

// Example TrustSet {"Flags":131072,"TransactionType":"TrustSet","Account":"rNb721TdNHN37yoURrMYDiQFmvXmENCZW6","LimitAmount":{"value":"1000","currency":"0158415500000000C1F76FF6ECB0BAC600000000","issuer":"rUyPiNcSFFj6uMR2gEaD8jUerQ59G1qvwN"}}

  1. Create the code for your currency as shown.
  2. Set a Trustline for this currency (As shown in the end of the quote)

Thats it, it's created now.

P.S.: For now I know the only one place where this currencies are shown correctly: https://bithomp.com/explorer/forabc

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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