Skip to content

Migrate to Duniter v2 ecosystem: Substrate, Subsquid/Hasura

Duniter v2 Substrate support with polkadot-sdk:

  • APIs: RPC, and GraphQL Hasura

Resources


Transition plan

  • Release and maintain v0.12.0 as BMA-only
  • v0.20.0dev as Substrate-only

Allow non-related developments/experimentation to happen in parallel?: Which would not create much git conflicts:


Consider Hexagonal architecture


Set up Duniter v2s and indexer on ĞDev

Outline plan

  • Set up authentication based on DEWIF converted to SR25519 substrateinterface.Keypair.
  • Set up two network layers: RPC and Indexer GraphQL, make sure the two endpoints are sync
  • Get currency, parameters, head: blockchain/tools.py, wot/tools.py identity helpers
  • port commands one by one to v2 ecosystem (starting by the easy one, then ramping up the difficulty)
    • v1 and v2 ecosystems support would coexist during the transition
    • hiding commands and arguments can be done with Click
  • remove v1 network layer, public key
  • remove duniterpy dependency (probably later)

  • Delete code of commands which will be rewritten, keep structure, pick code in git history for the reimplementation
  • Delete step-by-step commands, functions which have been rewritten

Delete features which don’t make sense anymore and which are not very coupled

  • Delete blockchain verify cmd, doesn’t make sense anymore, algorithm can be retrieved in the git history for next blocks implementation (#283 (closed))
  • Delete blockchain diffi, since the PoW is no longer a thing with BABE/Grandpa consensus algorithm
  • Delete checksum command since the address integrity (checksum) and currency is integrated into the address.
  • blockchain blocks? Does not make sense with https://duniter-portal.axiom-team.fr/ blocks exploration more interesting in a web interface
    • blockchain info is the only command remaining in blockchain group. Move one step above.

Set up network layers

Pre-requisites

Authentication
  • Not using SR25519 because this would reduce our possibilities. With ED25519 (used since Duniter v1), we can still access the seed and do everything. With SR25519 we are locked and can’t get the seed.
  • Therefore we are not implementing the encrypted JSON authentication format provided by py-polkadot-sdk since it only supports ED25519. We therefore stay with (E)WIF authentication format
  • Do we set mnemonic as default import method, instead of Scrypt?
Tools, functions, helpers
  • Get currency code/name from RPC: substrate.chain for the ss58 format address
  • Request uids from the indexer to set the link between the identity index and the identity username/alias
  • Implement Click type checking when passing a ss58 format address
  • Implement mnemonic authentication import
  • Amount class: Amounts management: cent, unit, and relative fo... (#193)
  • get_ud_value()
  • Display fees and refund estimations on all kind of transactions: nodes/rust/duniter-v2s!331 (merged)

Port existing commands/features


Postpone to next release? (not so important, DR can be released standalone)

  • wot revocation: (support reading v1 revocation format file until a deprecation date, support generating and reading v2 format)
  • wot exclusions
  • blockchain blocks

Important features to be ported

Only implemented by Silkaj, so once we switch the Ğ1 to v2s ecosystem, following features will stop functioning:

  • multi-recipients transfers to Ğ1 technical ecosystem remunerations
  • DeathReaper: Keep it similar listening to the blockchain events. Listen to exclusions from the indexer. Could be replaced with a feature onchain to report via email the exclusion. The datapod could store the email addresses. Having the emails accessible to everyone would be an issue regarding spam purposes. A private service/datapod should store the emails.

Post tasks after initial porting

Implement new features

Later

  • Display fees per transaction and ask for confirmation (some are reimbursed, so mention the fees are reimbursed). Document it on the documentation.
  • Schedule transfer support
Edited by Moul
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information