ethereumService

package
v0.0.0-...-6f32bdd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2023 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectClient

func ConnectClient(address string) *ethclient.Client

* Description: Connectes to an Ethereum full node through RPC and returns * the connection to the user. * @dev Return a struct to an RPC client connected to Ethereum full node. * @return value of 'Pointer to struct of rpc client'

func CreateKeyStore

func CreateKeyStore(password string)

* Description: Creates a new keystore under the wallet directory and add a new account to it. * @dev Return nothing. * @return value of 'nnothing'

func GetDhtList

func GetDhtList(instance *state.State, transactionData *bind.TransactOpts) []string

* Description: Takes an instance of the smart contract and transaction data * and then query the conttract to get a list of active dht bootstrap nodes. * @dev Return a string slice of activ DHT bootstrap nodes on the blockchain. * @return value of 'String slice'

func GetUserAddress

func GetUserAddress(instance *state.State, transactionData *bind.TransactOpts, userName string) (string, error)

* Description: Get address information from the smart contract by seraching for a username and * setting call options from the transaction data. * @dev Return a Address and nil if success or error message on failure. * @return value of 'String and error'

func GetUserName

func GetUserName(instance *state.State, transactionData *bind.TransactOpts, peerId string) (string, error)

* Description: Get username information from the smart contract by seraching for a peer id and * setting call options from the transaction data. * @dev Return a username and nil if success or error message on failure. * @return value of 'String and error'

func ModDhtList

func ModDhtList(instance *state.State, transactionData *bind.TransactOpts, addr string) error

* Description: Takes an instance of the smart contract and transaction data * and address string and adds it to a DHT bootstrap list on the ethereum smart contract. * @dev Return a nil value on success and error message on fail. * @return value of 'error'

func ReadKeyStore

func ReadKeyStore(fileName string, password string) *keystore.Key

* Description: Read a wallet file and store it in jsonBytes * Then decrypt the key with the users password and return the key. * @dev Return a dereferenced pointer to a Key struct from the Ethereum keystore libary. * @return value of 'key struct'

func Register

func Register(instance *state.State, transactionData *bind.TransactOpts, name string, peerId string, address string) error

* Description: Register a user by using transaction data and the given input that * is needed to populate the smart contracts registration service. * @dev Return a error which is nil if success and otherwise contins an error message. * @return value of 'error'

func StateInstance

func StateInstance(client *ethclient.Client) (*state.State, error)

* Description: Creates a new state connection with an address to a contract to a specific ethereum full node. * @dev Return a connection in the contract through a State struct and error information which is nil if succesfull or error message on fail. * @return value of 'State struct and error'

func Transactor

func Transactor(client *ethclient.Client, key *keystore.Key, ctxBackground context.Context) *bind.TransactOpts

* Description: Sets up transaction data used to interact with a Payable function * on the Ethereum blockchain smart contract. * @dev Return a struct to Options used for a transaction with Ethereum blockchain. * @return value of 'Pointer to a struct of transaction options'

func UserWallet

func UserWallet(password string) *keystore.Key

* Description: Open or creates a keystore through walletExists function and return a path to it * and then reads the key from it throguh ReadKeyStore. * @dev Return a dereferenced pointer to a Key struct from the Ethereum keystore libary. * @return value of 'key struct'

func Verify

func Verify(instance *state.State, transactionData *bind.TransactOpts) bool

* Description: Search all registered user accounts on ethereum address used for identity with * call opts from transaction data and return a boolean value. * @dev Return a bool if user exists and otherwise false. * @return value of 'bool'

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL