neo-project / neo

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

Multiple Witness Checking (Neo 3) #834

Closed igormcoelho closed 5 years ago

igormcoelho commented 5 years ago

One useful feature, already proposed for Neo 2 (https://github.com/neo-project/neo/issues/700 but now not in schedule for implementation) is the ability to check multiple witness in a "multisig" format. This gives flexibility to Witness scripts, at the same time it allows composition in a "multisig" manner.

Using this, each consensus node could be itself a MultiSig contract, or any other verification mean, and still make part of a global multisig contract.

Example:

Witness A (scripthash1):

PUSH64 signature1
PUSH33 pubkey1
SYSCALL Neo.Crypto.CheckSig

Witness B (scripthash3):

PUSH64 signature3
PUSH33 pubkey3
SYSCALL Neo.Blockchain.GetHeight
PUSH 300000
GT # timelock contract... only release after height 300000
THROWIFNOT
SYSCALL Neo.Crypto.CheckSig

Witness C:

# 2/3 multi witness
PUSH20 scripthash1
PUSH20 scripthash2
PUSH20 scripthash3
PUSH3 # n
PUSH2 # m
SYSCALL Standard.Runtime.CheckMultiWitness

This should pass, because we require 2/3 witness, and scripthash1 and scripthash3 will be fulfilled :)

igormcoelho commented 5 years ago

Even with Schnorr signatures in the future, I still think this is a better approach (for very small number of signatures), because it allows all parties to maintain their own control over "share on multisignature contract". Many may use Schorr because of extra privacy too, although not possible here because verifications will eventually be exposed (not the case for Schnorr contracts). But Schnorr will be limited to classic pubkey logic (good for several consensus nodes). On general, I think that a Governance Script could allow consensus nodes to update their pubkeys (part of Schnorr sig in the future), and votes would go to this governance contract. So they would have full control on contract rules (including changing consensus pubkey), as bigger entities or even independent groups sharing a single govenance contract.

igormcoelho commented 5 years ago

It didn't attract discussions, so I'll close it for now.