James Bachini

The State Of CBDC Central Bank Digital Currency

CBDC Central Bank Digital Currency

Nation states across the world are exploring CBDC’s (central bank digital currency). Many governments including France, Canada, Saudi Arabia & China have pilot schemes already in place.

The US dollar is the global reserve currency, it’s used throughout the world as a base asset and more recently as a political weapon in the form of sanctions.

In this article we will look at the current state of CBDC’s and how they might affect a changing world order.

  1. A Global Map Of CBDC Progress
  2. BRICS Growth And Incentives
  3. CBDC Technology
  4. An CBDC Smart Contract
  5. Conclusion

A Global Map Of CBDC Progress

From https://cbdctracker.org/

In February 2021 The Federal Reserve collaborated with MIT on Project Hamilton which aimed to “inform policymakers by building a hypothetical platform that’s fast, resilient, secure, and private enough to support a U.S.-backed central bank digital currency”*

China worked with a company and hardware provider called Feitian Technologies on creating the e-CNY which is currently available for use across China. The e-CNY CBDC is being integrated into the two dominant payment systems:

  • Tencent’s WeChat Pay
  • Alibaba’s AliPay

Canada has a pilot in place called Jasper which uses distributed ledger technology.

The Bank of France in association with HSBC conducted a pilot scheme using distributed ledger to test if it was interoperable with existing infrastructure.

The UK are being… well very British about the whole thing.

I’m addicted to Dall-E https://labs.openai.com/
“A man drinking a glass of wine, reading a newspaper with the houses of parliment in the background”

BRICS Growth And Incentives

Russia’s invasion of Ukraine sparked an economic cold war with sanctions imposed by the US and EU. Hundreds of billions of dollars belonging to Russia were frozen cutting off their central bank, sovereign wealth fund, commercial banks, and certain individuals from U.S. dollar transactions. This caused the desired short term impact but long term damaged the reputation of the western banking system.

James On YouTube

Since then Russia has demanded payment in Rubles for Gas and Saudi Arabia is in talks to sell Oil to China priced in Yuan. The world is moving towards a more fragmented global economy as emerging markets develop into powerful participants, threatened by USD supremacy.

“Wars also upend the dominance of currencies and serve as a doula to the birth of new monetary systems” Zoltan Pozsar, Credit Suisse

In June this year the BRICS nations announced plans to launch a reserve currency for international trade as an alternative to the USD or more specifically IMF SDR’s (Special Drawing Rights). BRICS includes 40% of the global population and is made up of:

  • Brazil
  • Russia
  • China
  • India
  • South Africa

The BRICS basket-based reserve currency will comprise of Real, Roubles, Rupees, Renminbi, and Rand.

These countries are growing economic power houses and whether it be BRICS or independent nation states it seems somewhat inevitable that international trade is going to evolve over the next decade away from US dollar based settlement.

“Russia and India no longer need the U.S. dollar for mutual settlements” Purnima Anand (BRICS International Forum President)

A concerning development is the news that Saudi Arabia alongside Egypt & Turkey are considering applying to the BRICS economic bloc. Iran and Argentina have already submitted applications. Saudi Arabia is the worlds biggest exporter of crude oil and has dominating control over the OPEC+ group who control production supply levels and pricing. 80.4% of global crude oil reserves are in OPEC+ member states*. This could create a situation where eventually the majority of oil & gas production is happening in states opposed to USD dominance.

Could there be the potential for a new cold war developing between the US and it’s allies and the BRICS nations and their allies? The weapons might not be nuclear or biological but economic in the form of battles over energy, currencies and economic sanctions.


CBDC Technology

So a central bank will obviously use cutting edge technology and launch an ERC20 on Ethereum or an EVM chain, right? Well probably not. It’s unlikely that any central bank digital currency will use a public blockchain because it places control outside of their sphere of influence.

The counter argument to this is that the crypto sector is growing fast and a digital currency that could integrate with DeFi could be a catalyst for future demand. But still we are probably too early with the total market cap of the entire industry currently at $1.15 trillion USD it’s not large enough to attract serious consideration.

What seems likely is that governments will seek to use legacy systems based on database storage alongside private distributed ledger technology. Large enterprise companies are likely to get the nod as technology providers over crypto-native projects. Something like Hyperledger could be used (if it actually worked) as a underlying private blockchain on top of which the currency could be issued as a token.

