An Ixian DLT Block. A block contains all the transactions which act on the WalletState and various checksums which validate the actions performed on the blockchain. Blocks are the fundamental data structure of Distributed Ledger Technology (DLT) and form a chain of valid states from the so-called 'Genesis Block' to the present moment. An Ixian Block must include checksums of the previous block, checksums of the internal data structures (WalletState) and a list of transactions which have updated the WalletState from its previous value to its current value. In addition, a block contains cryptographic signatures of Master nodes, which is the basis for the Ixian Consensus algorithm.
More...
|
List< string > | transactions = new List<string> { } |
| The list of transactions which should act on the WalletState from the previous block to produce the WalletState for this block. More...
|
|
List< byte[][]> | signatures = new List<byte[][]> { } |
| The list of Master Node signatures which enable the Ixian Consensus algorithm. More...
|
|
List< byte[][]> | frozenSignatures = null |
| The list of Frozen Master Node signatures which enable the Ixian Consensus algorithm. More...
|
|
int | version = 0 |
| Block version. More...
|
|
byte [] | blockChecksum = null |
| Checksum of all the data in the block. This value serves as the basis for block signatures since no block contents may be changed without affecting the block checksum. More...
|
|
byte [] | lastBlockChecksum = null |
| Checksum of the previous block, so that accepting a new block indirectly confirms and validates all past blocks. This is the basic functionality of DLT. More...
|
|
byte [] | walletStateChecksum = null |
| Checksum of the WalletState after the transactions in this block are applied to the WalletState from the previous block. More...
|
|
byte [] | signatureFreezeChecksum = null |
| Checksum of the final list of signatures for block blockNum - 5 . More...
|
|
long | timestamp = 0 |
| Unix Epoch value of when the block was generated. More...
|
|
ulong | difficulty = 0 |
| Ixian Hybrid PoW difficulty value. More...
|
|
Dictionary< ulong, SuperBlockSegment > | superBlockSegments = new Dictionary<ulong, SuperBlockSegment>() |
| List of blocks and their checksums - used only in the superblock functionality. More...
|
|
byte [] | lastSuperBlockChecksum = null |
| Checksum of the previous superblock - used only in superblock functionality. More...
|
|
ulong | lastSuperBlockNum = 0 |
| Block height of the previous superblock - used only in superblock functionality. More...
|
|
byte [] | powField = null |
| Ixian Hybrid PoW solution, if it exists for this block. More...
|
|
bool | fromLocalStorage = false |
| Indicator which shows if the block was processed through the Consensus algorithm, or read from cold storage. More...
|
|
bool | compacted = false |
| Indicator to show if the block has already been compacted through the superblock functionality. More...
|
|
bool | compactedSigs = false |
| Indicator to show if the block's signatures have been compacted through the superblock functionality. More...
|
|
|
static int | maxVersion = BlockVer.v5 |
| Latest possible version of the Block structure. New blocks should usually be created with the latest version. More...
|
|
|
ulong | blockNum [get, set] |
| Block height (block number). This is a sequential index in the blockchain which uniquely identifies each block. More...
|
|
bool | isGenesis [get] |
| Test if the block is the genesis block. More...
|
|
An Ixian DLT Block. A block contains all the transactions which act on the WalletState and various checksums which validate the actions performed on the blockchain. Blocks are the fundamental data structure of Distributed Ledger Technology (DLT) and form a chain of valid states from the so-called 'Genesis Block' to the present moment. An Ixian Block must include checksums of the previous block, checksums of the internal data structures (WalletState) and a list of transactions which have updated the WalletState from its previous value to its current value. In addition, a block contains cryptographic signatures of Master nodes, which is the basis for the Ixian Consensus algorithm.
Definition at line 42 of file Block.cs.
◆ Block() [1/3]
◆ Block() [2/3]
IXICore.Block.Block |
( |
Block |
block | ) |
|
Copies the given block rather than making a reference to it.
This constructor is used in some places of the DLT software where copies of the block data are required and where such a copy would improve performance by requiring less thread synchronziation.
- Parameters
-
Definition at line 185 of file Block.cs.
◆ Block() [3/3]
IXICore.Block.Block |
( |
byte [] |
bytes | ) |
|
Reconstructs a Block from the bytestream. See also getBytes
.
Each block has a getBytes()
function which serializes the block data into a byte buffer, suitable for sending over the network. This constructor can re-create the block from the given bytestream.
- Parameters
-
bytes | Block bytes, usually received from the network. |
Definition at line 288 of file Block.cs.
◆ addSignature()
bool IXICore.Block.addSignature |
( |
byte [] |
signature, |
|
|
byte [] |
address_or_pub_key |
|
) |
| |
Adds the provided signature to the block's signature list.
- Parameters
-
signature | Byte value of the signature. |
address_or_pub_key | Address or public key of the signer. |
- Returns
- True, if the signature was successfully added. False is returned if the signature was already present, or was not valid.
Definition at line 869 of file Block.cs.
◆ addSignaturesFrom()
List<byte[][]> IXICore.Block.addSignaturesFrom |
( |
Block |
other | ) |
|
Mergest the signatures of two blocks without duplicating.
This is used when the Master Node has been working on one set of signatures but receives the same block with a different set of signatures and wishes to merge the two lists together. The function returns the list signatures which were in the other
block, but not in this, while at the same time adding the new signatures to this block.
- Parameters
-
other | The other block (should be the same blockNum ) whose signatures will be merged. |
- Returns
- The list of 'new' signatures.
Definition at line 818 of file Block.cs.
◆ addTransaction()
bool IXICore.Block.addTransaction |
( |
string |
txid | ) |
|
Adds an Ixian Transaction
to the block. The transaction must already be present in the TransactionPool.
Note that the transaction is not executed against the WalletState
when it's added to the block with this function. It is the responsibiltiy of the Master Node implementation to ensure that all transactions, which are added to a specific block, are also applied against the WalletState, so that the walletStateSchecksum represents the finishing state.
- Parameters
-
txid | ID of the transaction to add. |
- Returns
- True, if the transaction was added successfully.
Definition at line 579 of file Block.cs.
◆ applySignature()
byte [][] IXICore.Block.applySignature |
( |
| ) |
|
Signs the Block with the running DLT Master Node's private key.
Signing the block indicates that the node has executed all transactions, specified in this block and has confirmed that the resulting state of all wallets (WalletState
) matches the one in the walletStateChecksum
field. The starting point for the transactions is the Wallet State from the previous block. The resulting signature may include either the node's public key, or its signing address, depending if the public key can be obtained through other means. An example of this is when this node's public key is present in the Presence List.
- Returns
- Byte array with the node's signature and public key or address.
Definition at line 732 of file Block.cs.
◆ calculateChecksum()
byte [] IXICore.Block.calculateChecksum |
( |
| ) |
|
Calculates the blockChecksum
of the DLT Block, using the relevant fields.
- Returns
- Byte value of the checksum result.
Definition at line 603 of file Block.cs.
◆ calculateSignatureChecksum()
byte [] IXICore.Block.calculateSignatureChecksum |
( |
| ) |
|
Calculates the checksum of all signatures on this block.
This is used for the signature freeze functionality of the Ixian DLT. See remarks on the signatureFreezeChecksum
field for details.
- Returns
- Byte value of the signature checksum.
Definition at line 671 of file Block.cs.
◆ compact()
bool IXICore.Block.compact |
( |
| ) |
|
Removes the signatures as part of the compaction process (superblock functionality).
- Returns
- True if compaction was performed, false if the block is already compacted.
Definition at line 1215 of file Block.cs.
◆ containsSignature()
bool IXICore.Block.containsSignature |
( |
Address |
p_address | ) |
|
Checks if the block's signatures field contains the signature of the specified node. Either the node's address or its public key is accepted.
- Parameters
-
p_address | The signer's address. |
- Returns
Definition at line 781 of file Block.cs.
◆ Equals()
bool IXICore.Block.Equals |
( |
Block |
b | ) |
|
Implementation of block equality.
Due to how a distributed ledger works as a technology, the comparison must only examine certain checksums of both blocks to verify whether they are equal or not.
- Parameters
-
b | Other block, sometimes called the RHS (Right-hand-side) |
- Returns
- True if the blocks are equal.
Definition at line 544 of file Block.cs.
◆ getBytes()
byte [] IXICore.Block.getBytes |
( |
bool |
include_sb_segments = true | ) |
|
Retrieves the block in its serialized, 'byte stream' format. See also Block(byte[] bytes)
.
A block can be serialized for network transmission using this function. All relevant fields will be encoded and a byte buffer will be returned. The byte buffer contains a copy of the block, so no thread synchronization is required.
- Returns
- Byte buffer with the serialized block.
Definition at line 405 of file Block.cs.
◆ getFrozenSignatureCount()
int IXICore.Block.getFrozenSignatureCount |
( |
| ) |
|
Retrives the number of signatures on this block.
- Returns
- Number of signatures.
Definition at line 1149 of file Block.cs.
◆ getSignatureCount()
int IXICore.Block.getSignatureCount |
( |
| ) |
|
Retrives the number of signatures on this block. This function might return a larger value, because it does not check for potential duplicates.
- Returns
- Number of signatures.
Definition at line 1133 of file Block.cs.
◆ getSignaturesWalletAddresses()
List<byte[]> IXICore.Block.getSignaturesWalletAddresses |
( |
bool |
convert_pubkeys = true | ) |
|
Retrieves a list of Ixian Wallet addresses from the list of signatures on this block.
Since signatures on the block may include either an address or a public key, this function performs the necessary lookups to return only the Wallet addresses of all signers. If the parameter convert_pubkeys
is specified false, then the public key lookups aren't performed and only the addresses from the signature list are returned.
- Parameters
-
convert_pubkeys | True if public key signatures should be converted back to their respective Ixian Wallet addresses. |
- Returns
- List of Ixian wallets which have signed this block.
Definition at line 1064 of file Block.cs.
◆ getSignerPubKey()
byte [] IXICore.Block.getSignerPubKey |
( |
byte [] |
address_or_pub_key | ) |
|
Attempts to retrieve the public key of the signer address.
This function accepts either a wallet address or a public key. In the latter case, the public key is returned directly, but in the former case, the public key is looked up from the wallet. This allows easy conversion from the signatures field for use in the verify function.
- Parameters
-
address_or_pub_key | Signer address or public key. |
- Returns
- Public key, matching the given address, or null, if the public key is not known.
Definition at line 900 of file Block.cs.
◆ hasNodeSignature()
bool IXICore.Block.hasNodeSignature |
( |
byte [] |
public_key = null | ) |
|
Checks the signatures on the block and returns true, if the block has already been signed by the given public key.
- Parameters
-
public_key | The public key to check. |
- Returns
- True, if the public key has already signed the block.
Definition at line 995 of file Block.cs.
◆ logBlockDetails()
void IXICore.Block.logBlockDetails |
( |
| ) |
|
Writes the block's details to the log for debugging purposes.
Definition at line 1238 of file Block.cs.
◆ pruneSignatures()
bool IXICore.Block.pruneSignatures |
( |
| ) |
|
◆ setFrozenSignatures()
void IXICore.Block.setFrozenSignatures |
( |
List< byte[][]> |
frozen_sigs | ) |
|
◆ setWalletStateChecksum()
void IXICore.Block.setWalletStateChecksum |
( |
byte [] |
checksum | ) |
|
Allocates and sets the walletStateChecksum
.
- Parameters
-
checksum | Checksum byte value. |
Definition at line 1164 of file Block.cs.
◆ verifySignature()
bool IXICore.Block.verifySignature |
( |
byte [] |
signature, |
|
|
byte [] |
signer_pub_key |
|
) |
| |
Verifies if the given signature is valid for this block.
Please note that this function only accepts a public key. If the signature is supplied with an address, the public key must somehow be obtained prior to calling this function, either by taking it from the Presence List, or querying the network.
- Parameters
-
signature | Signature's byte value. |
signer_pub_key | Public key of the signer. |
- Returns
- True, if the signature validates this block.
Definition at line 858 of file Block.cs.
◆ verifySignatures()
bool IXICore.Block.verifySignatures |
( |
bool |
skip_sig_verification = false | ) |
|
Verifies that all signatures on this block are valid.
Checks if all the given signatures and signer addresses match and are valid. In the simpler form (skip_sig_verification
), this function only checks that public keys for all signatures exist and that all signers are known, without cryptographically verifying that each signature matches the block.
- Parameters
-
skip_sig_verification | False for simpler, non-cryptographic verification. |
- Returns
- True if all signatures are valid and (optionally) match the block's checksum.
Definition at line 935 of file Block.cs.
◆ blockChecksum
byte [] IXICore.Block.blockChecksum = null |
Checksum of all the data in the block. This value serves as the basis for block signatures since no block contents may be changed without affecting the block checksum.
Definition at line 85 of file Block.cs.
◆ compacted
bool IXICore.Block.compacted = false |
Indicator to show if the block has already been compacted through the superblock functionality.
Definition at line 152 of file Block.cs.
◆ compactedSigs
bool IXICore.Block.compactedSigs = false |
Indicator to show if the block's signatures have been compacted through the superblock functionality.
Definition at line 156 of file Block.cs.
◆ difficulty
ulong IXICore.Block.difficulty = 0 |
Ixian Hybrid PoW difficulty value.
Ixian Blockchain works on a consensus model and mining is not strictly required. An optional mining system is included to enable initial coin supply distribution. The mining algorithm is Argon2id and the solutions are not included in blocks themselves. There is a special Transaction type which submits a solution to a block. Miners are able to work on any block in the Redacted History window, with the target block specifying its difficulty to which the posted solution must conform.
Definition at line 120 of file Block.cs.
◆ fromLocalStorage
bool IXICore.Block.fromLocalStorage = false |
Indicator which shows if the block was processed through the Consensus algorithm, or read from cold storage.
Definition at line 147 of file Block.cs.
◆ frozenSignatures
List<byte[][]> IXICore.Block.frozenSignatures = null |
The list of Frozen Master Node signatures which enable the Ixian Consensus algorithm.
Definition at line 67 of file Block.cs.
◆ lastBlockChecksum
byte [] IXICore.Block.lastBlockChecksum = null |
Checksum of the previous block, so that accepting a new block indirectly confirms and validates all past blocks. This is the basic functionality of DLT.
Definition at line 89 of file Block.cs.
◆ lastSuperBlockChecksum
byte [] IXICore.Block.lastSuperBlockChecksum = null |
Checksum of the previous superblock - used only in superblock functionality.
Definition at line 128 of file Block.cs.
◆ lastSuperBlockNum
ulong IXICore.Block.lastSuperBlockNum = 0 |
Block height of the previous superblock - used only in superblock functionality.
Definition at line 132 of file Block.cs.
◆ maxVersion
int IXICore.Block.maxVersion = BlockVer.v5 |
|
static |
Latest possible version of the Block structure. New blocks should usually be created with the latest version.
Definition at line 47 of file Block.cs.
◆ powField
byte [] IXICore.Block.powField = null |
Ixian Hybrid PoW solution, if it exists for this block.
This field is not included in the block checksum, nor is it transmitted over the network. Master Nodes fill this information for themselves from the special PoW-Solution transaction types in the TransactionPool.
Definition at line 141 of file Block.cs.
◆ signatureFreezeChecksum
byte [] IXICore.Block.signatureFreezeChecksum = null |
Checksum of the final list of signatures for block blockNum - 5
.
In this way, the signers list is 'frozen' and may no longer be changed, preventing various possible tampering attacks. Since the payout of many of the Ixian DLT's Master Node functions is tied to the accepted signature list, this field protects that list from malicious tinkering. Changes are permitted for five blocks to allow slower nodes to process and apply their signatures.
Definition at line 107 of file Block.cs.
◆ signatures
List<byte[][]> IXICore.Block.signatures = new List<byte[][]> { } |
The list of Master Node signatures which enable the Ixian Consensus algorithm.
Definition at line 62 of file Block.cs.
◆ superBlockSegments
List of blocks and their checksums - used only in the superblock functionality.
Definition at line 124 of file Block.cs.
◆ timestamp
long IXICore.Block.timestamp = 0 |
Unix Epoch value of when the block was generated.
Definition at line 111 of file Block.cs.
◆ transactions
List<string> IXICore.Block.transactions = new List<string> { } |
The list of transactions which should act on the WalletState from the previous block to produce the WalletState for this block.
Definition at line 57 of file Block.cs.
◆ version
int IXICore.Block.version = 0 |
Block version.
New blocks should always be generated with the latest version - maxVersion
, except during the transitional period while the network is upgrading from one block version to the next. Older blocks, retrieved from files or the network may have an older version and this field identifies which version the specific block has. Some Block features are only enabled from specific versions forward.
Definition at line 80 of file Block.cs.
◆ walletStateChecksum
byte [] IXICore.Block.walletStateChecksum = null |
Checksum of the WalletState after the transactions in this block are applied to the WalletState from the previous block.
This allows Ixian Master Nodes to operate on the WalletState and be certain that it matches all other Master nodes without exchanging all the wallet data. WalletState is synchornized when the node first boots up, but is never transferred between nodes later, since it can be updated in a consistent manner using the transactions and wallet state checksums in each block.
Definition at line 98 of file Block.cs.
◆ blockNum
ulong IXICore.Block.blockNum |
|
getset |
Block height (block number). This is a sequential index in the blockchain which uniquely identifies each block.
Definition at line 52 of file Block.cs.
◆ isGenesis
bool IXICore.Block.isGenesis |
|
get |
Test if the block is the genesis block.
Definition at line 1263 of file Block.cs.
The documentation for this class was generated from the following file: