neo-project / neo

NEO Smart Economy
MIT License
3.47k stars 1.03k forks source link

Add a notary service #2646

Open doubiliu opened 2 years ago

doubiliu commented 2 years ago

Summary or problem description This is a summary , discussed in detail is in issue #1573 In the current system, if a multi-signature operation needs to be completed, manual or third-party websites are required. There is no mechanism in the system that can automatically complete the collection and distribution of multi-signature signatures. So the purpose of this proposal is to add a multi-signature signature automatic collection and sending mechanism to neo.

Structure

The design mainly involves changes to the following components: Core

Plugin

Details

NotaryContract

Contains the following methods:

NotaryRequest

P2P message type, 2 incomplete transactions are encapsulated inside

Message verification

Role

Notary nodes, all nodes that have the NotaryService plugin installed and authorized by the governance committee

NotaryService plugin

The plugin installed by the Notary node will actively monitor and collect NotaryRequest requests in the network, and actively send multi-signature transactions that have collected enough signatures within the validity period, and send the corresponding fallback transaction after the validity period

Process

Incentives

If NotaryNode does not work properly, it will not get incentives. If it works normally, it will receive (NKEYS+1)×FEE amount of gas as a service fee. Even if due to certain circumstances, it is not possible to collect enough signatures within the validity period, NotaryNode can also receive a service fee by sending a fallback transaction

Attack

Malicious multi-sign user

Because the user needs to deposit some gas to the multi-signature address first, and this part of the gas is locked, it can only be withdraw after the validity period expires, and each transaction will be charged a service fee regardless of whether it is successful or not, so it can prevent malicious users from sending spam transactions block the network

Malicious notary node

If the malicious notary node does nothing, it will not receive any incentives. When the signature is collected correctly, the incentive obtained is greater than the incentive obtained when the transaction is deliberately delayed,.And we only need one node in Notary node is normal to complete the entire work. In addition, due to the "conflicting" attribute of the transaction, the malicious NotaryNode cannot send main transaction and fallback transactions at the same time to collect excess incentives.

For more detailed instructions, please refer to the issue https://github.com/neo-project/neo/issues/1573

Neo Version

Where in the software does this update applies to?

erikzhang commented 2 years ago

My questions:

  1. Can NotaryContract be a non-native contract?
  2. Can NotaryRequest use the Extensible message?
roman-khimov commented 2 years ago
1. Can `NotaryContract` be a non-native contract?

https://github.com/neo-project/neo/pull/2425#issuecomment-816484492

2. Can `NotaryRequest` use the `Extensible` message?

https://github.com/neo-project/neo/pull/2425#issuecomment-823594129

erikzhang commented 2 years ago
  1. Can NotaryContract be a non-native contract?

I think it is possible to allow non-native contracts to have onPersist.

doubiliu commented 2 years ago
  1. Can NotaryContract be a non-native contract?

I think it is possible to allow non-native contracts to have onPersist.

A new interoperable function?

AnnaShaleva commented 2 years ago
  1. Can NotaryContract be a non-native contract?

I think it is possible to allow non-native contracts to have onPersist.

NotaryContract should be able to mint GAS to designated Notary nodes during onPersist (to reward them for completed notary requests, it's similar to the way how designated Oracle nodes are being rewarded). I'm afraid this rewarding scheme won't be possible with non-native NotaryContract.

roman-khimov commented 2 years ago
  1. Can NotaryContract be a non-native contract?

I think it is possible to allow non-native contracts to have onPersist.

Non-native contracts can't be executed safely unless they're limited in GAS. And onPersist can't fail, that's something we can't guarantee for non-native contracts too.

vncoelho commented 1 year ago

I think it is a feature that could be native, @doubiliu.

Maybe it is time to move forward with this issue. It can also help with the #2818 PR.