Documentation ¶
Index ¶
- Constants
- func CheckSync(ctx context.Context, cs chan *ethclient.Client) chan *ethclient.Client
- func CheckTransaction(client *ethclient.Client, tx *types.Transaction) (err error)
- func DialToEth(ctx context.Context, urlPool []string) (out chan DialResult)
- func GenEthkey(credentialPath, passPhrase string) (err error)
- func GetBalance(client *ethclient.Client, key *keystore.Key) (balance *big.Float, err error)
- func GetCurrentBlock(client *ethclient.Client) (blknum uint64, err error)
- func NewEthAdaptor(key *keystore.Key, config *configuration.Config, l logger) (adaptor *ethAdaptor, err error)
- func NumOfAccounts(credentialPath string) (n int)
- func ReadEthKey(credentialPath, passphrase string) (key *keystore.Key, err error)
- type DialResult
- type LogCommit
- type LogCommon
- type LogGroupDissolve
- type LogGrouping
- type LogGroupingInitiated
- type LogInsufficientPendingNode
- type LogInsufficientWorkingGroup
- type LogPublicKeyAccepted
- type LogPublicKeySuggested
- type LogRandom
- type LogRequestUserRandom
- type LogReveal
- type LogStartCommitReveal
- type LogUpdateGroupSize
- type LogUpdateGroupToPick
- type LogUpdateRandom
- type LogUrl
- type LogValidationResult
- type OnchainError
- type ProxyAdapter
Constants ¶
const ( //TrafficSystemRandom is a request type to build a corresponding pipeline TrafficSystemRandom = iota // 0 //TrafficUserRandom is a request type to build a corresponding pipeline TrafficUserRandom //TrafficUserQuery is a request type to build a corresponding pipeline TrafficUserQuery )
const ( //SubscribeLogUpdateRandom is a log type to subscribe the event LogUpdateRandom SubscribeLogUpdateRandom = iota //SubscribeLogRequestUserRandom is a log type to subscribe the event LogRequestUserRandom SubscribeLogRequestUserRandom //SubscribeLogUrl is a log type to subscribe the event LogUrl SubscribeLogUrl //SubscribeLogValidationResult is a log type to subscribe the event LogValidationResult SubscribeLogValidationResult //SubscribeLogGrouping is a log type to subscribe the event LogGrouping SubscribeLogGrouping //SubscribeLogPublicKeyAccepted is a log type to subscribe the event LogPublicKeyAccepted SubscribeLogPublicKeyAccepted //SubscribeLogPublicKeySuggested is a log type to subscribe the event LogPublicKeySuggested SubscribeLogPublicKeySuggested //SubscribeLogGroupDissolve is a log type to subscribe the event LogGroupDissolve SubscribeLogGroupDissolve //SubscribeLogInsufficientPendingNode is a log type to subscribe the event LogInsufficientPendingNode SubscribeLogInsufficientPendingNode //SubscribeLogInsufficientWorkingGroup is a log type to subscribe the event LogInsufficientWorkingGroup SubscribeLogInsufficientWorkingGroup //SubscribeLogNoWorkingGroup is a log type to subscribe the event LogNoWorkingGroup SubscribeLogNoWorkingGroup //SubscribeLogGroupingInitiated is a log type to subscribe the event GroupingInitiated SubscribeLogGroupingInitiated //SubscribeDosproxyUpdateBootstrapGroups is a log type to subscribe the event UpdateGroupToPick SubscribeDosproxyUpdateBootstrapGroups //SubscribeDosproxyUpdateGroupSize is a log type to subscribe the event UpdateGroupSize SubscribeDosproxyUpdateGroupSize //SubscribeCommitrevealLogStartCommitreveal is a log type to subscribe the event StartCommitreveal SubscribeCommitrevealLogStartCommitreveal //SubscribeCommitrevealLogCommit is a log type to subscribe the event LogCommit SubscribeCommitrevealLogCommit //SubscribeCommitrevealLogReveal is a log type to subscribe the event LogReveal SubscribeCommitrevealLogReveal //SubscribeCommitrevealLogRandom is a log type to subscribe the event LogRandom SubscribeCommitrevealLogRandom )
const (
//ETH represents the type of blockchain
ETH = "ETH"
)
Variables ¶
This section is empty.
Functions ¶
func CheckTransaction ¶
func CheckTransaction(client *ethclient.Client, tx *types.Transaction) (err error)
CheckTransaction return an error if the transaction is failed
func DialToEth ¶
func DialToEth(ctx context.Context, urlPool []string) (out chan DialResult)
DialToEth is a utility function to dial to Ethereum
func GetBalance ¶
GetBalance returns the wei balance of the given account.
func GetCurrentBlock ¶
GetCurrentBlock returns a block number of latest known header from the current canonical chain.
func NewEthAdaptor ¶
func NewEthAdaptor(key *keystore.Key, config *configuration.Config, l logger) (adaptor *ethAdaptor, err error)
NewEthAdaptor creates an eth implemention of ProxyAdapter
func NumOfAccounts ¶
Types ¶
type LogGroupDissolve ¶
LogGroupDissolve is an onchain event that DOSProxy requests to dissolve a specified group
type LogGrouping ¶
LogGrouping is an onchain event that DOSProxy requests the specified nodes to start DKG to generate a new pubkey
type LogGroupingInitiated ¶
LogGroupingInitiated is an onchain event that DOSProxy has requested a random number to form a new group
type LogInsufficientPendingNode ¶
LogInsufficientPendingNode is an onchain event that means there are no enough pending nodes to form a new group
type LogInsufficientWorkingGroup ¶
LogInsufficientWorkingGroup is an onchain event that means there are no enough working groups to mix with pending nodes to form a new group
type LogPublicKeyAccepted ¶
LogPublicKeyAccepted is an onchain event that DOSProxy receives enough suggested pubkey so accepts it as a new pubkey
type LogPublicKeySuggested ¶
LogPublicKeySuggested is an onchain event that DOSProxy accepts a suggested pubkey
type LogRandom ¶
LogRandom is an onchain event that means a new random is generated by a commit-reveal process with Cid
type LogRequestUserRandom ¶
type LogRequestUserRandom struct { RequestId *big.Int LastSystemRandomness *big.Int UserSeed *big.Int DispatchedGroupId *big.Int }
LogRequestUserRandom is an onchain event that DOSProxy requests a random number with RequestID
type LogStartCommitReveal ¶
type LogStartCommitReveal struct { Cid *big.Int StartBlock *big.Int CommitDuration *big.Int RevealDuration *big.Int RevealThreshold *big.Int }
LogStartCommitReveal is an onchain event that means DOSProxy starts a new commit-revel process
type LogUpdateGroupSize ¶
LogUpdateGroupSize is an onchain event that means GroupSize is updated
type LogUpdateGroupToPick ¶
LogUpdateGroupToPick is an onchain event that means GroupToPick is updated
type LogUpdateRandom ¶
LogUpdateRandom is an onchain event that DOSProxy requests a system random number
type LogUrl ¶
type LogUrl struct { QueryId *big.Int Timeout *big.Int DataSource string Selector string Randomness *big.Int DispatchedGroupId *big.Int }
LogUrl is an onchain event that DOSProxy requests a query result from the specified URL
type LogValidationResult ¶
type LogValidationResult struct { TrafficType uint8 TrafficId *big.Int Message []byte Signature [2]*big.Int PubKey [4]*big.Int Pass bool Version uint8 }
LogValidationResult is an onchain event that shows a quesry result
type OnchainError ¶
type OnchainError struct { Idx int // contains filtered or unexported fields }
func (*OnchainError) Error ¶
func (e *OnchainError) Error() string
func (*OnchainError) FormatError ¶
func (e *OnchainError) FormatError(p errors.Printer) error
func (*OnchainError) Unwrap ¶
func (e *OnchainError) Unwrap() error
type ProxyAdapter ¶
type ProxyAdapter interface { Connect(urls []string, deadline time.Time) (err error) DisconnectAll() Disconnect(idx int) SubscribeEvent(subscribeTypes []int) (chan interface{}, chan error) //Set functions SetGroupSize(g uint64) (err error) UpdateRandomness(signatures *vss.Signature) (err error) DataReturn(signatures *vss.Signature) (err error) RegisterGroupPubKey(IdWithPubKeys [5]*big.Int) (err error) RegisterNewNode() (err error) UnRegisterNode() (err error) SignalRandom() (err error) SignalGroupFormation() (err error) SignalGroupDissolve() (err error) SignalBootstrap(cid *big.Int) (err error) SignalUnregister(addr common.Address) (err error) StartCommitReveal(startBlock int64, commitDuration int64, revealDuration int64, revealThreshold int64) (err error) Commit(cid *big.Int, commitment [32]byte) (err error) Reveal(cid *big.Int, secret *big.Int) (err error) //Get functions GroupToPick() (result uint64, err error) PendingNonce() (result uint64, err error) GetExpiredWorkingGroupSize() (r uint64, err error) GroupSize() (r uint64, err error) GetWorkingGroupSize() (r uint64, err error) LastGroupFormationRequestId() (r uint64, err error) LastUpdatedBlock() (r uint64, err error) NumPendingGroups() (r uint64, err error) NumPendingNodes() (r uint64, err error) BootstrapEndBlk() (result uint64, err error) BootstrapRound() (result uint64, err error) Balance() (balance *big.Float, err error) Address() (addr common.Address) CurrentBlock() (r uint64, err error) RefreshSystemRandomHardLimit() (limit uint64, err error) BootstrapStartThreshold() (result uint64, err error) GroupPubKey(idx int) (groupPubKeys [4]*big.Int, err error) IsPendingNode(id []byte) (bool, error) BootStrapUrl() string }
ProxyAdapter represents an unified adapter interface for different blockchain
func NewProxyAdapter ¶
func NewProxyAdapter(key *keystore.Key, config *configuration.Config) (ProxyAdapter, error)
NewProxyAdapter constructs a new ProxyAdapter with the given type of blockchain and contract addresses