Protocol Specification

From Veriblock Wiki
Revision as of 15:31, 25 April 2019 by VeriBlockTim (talk | contribs) (Created page with "See: Main_Page, Developer_Guide __TOC__ == Common standards == === Addresses === ==== Standard Address ==== A standard address is a 30-character Base58 (See: http...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

See: Main_Page, Developer_Guide

Common standards

Addresses

Standard Address

A standard address is a 30-character Base58 (See: https://en.wikipedia.org/wiki/Base58) string.

Algorithm:

  1. Generate an ECDSA public/private keypair
  2. Hash the X509-encoded public key with SHA-256, represent as Base58
  3. Concatenate ‘V’ + (first 24 characters of hash generated in step 2)
  4. Hash the result of step 3 with SHA-256, represent as Base58
  5. Concatenate the first 5 characters of the hash created in step 4 at the end of the result of step 3. The result is the standard address.

Protocol address 1.png

Multisig Address

A multsig address is a 30-character string with the first 29 characters being Base58 and the final character being 0.

VeriBlock supports M-of-N multisig transactions, up to M and N values of 58. Multisig addresses follow a special format which allows the M and N values to be obtained by inspection.

The algorithm for generating a VeriBlock multisig address is:

  1. Generate or Select N (where 1 < N <= 58) standard VeriBlock addresses which represent the desired members of the signing group
  2. Decide on a value M (where 0 < M <= N), which represents the threshold of unique members who have to sign a transaction for it to be considered valid
  3. Concatenate all String representations of the VeriBlock addresses (and store the order in which they were concatenated, note that the same standard address can be used multiple times)
  4. Hash the concatenation created in step 3 with SHA-256, represent as Base58
  5. Concatenate: ‘V’ + Base58Encode(M - 1) + Base58Encode(N - 1) + (first 22 characters of hash generated in step 4)
  6. Hash the result of step 5 with SHA-256, represent as Base58
  7. Concatenate the first 4 characters of the hash created in step 6 at the end of the result of step 5
  8. Append a ‘0’ to the end of the result of step 7. The result is the multisig address

Protocol address 2.png

Common structures

Block headers

The block header is 64 bytes long, and is formatted as follows:

Size (Bytes) Data Type Data
4 int32 Block Height
2 int16 Version
12 string Previous Block Hash (End)
9 string First Previous Keystone Block Hash (End)
9 string Second Previous Keystone Block Hash (End)
16 string Merkle Root Hash
4 int32 Timestamp
4 int32 Difficulty
4 int32 Nonce


Visual example (block #22 on the VeriBlock mainnet):

Protocol block 1.png

PoP Publication Data

A PoP Transaction puts 80 byte of data in the BTC opreturn:

Size (Bytes) Data Type Data
64 blockheader block header (see: Protocol_Specification#Block_headers)
16 bytes miner address: remove initial 'V', take next 16 bytes

Block size

Normal Transactions and PoP Transactions are stored in separate containers.

  • PoP Transactions --> allowed up to 256
  • Normal Transactions --> VBK blocks are limited to 256KB of normal transactions (standard and multisig) unless they contain VBK->BTC PoP transactions, at which point they are allowed up to 384KB depending on how many PoP transactions they contain relative to the recent average.