package
0.0.0-20200109191904-8d1786a9f689
Repository: https://github.com/joincivil/go-common.git
Documentation: pkg.go.dev

# Functions

ABILinkLibrary replaces references to a library with the actual addresses to those library contracts.
AccountFromPK constructs an Account from the provided ECDSA private key hex string.
AsEthereumSignedMessage adds a prefix and len to the message to identify it as an Ethereum specific signature.
DecodeSignatureBytes decodes a signature to bytes.
DeployContractWithLinks patches a contract bin with provided library addresses.
GetEthAddressFromPrivateKey returns the Ethereum address for a given ECDSA private key.
MakeAccount generates a new random Account.
NewBlockHeaderCache is a convenience function to init a BlockHeaderCache.
NewDefaultGovernmentConfig returns default values to use when creating the Government contract.
NewDefaultParameterizerConfig returns default values to use when creating the Parameterizer contract.
NewDeployer builds a new Deployer instance.
NewETHClientHelper creates a new Helper using an ethclient with the provided URL accountKeys is a mapping of name->privateKey hex string.
NewService creates a new Service instance.
NewSimulatedBackendHelper creates a new Helper using an ethereum SimulatedBackend generates accounts for "genesis", "alice", "bob", "carol", "dan", "erin".
NewTxListener creates a new TransactionService instance.
NewTxListenerWithWaitPeriod creates a new TransactionService instance with a wait period.
NormalizeEthAddress takes a string address to normalize the case of the ethereum address when it is a string.
SignEthMessage signs a given message with the given ECDSA private key.
VerifyEthChallenge confirms that a "challenge" string has a timestamp that is within {gracePeriod} number of seconds from the current time this is used to ensure that an attacker cannot reuse previously signed messages Challenge should be in the form of "{prefix} @ 2018-01-04T17:48:32-05:00".
VerifyEthChallengeAndSignature accepts a ChallengeRequest and verifies that it is valid.
VerifyEthSignature accepts an Ethereum address, a message string, and a signature and confirms that the signature was indeed signed by the address specified Handles signatures with and without 0x prefixes.
VerifyEthSignatureWithPubkey accepts an ECDSA public key, a message string, and a signature and confirms that the signature was indeed signed by the key specified Handles signatures with and without 0x prefixes.
WebsocketPing periodically makes a call over the given websocket conn to the Eth node to ensure the connection stays alive.

# Constants

TxListenerTransactionCompleteMsg is the message sent when the transaction is completed.
TxListenerTransactionErrorMsgPrefix is the message sent when there is an error with transaction polling.
TxListenerTransactionPendingMsg is the message sent when the transaction completion is pending.

# Structs

Account groups a private key, authentication, and ETH address.
BlockHeaderCache stores a memory map of blockNumber to the types.Block.
ChallengeRequest contains a signature and the fields needed to verify it.
Deployer provides helper methods to deploy Civil smart contracts.
DeployerContractAddresses tracks smart contract addresses.
GovernmentConfig contains the fields needed to instatiate the Government contract.
Helper provides methods to create Ethereum transactions.
ParameterizerConfig contains the attributes needed to instantiate the Parameterizer contract.
RetryChainReader is a ChainReader that includes some version of ChainReader functions that are wrapped by a retry mechanism.
RetryCivilTCRContract is a CivilTCRContract that includes functions to make contract calls that retry.
Service provides tools that help with interacting with the Ethereum blockchain.
TxListener provides methods to interact with Ethereum transactions.