Development on Pecu Novus

Developing on the Pecu Novus Blockchain Network

This area will have everything you need to know on how to help you build with Pecu Novus. It explains the Pecu Novus tech stack, and documents, some advanced topics that will be added for more complex applications and use cases. The Pecu Virtual Machine and the developer tools that are available to build on the network.

Development on Pecu Novus includes three areas:

  1. On-Chain Development: In essence this is where a developer can create and deploy custom programs directly to the Pecu Novus Blockchain. The great thing about this is that these programs can be used by any developer who has the ability to communicate and use them for their own projects. This is where the Pecu Virtual Machine “PVM” comes in and we will touch on that below.
  2. Decentralized Development: Developers of dApps or decentralized applications can be develop such apps using the PVM. The dApps communicate in real time on the blockchain and perform transactions on-chain.
  3. Centralized Development: Developers of centralized applications have a role here as well, they may be developing an application for a financial institution or business and want to run on a blockchain network without being decentralized. That is all possible on Pecu Novus, such developers can create their applications and utilize the available API’s or PVM for them to build out centralized applications with the security and speed of Pecu Novus.

Pecu Virtual Machine

The Pecu Virtual Machine (PVM) is a decentralized virtual environment that executes code consistently and securely across all Pecu Novus nodes. Nodes run the PVM to execute smart contracts, utilizing “gas” aka fees to measure the computational effort required for operations, ensuring efficient resource allocation and network security. Pecu Novus does ensure to keep gas fees on the lower end of the scale and as the network grows the fee structure will further reduce.

Public Ledger and State Machine

The term ‘distributed ledger’ is often used to describe blockchains like Bitcoin, which support a decentralized currency through fundamental cryptographic tools. This ledger maintains a record of all activities and adheres to specific rules governing how the ledger can be modified. For instance, a Bitcoin address cannot spend more digital assets than it has received. These rules form the basis for all transactions on Bitcoin, Ethereum, and many other blockchains.

Pecu Novus, with its native cryptocurrency (PECU), operates under similar intuitive rules but offers a more advanced capability akin to Ethereum: the creation of smart contracts. To describe this complex feature, we use a more sophisticated analogy. Instead of a distributed ledger, Pecu Novus functions as a distributed state machine. The state of Pecu Novus is a large data structure that not only includes all accounts and balances but also encompasses a machine state. This machine state can change from block to block according to a predefined set of rules and can execute arbitrary machine code. The specific rules for changing state from block to block are defined by the PVM (Pecu Virtual Machine).

The PVM (Pecu Virtual Machine) behaves like a mathematical function: given an input, it produces a deterministic output. This makes it useful to describe Pecu Novus more formally as having a state transition function. When provided with an old valid state and a new set of valid transactions, the Pecu Novus state transition function generates a new valid output state.

State

In the context of Pecu Novus, the state is an enormous data structure called a modified Merkle Patricia Trie. This structure keeps all accounts linked by hashes and can be reduced to a single root hash stored on the blockchain.

Transactions

Transactions are cryptographically signed instructions from accounts. There are two types of transactions in Pecu Novus: those which result in message calls and those which result in contract creation.

Contract creation results in the creation of a new contract account containing compiled smart contract bytecode. Whenever another account makes a message call to that contract, it executes the bytecode contained within the contract account.

PVM Instructions

The Pecu Virtual Machine (PVM) operates as a stack machine with a depth of 1024 items, where each item is a 256-bit word. This word size is chosen for its compatibility with 256-bit cryptography, such as Keccak-256 hashes or secp256k1 signatures.

During execution, the PVM maintains a transient memory in the form of a word-addressed byte array. This memory is temporary and does not persist between transactions.

Contracts, on the other hand, have a persistent storage mechanism. They contain a Merkle Patricia storage trie, which is a word-addressable word array. This trie is associated with the specific contract account and is part of the global state.

Compiled smart contract bytecode is executed through a series of PVM opcodes. These opcodes perform standard stack operations such as XOR, AND, ADD, and SUB. Additionally, the PVM includes blockchain-specific stack operations like ADDRESS, BALANCE, and BLOCKHASH, allowing smart contracts to interact with the blockchain’s state and environment.

PVM Deployments

All deployments of the Pecu Virtual Machine (PVM) must adhere to the specifications detailed in the official documentation. This ensures consistency and reliability across different implementations.

There will be multiple deployments of the PVM in various programming languages. Pecu Novus execution clients will include a PVM deployment. Additionally, there will be standalone implementations available in several programming languages, including Python, C++, JavaScript, Typescript, GoLang and Rust, with more to be added based on user requirements.