Gareth Davies

@garethtdavies

Prime membership

Joined on Nov 7, 2019

  • :::warning A proof of concept implementation of a zkApp staking pool is available here. It is unaudited and should never be used for the custody of actual funds. ::: Currently, when delegating to a block producer (aka validator) on MINA, the distribution of rewards is conducted off-chain, so block producers are responsible for calculating and distributing payouts according to their terms and conditions. Typical terms and conditions would include the fee percentage, the payout frequency, and perhaps the payout algorithm used. While the delegator's funds are not at risk (you merely delegate the right to produce a block), a pool operator can steal any rewards in the worst-case scenario. The only recourse for a delegator would be to switch, which due to the latency involved in delegation transactions, would result in at least two epochs of rewards lost. zkApps are Mina's zero-knowledge powered smart contracts, built with SnarkyJS, a Typescript library. Using zkApps, we can reimagine a Mina staking pool whereby: Anyone can force a payout from a pool. The calculation of the rewards is verified.
     Like 1 Bookmark
  • Snark Worker While block producers create blockchain proofs that prove the validity of the current state of the blockchain, they do not certify the included individual transactions. Snark workers handle the task of creating these transaction proofs. Offloading these transaction proofs from the block producer to snark workers means that the transaction proof generation may be parallelized, significantly improving the network's throughput. When a block producer generates a block, they may include transactions recently seen on the network and included in the transaction pool. The block producer includes these transactions in the staged ledger via a data structure known as the scan state. For each transaction they add to the scan state, the block producer must add an equivalent amount of completed snark work from the snark pool. The snark pool contains completed transaction proofs submitted by snark workers for transactions added by prior block producers. Snark workers charge a fee for generating these transaction proofs and are compensated by the block producers purchasing their completed snark work. A snark worker may charge any fee for the work they produce, but a block producer will (all things being equal) purchase the work required for the lowest fee. A snark worker does not need the full state to operate and can run as a standalone process when paired with a snark coordinator.
     Like 6 Bookmark
  • Syncing a node To successfully produce a block that extends the Mina blockchain, a node requires the current state. To retrieve this state, a node will initialize by determining the current best tip of the network from a random sample of (8) peers. The distance from the root of the node's transition frontier to the current best tip determines if the node requires bootstrapping. If the best tip is too far into the future, for example, a node that is new to the network or has been offline for an extended period, then a bootstrap is triggered. Alternatively, a node may enter catchup to sync to the current best tip using the existing root of the transition frontier. The syncing process builds the node's transition frontier by creating breadcrumbs from all transitions between the transition frontier's root to the current best tip. Once this has been completed, the node is synced. Initialization After pausing to ensure that the node is well connected, a node requests the best tip from a random sample of (8) peers. The best tip is used to determine whether a bootstrap or catchup is triggered.
     Like 2 Bookmark
  • GraphQL API :::warning Mina APIs are still under construction, and endpoints may change. ::: The Mina daemon exposes a GraphQL API used to request information from and submit commands to a running node. By default, an HTTP server runs on port 3085, though this may be configured by passing the -rest-server flag to the daemon startup command. To use the GraphQL API, connect your GraphQL client to http://localhost:3085/graphql or open in your browser to utilize the GraphiQL IDE. By default, only connections from localhost are permitted. To listen on all interfaces, add the -insecure-rest-server flag to the daemon startup command. :::danger
     Like  Bookmark
  • Troubleshooting :::info The testnet has frequent updates. Please monitor Discord for new releases with fixes and updated peer information. ::: General I am crashing with failed to synchronize epoch ledger This issue was resolved by the release 880882e45e48aaf987aca191f488c7f65609c305 so ensure you have upgraded and redownload the peers.txt file. I am stuck at block height of 1 and a max observed block length of 1
     Like 1 Bookmark
  • High-Level Overview Mina is a succinct blockchain that remains a fixed size as opposed to other blockchains that grow continuously over time. Due to its consistent size, Mina stays accessible and can be trustlessly accessed from any device, even as it scales to millions of users and accumulates years of transaction data. Mina achieves this by replacing the blockchain with an easily verifiable, consistent-sized cryptographic proof. So, instead of end-users trusting intermediaries to provide accurate information about the ledger's state, they are given the state along with a zk-SNARK that cryptographically guarantees that the state is accurate. Mina uses a proof of stake consensus mechanism called Oroborous Samisika, an adaptation of the Oroborous consensus mechanism for use in a succinct blockchain. Mina's native token is mina, which are subdivided into a billion nanomina. :::info
     Like 1 Bookmark
  • :::danger Work in progress ::: What's in a block A block in Mina, is a transition from the existing blockchain state to a new state. A block in Mina is constituted of: Protocol state Protocol state proof Staged ledger diff
     Like 1 Bookmark
  • Scan state The scan state is a data structure that allows decoupling the production of transaction SNARKs from block producers to snark workers. As the block producers no longer have to produce these transaction SNARKs, the block production time may remain constant regardless of the transaction throughput. Additionally, the scan state data structure allows the transaction SNARK proof generation to be parallelized and completed by multiple competing snark workers. The scan state is comprised of a forest of full-binary trees where each node in the tree is a job to be completed by a snark worker. The scan state periodically returns a single proof from the top of a tree that attests to the correctness of all transactions at the base of the tree. The block producers include the emitted ledger proof in the blockchain SNARK they generate that proves both the chain's current state is valid and attests to the validity of all transactions included in the snarked ledger. As a result, block times may remain constant regardless of the transaction throughput, with the scan state capable of adjusting to match any transaction throughput. :::info
     Like  Bookmark
  • Block Producers The role of a block producer in Mina is to achieve consensus and provide security to the blockchain. The block producer is responsible for creating new blocks, which include recent transactions broadcast on the network and a blockchain proof that proves the current state of the chain is valid. In Mina, anyone may become a block producer. There is an unbounded number of participants with the chance of producing a block proportional to the funds staked. Funds are not locked and are not subject to slashing. In return for staking funds and generating the required blockchain proofs, blocks produced and included in the canonical chain are rewarded in the form of a coinbase and transaction fees, less any fees paid to purchase required transaction snark work. To produce a block successfully, a block producer must have the current state of the blockchain. Additionally, they must have enough available compute to produce a blockchain SNARK within the slot time and be connected to peers to broadcast the generated block within an acceptable delay as defined by the network consensus parameters. Selecting a block producer
     Like  Bookmark