Neo: NativeContract for NeoFS

Created on 20 Nov 2019  路  22Comments  路  Source: neo-project/neo

I don't think NeoFS should provide any SYSCALL for smart contracts. Instead, NeoFS should provide a native contract.

Methods:

  1. Balance: withdraw
  2. IR nodes: register, vote

(Please add on.)

discussion neofs

Most helpful comment

We propose to have NeoFS working with Smart Contracts via Oracle protocol to solve security and data consistency issues. Will describe in more details in following comments a little bit later.

All 22 comments

Objects in NeoFS are immutable. You can do PUT, GET, HEAD and DELETE, but instead of update you need to do some tricks with linking to emulate expected update behaviour.

Storage GAS payment and balances bookkeeping is done by NeoFS Inner Ring nodes. There is a tutorial video explaining payments in NeoFS.

In short, user sends some deposit in GAS that is distributed between storage nodes as storage service payment. It means when user creates a new object there is no need to write anything to blockchain itself.

Right now the NeoFS regular Smart Contract is responsible for processing users' deposit and withdraw operations and InnerRing nodes tracking.

It means when user creates a new object there is no need to write anything to blockchain itself.

This sounds great. Can you provide design documentation on Github for discussion? Video is hard to quote and discuss.

High level architectural overview is on NeoFS site. More detailed technical design document is a work in-progress, as we are going from alpha to beta stage with current NeoFS testnet.

We propose to have NeoFS working with Smart Contracts via Oracle protocol to solve security and data consistency issues. Will describe in more details in following comments a little bit later.

Am I right that deposit is just a transaction of GAS to another account and we don't need separate deposit method in native contract?

Am I right that deposit is just a transaction of GAS to another account and we don't need separate deposit method in native contract?

I think the neofs native contract may need to store some extra data when deposit.

For deposit there is no need for additional information in current design. Inner Ring nodes are monitoring blockchain and will track transaction and get all the information required.

If the balance are not stored in the native contract, how does it know how much GAS
can be withdrawn when the withdraw method is called?

To withdraw gas, user request a "cheque" from NeoFS InnerRing nodes. It's passed to NeoFS SmartContract as a proof of owning that amount of GAS on common deposit balance on during withdraw call.

Cheque is signed by InnerRing nodes and when issued, it triggers locking of the requested amount to avoid double spending. then InnerRing will monitor blockchain for successful withdraw transaction and correct the balances or release locked amount if the cheque was not used.

NeoFS withdraw scheme

Can this cheque be faked? How can I become an inner ring node?

Can this cheque be faked?

It's hard to fake it. It must be signed by InnerRing nodes using dBFT, so faking complexity is the same as faking block in main Neo.

How can I become an inner ring node?

To become the InnerRing node the one should pass the procedure similar to becoming Neo CN and transfer the security deposit that will be lost in case of node's misbehaviour.

To become a neo CN, you need the votes from neo holders. How to become a neofs InnerRing node? Are they voted by neo holders too? Or do each of the neo consensus nodes also assume the role of the InnerRing node?

Currently at alpha testnet stage all InnerRing nodes are owned and controlled by us. At later stages to become IR node the one calls NeoFS Smart Contract to enter the candidate list and then, after voting or any other process, which is under discussion now, the node enters the InnerRing nodes list. It's tied to reputation and rating system so not just anybody can enter InnerRing.

InnerRing nodes are not Neo CN Nodes for security reasons.

At later stages to become IR node the one calls NeoFS Smart Contract to enter the candidate list and then

So the IR nodes list is stored on blockchain, right?

InnerRing nodes are not Neo CN Nodes for security reasons.

For what security reasons?

So the IR nodes list is stored on blockchain, right?

Yes, the list of IR nodes is stored in NeoFS Smart Contract on blockchain. On regular NeoFS node bootstrap this information is taken from blockchain.

For what security reasons?

Currently IR nodes expose their network addresses. Until NeoFS switch to another communication scheme, it may be dangerous for Neo network to colocate CNs and IR.

Is it not dangerous for the IR nodes to expose their network addresses?

Is it not dangerous for the IR nodes to expose their network addresses?

It is, but not that critical as for Neo Blockchain. NeoFS network itself can live without IR for some time. Users will not be able to create new containers, all payment and audit actions will be postponed, but data still will be available and even new object creation will work.

We will address this issue in future but at current stage we can live with it.

When we are talking about CN or IR nodes, it actually express two meanings. One is the server, the other is the blockchain address. I think IR and CN can be the same address but runs on different servers. In this way, it is safe for CN to colocate with IR.

I don't think that it's a good idea to copy PK of CNs, but technically it could work. However the number of CNs and IR nodes may be different.

The consensus node should have a backup server to prevent downtime caused by the failure. So the private key will be copied anyway.

By the way, how is the number of IR nodes determined?

Currently 5 + additional nodes needed for audit tasks. We are researching this on testnet.

Was this page helpful?
0 / 5 - 0 ratings