blockchain

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2019 License: MIT Imports: 23 Imported by: 12

Documentation

Index

Constants

View Source
const IpfsPrefix = "ipfs://"

Variables

View Source
var (
	// HashPrefix32Bytes is an Ethereum signature prefix: see https://github.com/ethereum/go-ethereum/blob/bf468a81ec261745b25206b2a596eb0ee0a24a74/internal/ethapi/api.go#L361
	HashPrefix32Bytes = []byte("\x19Ethereum Signed Message:\n32")
)

Functions

func AddressToHex added in v0.1.2

func AddressToHex(address *common.Address) string

AddressToHex converts Ethereum address to hex string representation.

func BytesToBase64 added in v0.1.2

func BytesToBase64(bytes []byte) string

BytesToBase64 converts array of bytes to base64 string.

func ConvertBase64Encoding added in v0.1.3

func ConvertBase64Encoding(str string) ([32]byte, error)

func EstimateGas added in v0.1.2

func EstimateGas(wallet *bind.TransactOpts) (opts *bind.TransactOpts)

func FormatHash added in v0.1.3

func FormatHash(ipfsHash string) string

func HexToAddress added in v0.1.2

func HexToAddress(str string) common.Address

HexToAddress converts hex string to Ethreum address.

func HexToBytes added in v0.1.2

func HexToBytes(str string) []byte

HexToBytes converts hex string to bytes array.

func ParseSignature added in v0.1.2

func ParseSignature(jobSignatureBytes []byte) (uint8, [32]byte, [32]byte, error)

ParseSignature parses Ethereum signature.

func RemoveSpecialCharactersfromHash added in v0.1.3

func RemoveSpecialCharactersfromHash(pString string) string

func SetGas added in v0.1.2

func SetGas(wallet *bind.TransactOpts, gasLimit uint64) (opts *bind.TransactOpts)

func StringToBytes32 added in v0.1.2

func StringToBytes32(str string) [32]byte

Types

type EthereumClient added in v0.1.3

type EthereumClient struct {
	EthClient *ethclient.Client
	RawClient *rpc.Client
}

func GetEthereumClient added in v0.1.3

func GetEthereumClient() (*EthereumClient, error)

func (*EthereumClient) Close added in v0.1.3

func (ethereumClient *EthereumClient) Close()

type MultiPartyEscrowChannel added in v0.1.2

type MultiPartyEscrowChannel struct {
	Sender     common.Address
	Recipient  common.Address
	GroupId    [32]byte
	Value      *big.Int
	Nonce      *big.Int
	Expiration *big.Int
	Signer     common.Address
}

type Processor

type Processor struct {
	// contains filtered or unexported fields
}

func NewProcessor

func NewProcessor(metadata *ServiceMetadata) (Processor, error)

NewProcessor creates a new blockchain processor

func (*Processor) Close added in v0.1.3

func (processor *Processor) Close()

func (*Processor) CurrentBlock added in v0.1.2

func (processor *Processor) CurrentBlock() (currentBlock *big.Int, err error)

func (*Processor) Enabled added in v0.1.2

func (processor *Processor) Enabled() (enabled bool)

func (*Processor) EscrowContractAddress added in v0.1.2

func (processor *Processor) EscrowContractAddress() common.Address

func (*Processor) HasIdentity added in v0.1.3

func (processor *Processor) HasIdentity() bool

func (*Processor) MultiPartyEscrow added in v0.1.2

func (processor *Processor) MultiPartyEscrow() *MultiPartyEscrow

func (*Processor) MultiPartyEscrowChannel added in v0.1.2

func (processor *Processor) MultiPartyEscrowChannel(channelID *big.Int) (channel *MultiPartyEscrowChannel, ok bool, err error)

type ServiceMetadata added in v0.1.2