Governments can and likely will develop functions to be able to mint additional CBDC tokens on demand, sanction and block addresses and retain complete control and analytical insight into the currency and it’s underlying blockchain network.

On a positive note perhaps we will get a bridge and it’s possible that the code will be EVM compatible so why not have a go at coding a CBDC.


An CBDC Smart Contract

This code is designed as an experiment, it has not been tested and should not be used for financial transactions.

You can also view the code at: https://github.com/jamesbachini/CBDC-Central-Bank-Digital-Currency

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.15;

/*
 ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 
░░█████╗░██████╗░██████╗░░█████╗░░
░██╔══██╗██╔══██╗██╔══██╗██╔══██╗░
░██║░░╚═╝██████╦╝██║░░██║██║░░╚═╝░
░██║░░██╗██╔══██╗██║░░██║██║░░██╗░
░░█████╔╝██████╦╝██████╔╝░█████╔╝░
░░╚════╝░╚═════╝░╚═════╝░░╚════╝░░
 ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 

 Central Bank Digital Currency
 
 ERC20 token design for a CBDC complete with vesting/voting
 mechanism, sanctions on addresses, inflationary treasury
 bond staking.

 @title CBDC | Central Bank Digital Currency
 @author James Bachini
 @dev Untested, not suitable for financial transactions
*/

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

