forked from Graviton-One/gravity-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Ergo Adaptor
Moein zargarzadeh edited this page Apr 28, 2021
·
2 revisions
This document describes the methods and functions required to make an adaptor based on interface.go principles.
The following functions are supposed to be called by other modules:
- This type is the main struct of the adaptor
- Array of ErgoAdaptors
- Adds AdapterOptions to ErgoAdaptor
- Calls
validateErgoAdapterOptionsmethod to check option type
- Validates that options have the right type and value. (validators are implemented in
factory.go)
- To be called in
ledger.goas a parameter ofNewErgoAdapter
- To be called in
node.goas a parameter ofNewErgoAdapter
- Makes new adaptor in
factory.go - AdapterOptions is used to make an Ergo client
-
applyOptsmethod is called here.
- To be called in
ledger.goandnode.goto make an Ergo adaptor.
The following functions implement the IBlockchainAdaptor methods expected in interface.go. Since there is no Ergo client available in Golang, the rest-API architecture is used to develop a proxy connecting Gravity to Ergo.
- Calling
/heightroute of the proxy returns the blockchain's height. - The response will be parsed and the suitable result will be returned.
- This function is used to check whether confirmation is done or not.
-
TxWaitCountis used to wait some time in order to checking the confirmation -
/numConfirmationsroute withidas parameter checks whether this id is confirmed or not. - This functions returns the number of confirmations if the tx is confirmed, otherwise it returns
-1.
- In Ergo a variant of
Shnorr Signatureis being used as the signature method. Therefore, the signature is in form of a(a,z)pair. - Sends a post request to
/signroute with the body ofmessage hashandsecret key, in order to sign themessageHash.
- Ergo Public Key is used to make an
Oracle public key.