Documentation ¶
Overview ¶
alias.go holds some type aliases from go-ethereum
ecdsa.go contains some utility functions for reading and saving ECDSA keys
Index ¶
- Constants
- Variables
- func DecodeTransaction(data []byte) (*types.Transaction, error)
- func GenerateKey() (*ecdsa.PrivateKey, error)
- func ReadUnsafeKeyDump(location string) (*ecdsa.PrivateKey, error)
- func SaveUnsafeKeyDump(key *ecdsa.PrivateKey, location string) error
- func VerifyLock(tx *types.Transaction, contractabi string) (bool, error)
- type Address
- type BalanceReply
- type BalanceRequest
- type CallOpts
- type ChainDriver
- type ChainDriverOption
- type Client
- type Contract
- type ETHChainDriver
- func (acc ETHChainDriver) Balance(addr Address) (*big.Int, error)
- func (acc *ETHChainDriver) BroadcastTx(tx *types.Transaction) (TransactionHash, error)
- func (acc *ETHChainDriver) CallOpts(addr Address) *CallOpts
- func (acc *ETHChainDriver) ChainId() (*big.Int, error)
- func (acc *ETHChainDriver) CheckFinality(txHash TransactionHash) (*types.Receipt, error)
- func (acc *ETHChainDriver) DecodeTransaction(rawBytes []byte) (*types.Transaction, error)
- func (acc *ETHChainDriver) GetClient() *Client
- func (acc *ETHChainDriver) GetContract() *Contract
- func (acc *ETHChainDriver) GetTransactionMessage(tx *types.Transaction) (*types.Message, error)
- func (acc *ETHChainDriver) HasValidatorSigned(validatorAddress common.Address, recipient common.Address) (bool, error)
- func (acc ETHChainDriver) Nonce(addr Address) (uint64, error)
- func (acc *ETHChainDriver) ParseRedeem(data []byte) (req *RedeemRequest, err error)
- func (acc *ETHChainDriver) PrepareUnsignedETHLock(addr common.Address, lockAmount *big.Int) ([]byte, error)
- func (acc *ETHChainDriver) SignRedeem(fromaddr common.Address, redeemAmount *big.Int, recipient common.Address) (*Transaction, error)
- func (acc ETHChainDriver) VerifyContract(vs []Address) (bool, error)
- func (acc *ETHChainDriver) VerifyRedeem(validatorAddress common.Address, recipient common.Address) (bool, error)
- type Error
- type Genesis
- type LRContract
- type LockReply
- type LockRequest
- type OfflineLockRawTX
- type OfflineLockRequest
- type OnlineLockRequest
- type RedeemRequest
- type Service
- type SignReply
- type SignRequest
- type TrackerName
- type TransactOpts
- type Transaction
- type TransactionHash
Constants ¶
const DefaultKeyDumpFilename = "ecdsa.json"
const DefaultTimeout = 5 * time.Second
Variables ¶
var ( IsHexAddress = common.IsHexAddress FromHex = common.FromHex Wei = params.Wei GWei = params.GWei Ether = params.Ether )
Alias some helper funcs
Functions ¶
func DecodeTransaction ¶
func DecodeTransaction(data []byte) (*types.Transaction, error)
func GenerateKey ¶
func GenerateKey() (*ecdsa.PrivateKey, error)
GenerateKey returns an secp256k1 key for use with Ethereum
func ReadUnsafeKeyDump ¶
func ReadUnsafeKeyDump(location string) (*ecdsa.PrivateKey, error)
ReadUnsafeKeyDump reads a privateKeyDump from a given JSON file, and unmarshals the contents into an ecdsa.PrivateKey
func SaveUnsafeKeyDump ¶
func SaveUnsafeKeyDump(key *ecdsa.PrivateKey, location string) error
SaveUnsafeKeyDump saves a given ecdsa.PrivateKey into a JSON file at the given location
func VerifyLock ¶
func VerifyLock(tx *types.Transaction, contractabi string) (bool, error)
Types ¶
type BalanceReply ¶
type BalanceRequest ¶
type BalanceRequest struct {
Address Address `json:"address"`
}
type ChainDriver ¶
type ChainDriver interface { }
type ChainDriverOption ¶
type Contract ¶
type Contract = contract.LockRedeem
Contract is our main access point to the Ethereum smart contract we use to lock and redeem ethereum tokens
type ETHChainDriver ¶
type ETHChainDriver struct { ContractAddress Address ContractABI string // contains filtered or unexported fields }
ETHChainDriver provides the core fields required to interact with the Ethereum network. As of this moment (2019-08-21) it should only be used by validator nodes.
func NewChainDriver ¶
func NewChainDriver(cfg *config.EthereumChainDriverConfig, logger *log.Logger, option *ChainDriverOption) (*ETHChainDriver, error)
func (ETHChainDriver) Balance ¶
func (acc ETHChainDriver) Balance(addr Address) (*big.Int, error)
Balance returns the current balance of the
func (*ETHChainDriver) BroadcastTx ¶
func (acc *ETHChainDriver) BroadcastTx(tx *types.Transaction) (TransactionHash, error)
func (*ETHChainDriver) CallOpts ¶
func (acc *ETHChainDriver) CallOpts(addr Address) *CallOpts
func (*ETHChainDriver) CheckFinality ¶
func (acc *ETHChainDriver) CheckFinality(txHash TransactionHash) (*types.Receipt, error)
func (*ETHChainDriver) DecodeTransaction ¶
func (acc *ETHChainDriver) DecodeTransaction(rawBytes []byte) (*types.Transaction, error)
func (*ETHChainDriver) GetClient ¶
func (acc *ETHChainDriver) GetClient() *Client
func (*ETHChainDriver) GetContract ¶
func (acc *ETHChainDriver) GetContract() *Contract
func (*ETHChainDriver) GetTransactionMessage ¶
func (acc *ETHChainDriver) GetTransactionMessage(tx *types.Transaction) (*types.Message, error)
func (*ETHChainDriver) HasValidatorSigned ¶
func (ETHChainDriver) Nonce ¶
func (acc ETHChainDriver) Nonce(addr Address) (uint64, error)
Nonce returns the nonce to use for our next transaction
func (*ETHChainDriver) ParseRedeem ¶
func (acc *ETHChainDriver) ParseRedeem(data []byte) (req *RedeemRequest, err error)
func (*ETHChainDriver) PrepareUnsignedETHLock ¶
func (*ETHChainDriver) SignRedeem ¶
func (acc *ETHChainDriver) SignRedeem(fromaddr common.Address, redeemAmount *big.Int, recipient common.Address) (*Transaction, error)
func (ETHChainDriver) VerifyContract ¶
func (acc ETHChainDriver) VerifyContract(vs []Address) (bool, error)
VerifyContract returns true if we can verify that the current contract matches the
func (*ETHChainDriver) VerifyRedeem ¶
type LRContract ¶
type LRContract interface { Lock(*big.Int) (*Transaction, error) Redeem(*big.Int) (*Transaction, error) ProposeAddValidator(Address) (*Transaction, error) ProposeRemoveValidator(Address) (*Transaction, error) IsValidator(Address) (bool, error) NumValidators() (uint, *Transaction, error) Epoch() (uint, *Transaction, error) DoNewEpoch() (uint, *Transaction, error) }
TODO: embed and implement SContract is the stub implementation thereof the
type LockRequest ¶
func ParseLock ¶
func ParseLock(data []byte) (req *LockRequest, err error)
type OfflineLockRawTX ¶
type OfflineLockRawTX struct {
UnsignedRawTx []byte `json:"unsigned_raw_tx"`
}
type OfflineLockRequest ¶
type OnlineLockRequest ¶
type OnlineLockRequest struct { // RawTransaction of a Lock call from the user to the smart contract // This should be signed and RLP encoded with the ethereum address of the user //OLTAddress common.Address `json:"oltAddress"` RawTx []byte `json:"rawTx"` }
type RedeemRequest ¶
func ParseRedeem ¶
func ParseRedeem(data []byte) (req *RedeemRequest, err error)
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(access *ETHChainDriver) *Service
Returns a new Service, should be passed as an RPC handler
type SignRequest ¶
type SignRequest struct {
// contains filtered or unexported fields
}
type TrackerName ¶
type TransactOpts ¶
type TransactOpts = bind.TransactOpts
type Transaction ¶
type Transaction = types.Transaction