Replies: 4 comments 22 replies
-
That is great! I wanted to add a few points I think are also important, which are related to how these endpoints are implemented. IMO we should have these points in mind when choosing the stack and designing the endpoints:
The points above are to make sure developers can build great apps with these APIs, which is important to create a great ecosystem. Here are the motivation behind some of the above points:
With the above in mind, I think that:
|
Beta Was this translation helpful? Give feedback.
-
This looks great! Thank you! A few questions/comments: Transaction submissionThis is how I roughly thought about this as well. In the future, we could add One open question in my mind is what do we get back in the response. We currently don't have a notion of transaction ID or hash, and even if we did, this value could probably be computed by the user themselves. So, maybe just getting back success/failure is enough? Regarding failures, I think we should check the following and return appropriate error codes:
The first two would require lookups against account and nullifier databases. The third one would involve non-negligible computation (i.e., 5m - 15ms). So, we should think of these as potential vectors for DoS attacks. One way to mitigate these is to require clients to submit some PoW with the request. The core idea is to make the cost of a request for the client ~1000x higher than the cost for the node to reject an invalid request. But this is probably not something we'd do for the private testnet. Block retrievalThis also agrees with how I was thinking about it. I do have a few suggestions/questions here: On the request side, besides the block number, it might be good to be able to specify something like On the response side, how were you thinking about partially materialized blocks? Or more generally, should we be able to specify which parts of the block to return? There could be a few options here:
I think all of these could be quite useful, but the question is which of these would we need for the private testnet. Note origin / inclusion proof retrievalThis one I still need to think though a bit more - but I did want to make a couple of comments:
Note hash is actually unique - if it wasn't, nullifiers would not be unique either - which would mean only one of colliding notes could be consumed. I do think we need a way to somehow retrieve notes by their tag - but how this should work requires more thinking. Nullifier checksI think we should provide an endpoint to check whether a given nullifier has been consumed. The endpoint for this could look like: Method: check_nullifiers Parameters
Response
One question here is if we want to provide block number as an extra parameter to look up the state of the nullifier DB at a given block. My thinking here is that it'll probably introduce a lot of complexity and benefit of providing this info by the node is marginal. Maybe this info could be aggregated by some 3rd-party services in the future. |
Beta Was this translation helpful? Give feedback.
-
One thing I'm trying to figure out how we can reduce the amount of data a node needs to keep as much as possible. Main reason is that in high-throughput scenarios storage requirements will grow very quickly. For example, at 1K TPS if we store historical data we'd need almost 10TB of storage per year. And at 10K TPS that would grow proportionally to 100TB/year. Another reason is that most of this data is actually not needed to operate the network. Here we benefit both because of ZKPs and because we are a rollup and the benefit is that we don't need to download any historical data to know that the latest state is valid. So, to sync a new node, it may actually be cheaper to send the latest state than historical deltas which build up to this state. For example, let's say there are 1B accounts in the system (for simplicity, let's assume that all of these are private accounts). Sending hashes of all these accounts to someone would require 40GB. At 1K TPS, if each block stores To take a step back, with each block we probably want to include the following:
A lot of this data is needed by the node only for a relatively short period of time. Specifically:
So, I'm wondering if we should take the above considerations into account as we think through the RPC endpoints. Also, it seems to me that these endpoints will have 2 targets: clients (what we are thinking about now) and other nodes - and I wonder if we should look at them more comprehensively. For example, to stay synced, a node may want to request the following data:
If we want a node to be able to serve such requests, the node would need to have latest account states, nullifiers, and notes indexed by block number. For nullifiers and notes this would be similar to downloading data block-by-block, but for account latest states this would be somewhat different as we need only the latest state. One potential implication of this is that maybe we shouldn't promise the ability to retrieve detailed account data by block. From the client perspective, I think that the things we want to do are:
For number 3, I do think it is better to use tag than note hash (although maybe we can provide both). I'm imagining the following endpoint: Method: get_notes_by_tag Description: finds the first block with Parameters:
Response:
In the above, identifying the notes by |
Beta Was this translation helpful? Give feedback.
-
Some more thoughts on
|
Beta Was this translation helpful? Give feedback.
-
Introduction
The purpose of this design specification is to outline the necessary JSON-RPC (Remote Procedure Call) endpoints required to support the limited functionality of the test network for the Miden Rollup. The primary objective / functional requirement of the test network is to enable users to send assets from one account to another. To achieve this goal we will outline the JSON-RPC endpoints required to achieve this goal.
We need four core endpoints:
RPC Endpoints
Transaction Submission
Description: This endpoint allows a user to submit a client side proven transaction.
Method: submit_transaction
Parameters:
Please see the
ProvenTransaction
struct for more insight on this object.Response:
Block Retrieval
Description: This endpoint is used to return information relating to a specific block.
Method: get_block
Parameters:
Response:
Note Origin Retrieval
Description: This endpoint is used to retrieve the origin of a particular note of interest. I'm still uncertain if this should be the responsibility of the node or if there should be some third party relational db based component that indexes notes and their origin.
Method: get_note_origin
Paramaters:
We have two potential options:
Response:
Note:
The note_hash and note_metadata may not be unique and as such this method may need to account for such cases.
Note Inclusion Proof Retrieval
Description: This endpoint is used to fetch a merkle inclusion proof for a specified note against a specific block reference such that the note can be authenticated in the transaction kernel.
Method: get_note_inclusion_proof
Parameters:
Response:
MerkleStore
which contains both the MMR proof and the note Merkle tree proof.Beta Was this translation helpful? Give feedback.
All reactions