Cardano Plomin Hard Fork - developer upgrade guide

Introduction

It's an exciting time to build on Cardano - the Plomin hard fork recently went live. While this is monumental for governance and the roadmap ahead, in this guide, I want to give a summary of the major changes and things that Cardano dApp developers should look out for.

The Plomin hard fork doesn't include many disruptive changes. It is part of the transition to the Voltaire era, introducing an on-chain decentralised governance mechanism as described in CIP-1694. Most of the changes were already introduced with the preceding Chang hard fork and were in a bootstrap phase. With the Plomin hard fork, we will only see the new governance actions enabled, and some added new features to Plutus V3.

Library versions

The following versions will be used with the Plomin hard fork, so dApps should also keep their dependencies up to date to avoid any compatibility issues:

  1. cardano-node 10.1.4

  2. plutus-ledger-api 1.38

  3. plutus-tx 1.38

You can find the compatibility matrix of some other libraries here.

Plutus scripts compiled with previous versions of plutus-tx should be backward compatible. There's no new Plutus language version introduced, we're staying on Plutus V3. With that said, there are a few new features added, so if you want to leverage those, you'll have to upgrade.

New Plutus features

The Chang hard fork added a few bitwise primitives, and Plomin will add further utilities to effectively work with BuiltinByteStrings. These new primitives have various uses, but mostly in implementing other cryptographic functions and succinct implementing data structures.

Bitwise primitives

The first set of new features are logical operators described in CIP-122.

  1. Bitwise logical AND, OR, XOR, and complement;

  2. Reading a bit value at a given index;

  3. Setting bits value at given indices; and

  4. Replicating a byte a given number of times.

andByteString, orByteString, xorByteString, complementByteString, readBit, writeBits, replicateByte

And furthermore, CIP-123 adds the following:

  1. Bit shifts and rotations

  2. Counting the number of set bits (popcount)

  3. Finding the first set bit

shiftByteString, rotateByteString, countSetBits, findFirstSetBit

These tools will be most useful to implement other cryptographic primitives that are not natively supported by Cardano, but they will also enable dApp developers to implement succinct data structures, saving precious memory without suffering high execution unit costs.

One simple example where this could be useful is a bit vector, where we can store booleans efficiently. We can read bits from it with constant time cost, which could be a great improvement over a linked list representation.

configDatum :: BuiltinByteString
configDatum = integerToByteString LittleEndian 1 0b01010101

myScript :: BuiltinByteString -> BuiltinByteString -> ScriptContext -> ()
myScript configDatum redeemer ctx = do
    let canDoX = readBit configDatum 0
    let canDoY = readBit configDatum 1
    ...
RIPEMD-160

Apart from the Plutus features, this hard fork will bring the RIPEMD-160 hashing algorithm, as described in CIP-127 to enable interoperability with Ethereum and Bitcoin ecosystems. RIPEMD-160 is a fundamental component of Bitcoin's cryptographic framework.

This will be useful for cross-chain solutions, namely, it allows the verification of Bitcoin addresses and transactions on-chain. This addition also enables the verification of signed messages that identify the signer by the public key hash, which has not yet been witnessed on the Bitcoin blockchain.

ripemd_160

Staking changes

The new governance system affects how staking works, namely stake withdrawals. Rewards will still be accumulated by Ada holders when delegating to stake pools for block production as in Protocol Version 9 and before, but these rewards can only be withdrawn once the Ada holder has also delegated their stake to a DRep for voting purposes. This vote delegation may be to a self-created DRep, to a third-party DRep, or to the pre-defined Abstain or No Confidence DReps. Although not common practice in dApps to manage staking, in this case, it could mean that stake withdrawals fail without human interaction.

New Governance Actions that will be available following the upgrade

Four new governance actions will be enabled as described in CIP-1694.

  1. Treasury withdrawals. Funds may be withdrawn from the treasury and deposited in designated stake credentials.

  2. New constitution/guardrails script. A new constitution may be proposed and/or a new guardrails script may be proposed.

  3. Updates to the constitutional committee. Constitutional committee members may be removed, replaced, or new members may be elected. The threshold for Constitutional committee voting may also be changed.

  4. Votes of no confidence. A vote of no confidence may be raised.

These are all available in plutus-ledger-api as part of the ScriptContext (already implemented with the Chang Hard Fork), so it's possible to use them in Plutus validators.

Conclusions

Although this hard fork doesn't bring big changes affecting dApp developers. However, as with all hard forks, it's recommended to update your stack as soon as possible and run tests on the preprod or the preview testate to avoid any unexpected surprises.

If you have any questions, comments, or concerns, feel free to contact us.


Next
Next

Testing dApps on Cardano with CLB emulator