Skip to content

Instantly share code, notes, and snippets.

@ig-shaun
Last active May 4, 2020 09:45
Show Gist options
  • Save ig-shaun/ba32639937b19791fff275ccdab31b97 to your computer and use it in GitHub Desktop.
Save ig-shaun/ba32639937b19791fff275ccdab31b97 to your computer and use it in GitHub Desktop.

Treasury Oracle Transactions

Treasury Oracles send signed messages to trigger functions within the Treasury module. This produces state changes through the module's Handler. Only authorised oracles which are listed in the Genesis File of an ixo protocol blockchain have the capability to send messages that will be processed and executed as valid transactions by the Treasury Module. Each Treasury Oracle has a narrowly pre-defined scope of capabilities to mint, burn or transfer a specific token. This builds on the Object Capabilities Model for security.

When a user or application wants to mint, burn or transfer a specific token, they issue a claim, which must prescribe to a specific format, such as:

  • Bank Deposit Claim
  • Bank Withrawal Claim
  • Bank Transfer Claim
  • Bank Dispute Claim

A Treasury Oracle must be employed by the issuer of the claim (or by another party) to evaluate and verify each claim in this context. Depending on the nature of the claim and the capability of the oracle, this verification process may result in the Treasury Oracle sending a message to the Treasury Module, which will produce a transaction. The Treasury Oracle may have one or more signers. This could, for instance, be a quorum of the bonded validators in an ixo protocol blockchain network. Each signed message is added to the transaction. Once the required threshold (n of m) authorised signatures has been collected, the transaction is generated with an array of the messages and metadata contained in the TxBuilder context. The transaction is submitted for mining by the network through the standard validation, approval and consensus process.

Treasury Oracle transactions are implemented by the handler mechanism of the Treasury Module, which communicates with handlers of other modules (such as the Bank Module) that will write state changes to the ledger.

Messages accepted by the Treasury Module module are defined in the module's msgs.go file. The functions to handle each of the module's messages Treasury Module are defined in the module's handler.go file.

// TxBuilder implements the transaction context.

	txEncoder          sdk.TxEncoder
	keybase            crkeys.Keybase
	accountNumber      uint64
	sequence           uint64
	gas                uint64
	gasAdjustment      float64
	simulateAndExecute bool
	chainID            string
	memo               string
	fees               sdk.Coins
	gasPrices          sdk.DecCoins
}

Every message in a transaction must be signed by the addresses specified by GetSigners. The signing process is handled by the Oracles module // or auth module, which is the standard way Cosmos does this?

Signing is automatically performed when the transaction is created. // unless the user choses to generate and sign separately - which is how we could implement a ZK SNARK roll-up mechanism?

The TxBuilder (namely, the KeyBase) is used to perform the signing operations, and the CLIContext is used to broadcast transactions.

@migueldingli1997
Copy link

migueldingli1997 commented May 4, 2020

Also, multisig is currently not supported by the ixo blockchain messages. The GetSigners mentioned is not really utilised by the ixo AnteHandlers. I can look into how this can be supported and enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment