Blockchain Layer of the DIVA Universe. PBFT consensus.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Konrad Bächler 9c29797b21 changed: fast restart (NO_BOOTSTRAPPING) 2 weeks ago
bin update build process to node14 1 month ago
blockstore initial 6 months ago
build changed: developement transaction api 4 weeks ago
dist initial 6 months ago
genesis Revert "changed: refactored blockchain definition (saved approx 10% of traffic)" 3 weeks ago
keys cleaned up key handling, fixed related tests 5 months ago
log ACK support, lint, version bump 6 months ago
src changed: fast restart (NO_BOOTSTRAPPING) 2 weeks ago
state * added state database (aka "world state view") 5 months ago
test changed: fast restart (NO_BOOTSTRAPPING) 2 weeks ago
.editorconfig initial 6 months ago
.eslintrc.json adding unit test infrastructure (ts-node, mocha, chai, testdeck) 6 months ago
.gitignore initial 6 months ago
.mocharc.json clean up, after stress tests 5 months ago
.nycrc.json adding unit test infrastructure (ts-node, mocha, chai, testdeck) 6 months ago
.prettierrc.json initial 6 months ago initial 6 months ago
Dockerfile fixed: docker, replaced npm by pnpm (reason: speed) 4 weeks ago
LICENSE initial 6 months ago changed: fast restart (NO_BOOTSTRAPPING) 2 weeks ago
package-lock.json changed: fast restart (NO_BOOTSTRAPPING) 2 weeks ago
package.json changed: fast restart (NO_BOOTSTRAPPING) 2 weeks ago
tsconfig.json fixed: tsconfig node14 types 4 weeks ago

DIVA Blockchain

A blockchain implementation using Practical Byzantine Fault Tolerance (PBFT) in combination with Proof-of-Stake (PoS) as a consensus algorithm. It is therefore a "Weighted Practical Byzantine Fault Tolerance" consensus.

This is a fully anonymous ("Privacy-By-Design"), very lightweight, fast, low-energy and permissionless blockchain.

The load of the PBFT consensus is very much network bound. The chain gets built by "communication" instead of "computation". Therefore lots of messages are crossing the network.

The peers in the network communicate via websockets. The peers build the tunnels between each other using a secure and efficient "Challenge/Auth" process based on regular asymmetric keys (public/private keys). "Sodium" gets used as the single crypto library - so all crypto-related code is based on solid, very well tested and proven code.

Architecture / Flow

The network itself is permission- and leaderless. Each peer in the network represents a round-based state machine. Each round produces a block. The blocks do have a variable size and blocks are produced on demand.

  1. New block proposal: each peer in the network may anytime propose a bundle of transactions, by transmitting 1-n own signed transactions to the network.
  2. Each peer receiving such a proposal may transmit its vote to the network. If a peer also has own transactions it adds his own transactions to the proposal first and re-transmits the proposal to the network. Per round, each peer can only add one stack of own transactions.
  3. As soon as a peer in the network detects that 2/3 of the whole network have voted for a specific proposal, it issues a commit message and broadcasts it to the network.
  4. As soon as 2/3 of the network have issued commit messages, the new block gets written to the chain.
  5. A new round starts.

Create Your Local Environment

To create a docker based local environment use the project


The configuration can be controlled using environment variables.


Set to 1 to skip bootstrapping. Default: 0


URL to a entrypoint in the network, like http://diva.i2p. Default: (empty)


Default: block




Default: 17468


Default: 17469


Default: (empty)


Default: 0


Default: 0


Default: 1000

Maximum number of blocks kept in memory.


Default: 7

Between 7 and 64 peers.


Default: 120000ms

Between 2 minutes and 10 minutes (120'000ms and 600'000ms).


Default: 3000ms

Interval, in milliseconds, to refresh the network (connect to peers, if needed).



Timeout, in milliseconds, after authorisation fails.


Default: 5000ms

Interval, in milliseconds, to ping the peers in the network.



Interval, in milliseconds, to clean up the network environment (like gossiping data).


Default: 2

Number of pings from a stale peer until synchronization gets triggered.


Default: 10 Maximum number of blocks of synchronization message might contain. Must not exceed BLOCKCHAIN_MAX_BLOCKS_IN_MEMORY.


Default: 0

Whether to log all network traffic (very verbose). Set to 1 to enable verbose logging.


Default: 1000


Default: 50

Interval, in milliseconds, to check whether the block pool is stale.

API Endpoints

Quering the Blockchain

GET /peers

GET /network

GET /gossip

GET /state/{key?}

GET /stack/transactions

GET /pool/transactions

GET /pool/votes

GET /pool/commits

GET /block/genesis

GET /block/latest

GET /blocks

Optional query parameters:

  • limit, integer, > 0


  • gte, integer, > 0
  • lte, integer, > 0


  • /blocks?lte=1 will return the genesis block
  • /blocks?limit=1 will return the latest block
  • /blocks?limit=5 will return the latest 5 blocks
  • /blocks?gte=42&lte=42 will return block on height 42
  • /blocks?gte=42&lte=43 will return blocks 42 and 43

GET /blocks/page/{page?}

Optional query parameters:

  • size, integer, > 0

GET /transaction/{origin}/{ident}

Transmitting Transactions

PUT /transaction/{ident?}

Joining and Leaving the Network

GET /join/{address}/{publicKey}

GET /leave/{address}

GET /challenge/{token}

Network Synchronization

GET /sync/{height}

How to Run Unit Tests

Unit tests can be executed using:

npm run test

Unit tests contain functional tests and will create some blocks within the local storage. The underlying network (like I2P) must be configured properly (the configuration is Work-In-Progress).

To lint the code, use

npm run lint

Contact the Developers

On DIVA.EXCHANGE you'll find various options to get in touch with the team.

Talk to us via Telegram (English or German).


Your donation goes entirely to the project. Your donation makes the development of DIVA.EXCHANGE faster.

XMR: 42QLvHvkc9bahHadQfEzuJJx4ZHnGhQzBXa8C9H3c472diEvVRzevwpN7VAUpCPePCiDhehH4BAWh8kYicoSxpusMmhfwgx

BTC: 3Ebuzhsbs6DrUQuwvMu722LhD8cNfhG1gs

Awesome, thank you!