type ServiceMetadata struct {
	Version                    int      `json:"version"`
	DisplayName                string   `json:"display_name"`
	Encoding                   string   `json:"encoding"`
	ServiceType                string   `json:"service_type"`
	PaymentExpirationThreshold *big.Int `json:"payment_expiration_threshold"`
	ModelIpfsHash              string   `json:"model_ipfs_hash"`
	MpeAddress                 string   `json:"mpe_address"`
	Pricing                    struct {
		PriceModel  string   `json:"price_model"`
		PriceInCogs *big.Int `json:"price_in_cogs"`
	} `json:"pricing"`
	Groups []struct {
		GroupName      string `json:"group_name"`
		GroupID        string `json:"group_id"`
		PaymentAddress string `json:"payment_address"`
	} `json:"groups"`
	Endpoints []struct {
		GroupName string `json:"group_name"`
		Endpoint  string `json:"endpoint"`
	} `json:"endpoints"`
	// contains filtered or unexported fields
}

func GetServiceMetaDataFromIPFS added in v0.1.3

func GetServiceMetaDataFromIPFS(hash string) (*ServiceMetadata, error)

func InitServiceMetaDataFromJson added in v0.1.3

func InitServiceMetaDataFromJson(jsonData string) (*ServiceMetadata, error)

func ServiceMetaData added in v0.1.3

func ServiceMetaData() *ServiceMetadata

func (*ServiceMetadata) GetDaemonEndPoint added in v0.1.3

func (metaData *ServiceMetadata) GetDaemonEndPoint() string

func (*ServiceMetadata) GetDaemonGroupID added in v0.1.3

func (metaData *ServiceMetadata) GetDaemonGroupID() [32]byte

func (*ServiceMetadata) GetDaemonGroupIDString added in v0.1.5

func (metaData *ServiceMetadata) GetDaemonGroupIDString() string

func (*ServiceMetadata) GetDaemonGroupName added in v0.1.3

func (metaData *ServiceMetadata) GetDaemonGroupName() string

func (*ServiceMetadata) GetDisplayName added in v0.1.3

func (metaData *ServiceMetadata) GetDisplayName() string

func (*ServiceMetadata) GetMpeAddress added in v0.1.3

func (metaData *ServiceMetadata) GetMpeAddress() common.Address

func (*ServiceMetadata) GetPaymentAddress added in v0.1.3

func (metaData *ServiceMetadata) GetPaymentAddress() common.Address

func (*ServiceMetadata) GetPaymentExpirationThreshold added in v0.1.3

func (metaData *ServiceMetadata) GetPaymentExpirationThreshold() *big.Int

func (*ServiceMetadata) GetPriceInCogs added in v0.1.3

func (metaData *ServiceMetadata) GetPriceInCogs() *big.Int

func (*ServiceMetadata) GetServiceType added in v0.1.3

func (metaData *ServiceMetadata) GetServiceType() string

func (*ServiceMetadata) GetVersion added in v0.1.3

func (metaData *ServiceMetadata) GetVersion() int

func (*ServiceMetadata) GetWireEncoding added in v0.1.3

func (metaData *ServiceMetadata) GetWireEncoding() string

type SimulatedEthereumEnvironment added in v0.1.2

type SimulatedEthereumEnvironment struct {
	SingnetPrivateKey       *ecdsa.PrivateKey
	SingnetWallet           *bind.TransactOpts
	ClientWallet            *bind.TransactOpts
	ClientPrivateKey        *ecdsa.PrivateKey
	ServerWallet            *bind.TransactOpts
	ServerPrivateKey        *ecdsa.PrivateKey
	Backend                 *backends.SimulatedBackend
	SingularityNetToken     *SingularityNetToken
	MultiPartyEscrowAddress common.Address
	MultiPartyEscrow        *MultiPartyEscrow
}

func GetSimulatedEthereumEnvironment added in v0.1.2

func GetSimulatedEthereumEnvironment() (env SimulatedEthereumEnvironment)

func (*SimulatedEthereumEnvironment) Commit added in v0.1.2

func (*SimulatedEthereumEnvironment) MpeDeposit added in v0.1.2

func (*SimulatedEthereumEnvironment) MpeOpenChannel added in v0.1.2

func (env *SimulatedEthereumEnvironment) MpeOpenChannel(from *bind.TransactOpts, to *bind.TransactOpts, amount int64, expiration int64, groupId [32]byte) *SimulatedEthereumEnvironment

func (*SimulatedEthereumEnvironment) SnetApproveMpe added in v0.1.2

func (*SimulatedEthereumEnvironment) SnetTransferTokens added in v0.1.2

Jump to

Keyboard shortcuts

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