Skip to content

Instantly share code, notes, and snippets.

@abelliumnt
Last active June 6, 2019 08:47
Show Gist options
  • Save abelliumnt/86fc9ef3980bfc416f20eeac8228f268 to your computer and use it in GitHub Desktop.
Save abelliumnt/86fc9ef3980bfc416f20eeac8228f268 to your computer and use it in GitHub Desktop.
General description for predefined scripts
  1. Implement a set of predefined verification fuctions. These fuctions signature should be like this
fn(address, stdTx, ...parameters){
}
  1. Add a new transaction type. With the new transaction, each address can specify on what transaction, execute which verification functions and corresponding parameters:
|key                                 | value          | type      |
|------------------------------------| -------------- |-----------|
|"func"+address+transactionType      | function names |[]string   |
|"param"+address+transactionType     | parameter list |[][]string |
  1. In checkTx, iterate all Involved Addresses and do these operations:
  • According to transaction type and address, get all function names which need to be executed and corresponding parameters.
  • Execute each fuction with its corresponding parameters.
  • Once a verification fuctions fails, all subsequent checks will be aborted, and the tx will be marked as failed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment