Thou shalt check their witnesses

Neo N3 transaction

Neo N3 transaction
Neo N3 transaction
  • script is a NeoVM bytecode, also known as ”entry script”, this is what gets executed when transaction is processed by nodes
  • signers is an array of accounts (Uint160 script hashes) with scopes
  • witnesses is an array (with the number of elements exactly matching the number of signers) of script pairs containing verification script (that hashes to signer script hash) and invocation script (that usually contains signatures checked by verification script)

Sender

CheckWitness

CheckWitness for calling contract

Signature scopes

  • None
  • CalledByEntry
  • CustomContracts
  • CustomGroups
  • Rules (since 3.1.0)
  • Global

Global

Global witness scope
Global witness misuse

None

None witness scope

CalledByEntry

CalledByEntry witness scope

CustomContracts

CustomContracts witness scope
Combined CalledByEntry and CustomContracts scope

CustomGroups

CustomGroups witness scope

Rules

CustomContracts scope reentrancy attack
  • Boolean: true or false, mostly useful for testing or emulating Global/None scopes
  • Not: inverting nested condition
  • And: matching a whole set of nested conditions (up to 16 of them)
  • Or: matching one of conditions from nested set (also up to 16)
  • ScriptHash: contains a hash to compare with script that is being currently executed (similar to CustomContracts)
  • Group: contains a key identifying a group to compare with groups of the currently executing script (similar to CustomGroups)
  • CalledByEntry: evaluates to true if the script is an entry script or one called directly by it (like CalledByEntry scope)
  • CalledByContract: contains a hash to compare with the caller script hash
  • CalledByGroup: contains a key identifying a group to compare with the groups of the caller script
Rules witness scope example

Conclusion

References

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Secret Network is a Layer-1 Tendermint Blockchain built with the Cosmos SDK, enabling connection to…

Blockchain Exchange Technology and CloudQuant [Podcast]

KEPLERSWAP MOST ASKED QUESTIONS AND ANSWERS

Interpretation of Osasion`s Latest Announcement

Blockchain Monster Hunt x Polkastarter IDO Whitelist for BCMC is Now Closed

ACKNOLEDGER: GLOBAL CONSORTIUM EXPANDING ITS NETWORK

The Exclusive LIT — TOMO Swap Program

ADPlug Agent Roles

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Neo Saint Petersburg Competence Center (Neo SPCC)

Neo Saint Petersburg Competence Center (Neo SPCC)

More from Medium

Filecoin 2021年回顾:指数级增长的一年

A Visit Karachi!

Creating a Context for School Board Decisions

Lobby Statement of Principles