contract CBDC is ERC20 {

  address public controllingParty;
  uint256 maxSupply = 5.5e12 ether; // US M0 Money Supply
  uint256 maxInflationBasisPoints = 500; // 5%
  uint256 interestRateBasisPoints = 250; // 2.5%
  uint256 lastSupplyIncrease = block.timestamp;
  uint256 constant electionPeriod = 1.261e8; // 4 years
  uint256 constant timeToVote = 2.628e6; // 1 month
  uint256 lastElectionTS = 0; // block.timestamp;
  string constant unfortunateTruth = "Two party politics is not a choice";
  mapping (address => bool) private blacklist;
  mapping(address => uint256) public stakedTreasuryBond;
  mapping(address => uint256) private stakedFromTS;
  uint256 public electionStartTS;
  address[] public candidates;
  mapping (address => uint256) public votes;
  mapping (address => uint256) public vested;
  event CallElection(uint256 timestamp);
  event VestAndVote(uint256 amount, address candidate);
  event CloseElection(uint256 timestamp);
  event UpdateBlacklist(address _criminal, bool _blocked);
  event IncreaseMoneySupply(uint256 amount, uint256 timestamp);
  event AdjustInterestRates(uint256 rate);
  event StakeTreasuryBonds(address user, uint256 amount);
  event UnstakeTreasuryBonds(address user, uint256 amount);
  event ClaimTreasuryBonds(address user, uint256 amount);
  
  constructor() ERC20("Central Bank Digital Currency", "CBDC") {
    controllingParty = msg.sender;
    _mint(msg.sender, maxSupply);
  }

  /* CBDC will need a voting system to elect a controlling party */
  function callElection() external {
    require(block.timestamp > lastElectionTS + electionPeriod, "Too early to call election");
    electionStartTS = block.timestamp;
    for (uint256 i = 0; i < candidates.length; i++) { // unbounded loop
      votes[candidates[i]] = 0;
    }
    delete candidates;
    emit CallElection(electionStartTS);
  }

  function vestAndVote(uint256 _amount, address _candidate) external {
    require(_amount > 0, "Amount is !> 0");
    require(balanceOf(msg.sender) >= _amount, "Your balance is too low");
    _transfer(msg.sender, address(this), _amount);
    require(candidates.length < 1000, "Too many candidates");
    if (votes[_candidate] == 0) candidates.push(_candidate);
    votes[_candidate] += _amount;
    vested[msg.sender] += _amount;
    emit VestAndVote(_amount, _candidate);
  }

  function closeElection() external {
    require(block.timestamp > electionStartTS + timeToVote, "Too early to close election");
    address electionLeader;
    uint256 leadingVotes;
    for (uint256 i = 0; i < candidates.length; i++) { // unbounded loop
      if (votes[candidates[i]] > leadingVotes) {
        electionLeader = candidates[i];
        leadingVotes = votes[candidates[i]];
      }
    }
    controllingParty = electionLeader;
    lastElectionTS = block.timestamp;
    emit CloseElection(lastElectionTS);
  }

  function unvest() external {
    require(block.timestamp > electionStartTS + timeToVote, "Too early to unvest");
    require(block.timestamp < lastElectionTS + electionPeriod, "Election has not closed yet");
    _transfer(address(this), msg.sender, vested[msg.sender]);
    vested[msg.sender] = 0;
  }

  /* CBDC will need a way to sanction or blacklist addresses */
  function updateBlacklist(address _criminal, bool _blocked) external {
    require(msg.sender == controllingParty, "Not authorized to update blacklist");
    blacklist[_criminal] = _blocked;
    emit UpdateBlacklist(_criminal, _blocked);
  }

  function _transfer(address from, address to, uint256 amount) internal virtual override {
    require(blacklist[from] == false, "Sender address is blacklisted");
    require(blacklist[to] == false, "Recipient address is blacklisted");
    super._transfer(from, to, amount);
  }

  /* CBDC will need a way to expand the money supply including treasury bond staking */
  function increaseMoneySupply() external {
    require(msg.sender == controllingParty, "Not authorized to update increase supply");
    uint256 inflationCapacity = (block.timestamp - lastSupplyIncrease) * maxSupply * maxInflationBasisPoints / 10000 / 3.154e7;
    maxSupply += inflationCapacity;
    lastSupplyIncrease = block.timestamp;
    uint256 capitalAvailable = maxSupply - totalSupply();
    _mint(msg.sender, capitalAvailable);
    emit IncreaseMoneySupply(capitalAvailable, lastSupplyIncrease);
  }

  function stakeTreasuryBonds(uint256 _amount) external {
    require(_amount > 0, "amount is <= 0");
    require(balanceOf(msg.sender) >= _amount, "balance is <= amount");
    _transfer(msg.sender, address(this), _amount);
    if (stakedTreasuryBond[msg.sender] > 0) claimTreasuryBonds();
    stakedFromTS[msg.sender] = block.timestamp;
    stakedTreasuryBond[msg.sender] += _amount;
    emit StakeTreasuryBonds(msg.sender, _amount);
  }

  function unstakeTreasuryBonds(uint256 _amount) external {
    require(_amount > 0, "amount is <= 0");
    require(stakedTreasuryBond[msg.sender] >= _amount, "amount is > staked");
    claimTreasuryBonds();
    stakedTreasuryBond[msg.sender] -= _amount;
    _transfer(address(this), msg.sender, _amount);
    emit UnstakeTreasuryBonds(msg.sender, _amount);
  }

  function claimTreasuryBonds() public {
    require(stakedTreasuryBond[msg.sender] > 0, "staked is <= 0");
    uint256 secondsStaked = block.timestamp - stakedFromTS[msg.sender];
    uint256 rewards = stakedTreasuryBond[msg.sender] * secondsStaked * interestRateBasisPoints / 10000 / 3.154e7;
    stakedFromTS[msg.sender] = block.timestamp;
    _mint(msg.sender, rewards);
    emit ClaimTreasuryBonds(msg.sender, rewards);
  }

  function adjustInterestRates(uint256 _newInterestRate) external {
    require(msg.sender == controllingParty, "Not authorized to update interest rate");
    interestRateBasisPoints = _newInterestRate;
    emit AdjustInterestRates(interestRateBasisPoints);
  }
}

Conclusion

Central banks are already using digital transactions and the majority of funds live in a ledger held within a database. Distributed ledger technology provides the opportunity for nation states to create shared networks for international trade.

These emerging CBDC’s could potentially pose a threat to the US dollar as the global reserve currency. If not directly replacing, then acting as an alternative for politically incentivised nations.

While blockchain developers would rejoice in a nation launching a backed ERC20 token it seems unlikely that politicians would relinquish control to a decentralized blockchain. Central bank digital currencies will likely be built on private blockchains developed by enterprise companies and based on the technology we are building today.


Get The Blockchain Sector Newsletter, binge the YouTube channel and connect with me on Twitter

The Blockchain Sector newsletter goes out a few times a month when there is breaking news or interesting developments to discuss. All the content I produce is free, if you’d like to help please share this content on social media.

Thank you.

James Bachini

Disclaimer: Not a financial advisor, not financial advice. The content I create is to document my journey and for educational and entertainment purposes only. It is not under any circumstances investment advice. I am not an investment or trading professional and am learning myself while still making plenty of mistakes along the way. Any code published is experimental and not production ready to be used for financial transactions. Do your own research and do not play with funds you do not want to lose.