Documentation ¶
Index ¶
- func NewPrivateExtensionProxyAPI(privacyService *PrivacyService) interface{}
- func NewSubscriptionHandler(node *node.Node, psi types.PrivateStateIdentifier, ...) *subscriptionHandler
- type APIBackendHelper
- type ChainAccessor
- type Client
- type DataHandler
- type DefaultServicesFactory
- type EthclientManagementContractFacade
- func (facade EthclientManagementContractFacade) Caller(managementAddress common.Address) (*extensionContracts.ContractExtenderCaller, error)
- func (facade EthclientManagementContractFacade) Close()
- func (facade EthclientManagementContractFacade) Deploy(args *bind.TransactOpts, toExtend common.Address, ...) (*types.Transaction, error)
- func (facade EthclientManagementContractFacade) GetAllVoters(addressToVoteOn common.Address) ([]common.Address, error)
- func (facade EthclientManagementContractFacade) Transactor(managementAddress common.Address) (*extensionContracts.ContractExtenderTransactor, error)
- type ExtensionContract
- type InProcessClient
- func (client *InProcessClient) Close()
- func (client *InProcessClient) NextNonce(from common.Address) (uint64, error)
- func (client *InProcessClient) SubscribeToLogs(query ethereum.FilterQuery) (<-chan types.Log, ethereum.Subscription, error)
- func (client *InProcessClient) TransactionByHash(hash common.Hash) (*types.Transaction, error)
- func (client *InProcessClient) TransactionInBlock(blockHash common.Hash, txIndex uint) (*types.Transaction, error)
- type JsonFileDataHandler
- type ManagementContractFacade
- type PrivacyService
- func (service *PrivacyService) CheckIfContractCreator(blockHash common.Hash, address common.Address, ...) bool
- func (service *PrivacyService) GenerateTransactOptions(txa ethapi.SendTxArgs) (*bind.TransactOpts, error)
- func (service *PrivacyService) GetAllParticipants(blockHash common.Hash, address common.Address, ...) ([]string, error)
- func (service *PrivacyService) Start() error
- func (service *PrivacyService) Stop() error
- type PrivateExtensionAPI
- func (api *PrivateExtensionAPI) ActiveExtensionContracts(ctx context.Context) []ExtensionContract
- func (api *PrivateExtensionAPI) ApproveExtension(ctx context.Context, addressToVoteOn common.Address, vote bool, ...) (string, error)
- func (api *PrivateExtensionAPI) CancelExtension(ctx context.Context, extensionContract common.Address, txa ethapi.SendTxArgs) (string, error)
- func (api *PrivateExtensionAPI) ExtendContract(ctx context.Context, toExtend common.Address, newRecipientPtmPublicKey string, ...) (string, error)
- func (api *PrivateExtensionAPI) GetExtensionStatus(ctx context.Context, extensionContract common.Address) (string, error)
- type PrivateExtensionProxyAPI
- func (api *PrivateExtensionProxyAPI) ActiveExtensionContracts(ctx context.Context) []ExtensionContract
- func (api *PrivateExtensionProxyAPI) ApproveExtension(ctx context.Context, addressToVoteOn common.Address, vote bool, ...) (string, error)
- func (api *PrivateExtensionProxyAPI) CancelExtension(ctx context.Context, extensionContract common.Address, txa ethapi.SendTxArgs) (string, error)
- func (api *PrivateExtensionProxyAPI) ExtendContract(ctx context.Context, toExtend common.Address, newRecipientPtmPublicKey string, ...) (string, error)
- type ServicesFactory
- type StateFetcher
- func (fetcher *StateFetcher) GetAddressStateFromBlock(blockHash common.Hash, addressToFetch common.Address, ...) ([]byte, error)
- func (fetcher *StateFetcher) GetPrivacyMetaData(blockHash common.Hash, address common.Address, ...) (*state.PrivacyMetadata, error)
- func (fetcher *StateFetcher) GetStorageRoot(blockHash common.Hash, address common.Address, ...) (common.Hash, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPrivateExtensionProxyAPI ¶
func NewPrivateExtensionProxyAPI(privacyService *PrivacyService) interface{}
func NewSubscriptionHandler ¶
func NewSubscriptionHandler(node *node.Node, psi types.PrivateStateIdentifier, ptm private.PrivateTransactionManager, service *PrivacyService) *subscriptionHandler
Types ¶
type APIBackendHelper ¶
type APIBackendHelper interface { AccountExtraDataStateGetterByNumber(ctx context.Context, number rpc.BlockNumber) (vm.AccountExtraDataStateGetter, error) PSMR() mps.PrivateStateMetadataResolver CurrentBlock() *types.Block SupportsMultitenancy(rpcCtx context.Context) (*proto.PreAuthenticatedAuthenticationToken, bool) IsPrivacyMarkerTransactionCreationEnabled() bool }
Only extract required methods from EthAPIBackend
type ChainAccessor ¶
type ChainAccessor interface { // GetBlockByHash retrieves a block from the local chain. GetBlockByHash(common.Hash) *types.Block StateAt(root common.Hash) (*state.StateDB, mps.PrivateStateRepository, error) StateAtPSI(root common.Hash, psi types.PrivateStateIdentifier) (*state.StateDB, *state.StateDB, error) State() (*state.StateDB, mps.PrivateStateRepository, error) CurrentBlock() *types.Block }
ChainAccessor provides methods to fetch state and blocks from the local blockchain
type Client ¶
type Client interface { SubscribeToLogs(query ethereum.FilterQuery) (<-chan types.Log, ethereum.Subscription, error) NextNonce(from common.Address) (uint64, error) TransactionByHash(hash common.Hash) (*types.Transaction, error) TransactionInBlock(blockHash common.Hash, txIndex uint) (*types.Transaction, error) Close() }
type DataHandler ¶
type DataHandler interface { Load() (map[types.PrivateStateIdentifier]map[common.Address]*ExtensionContract, error) Save(extensionContracts map[types.PrivateStateIdentifier]map[common.Address]*ExtensionContract) error }
type DefaultServicesFactory ¶
type DefaultServicesFactory struct {
// contains filtered or unexported fields
}
func NewServicesFactory ¶
func NewServicesFactory(stack *node.Node, ptm private.PrivateTransactionManager, ethService *eth.Ethereum) (*DefaultServicesFactory, error)
func (*DefaultServicesFactory) AccountManager ¶
func (factory *DefaultServicesFactory) AccountManager() *accounts.Manager
func (*DefaultServicesFactory) DataHandler ¶
func (factory *DefaultServicesFactory) DataHandler() DataHandler
func (*DefaultServicesFactory) StateFetcher ¶
func (factory *DefaultServicesFactory) StateFetcher() *StateFetcher
type EthclientManagementContractFacade ¶
type EthclientManagementContractFacade struct {
// contains filtered or unexported fields
}
func (EthclientManagementContractFacade) Caller ¶
func (facade EthclientManagementContractFacade) Caller(managementAddress common.Address) (*extensionContracts.ContractExtenderCaller, error)
func (EthclientManagementContractFacade) Close ¶
func (facade EthclientManagementContractFacade) Close()
func (EthclientManagementContractFacade) Deploy ¶
func (facade EthclientManagementContractFacade) Deploy(args *bind.TransactOpts, toExtend common.Address, recipientAddress common.Address, recipientHash string) (*types.Transaction, error)
func (EthclientManagementContractFacade) GetAllVoters ¶
func (EthclientManagementContractFacade) Transactor ¶
func (facade EthclientManagementContractFacade) Transactor(managementAddress common.Address) (*extensionContracts.ContractExtenderTransactor, error)
type ExtensionContract ¶
type ExtensionContract struct { ContractExtended common.Address `json:"contractExtended"` Initiator common.Address `json:"initiator"` Recipient common.Address `json:"recipient"` ManagementContractAddress common.Address `json:"managementContractAddress"` RecipientPtmKey string `json:"recipientPtmKey"` CreationData []byte `json:"creationData"` }
type InProcessClient ¶
type InProcessClient struct {
// contains filtered or unexported fields
}
func NewInProcessClient ¶
func NewInProcessClient(client *ethclient.Client) *InProcessClient
func (*InProcessClient) Close ¶
func (client *InProcessClient) Close()
func (*InProcessClient) NextNonce ¶
func (client *InProcessClient) NextNonce(from common.Address) (uint64, error)
func (*InProcessClient) SubscribeToLogs ¶
func (client *InProcessClient) SubscribeToLogs(query ethereum.FilterQuery) (<-chan types.Log, ethereum.Subscription, error)
func (*InProcessClient) TransactionByHash ¶
func (client *InProcessClient) TransactionByHash(hash common.Hash) (*types.Transaction, error)
func (*InProcessClient) TransactionInBlock ¶
func (client *InProcessClient) TransactionInBlock(blockHash common.Hash, txIndex uint) (*types.Transaction, error)
type JsonFileDataHandler ¶
type JsonFileDataHandler struct {
// contains filtered or unexported fields
}
func NewJsonFileDataHandler ¶
func NewJsonFileDataHandler(dataDirectory string) *JsonFileDataHandler
func (*JsonFileDataHandler) Load ¶
func (handler *JsonFileDataHandler) Load() (map[types.PrivateStateIdentifier]map[common.Address]*ExtensionContract, error)
The strategy when loading the save file is too check if the newer "psiContracts" field is present. If so, then everything should exist under that key, and so we can unmarshal and return immediately.
If not, then the save file was made from a previous version. Load up all the data as before and put it under the "private" PSI.
It should never be the case the file contains both types of data at once.
func (*JsonFileDataHandler) Save ¶
func (handler *JsonFileDataHandler) Save(extensionContracts map[types.PrivateStateIdentifier]map[common.Address]*ExtensionContract) error
type ManagementContractFacade ¶
type ManagementContractFacade interface { Transactor(managementAddress common.Address) (*extensionContracts.ContractExtenderTransactor, error) Caller(managementAddress common.Address) (*extensionContracts.ContractExtenderCaller, error) Deploy(args *bind.TransactOpts, toExtend common.Address, recipientAddress common.Address, recipientHash string) (*types.Transaction, error) GetAllVoters(addressToVoteOn common.Address) ([]common.Address, error) Close() }
func NewManagementContractFacade ¶
func NewManagementContractFacade(client *ethclient.Client) ManagementContractFacade
type PrivacyService ¶
type PrivacyService struct {
// contains filtered or unexported fields
}
func New ¶
func New(stack *node.Node, ptm private.PrivateTransactionManager, manager *accounts.Manager, handler DataHandler, fetcher *StateFetcher, apiBackendHelper APIBackendHelper, config *params.ChainConfig) (*PrivacyService, error)
func (*PrivacyService) CheckIfContractCreator ¶
func (service *PrivacyService) CheckIfContractCreator(blockHash common.Hash, address common.Address, psi types.PrivateStateIdentifier) bool
check if the node had created the contract
func (*PrivacyService) GenerateTransactOptions ¶
func (service *PrivacyService) GenerateTransactOptions(txa ethapi.SendTxArgs) (*bind.TransactOpts, error)
func (*PrivacyService) GetAllParticipants ¶
func (service *PrivacyService) GetAllParticipants(blockHash common.Hash, address common.Address, psi types.PrivateStateIdentifier) ([]string, error)
returns the participant list for a given private contract
func (*PrivacyService) Start ¶
func (service *PrivacyService) Start() error
func (*PrivacyService) Stop ¶
func (service *PrivacyService) Stop() error
type PrivateExtensionAPI ¶
type PrivateExtensionAPI struct {
// contains filtered or unexported fields
}
func NewPrivateExtensionAPI ¶
func NewPrivateExtensionAPI(privacyService *PrivacyService) *PrivateExtensionAPI
func (*PrivateExtensionAPI) ActiveExtensionContracts ¶
func (api *PrivateExtensionAPI) ActiveExtensionContracts(ctx context.Context) []ExtensionContract
ActiveExtensionContracts returns the list of all currently outstanding extension contracts
func (*PrivateExtensionAPI) ApproveExtension ¶
func (api *PrivateExtensionAPI) ApproveExtension(ctx context.Context, addressToVoteOn common.Address, vote bool, txa ethapi.SendTxArgs) (string, error)
ApproveContractExtension submits the vote to the specified extension management contract. The vote indicates whether to extend a given contract to a new participant or not
func (*PrivateExtensionAPI) CancelExtension ¶
func (api *PrivateExtensionAPI) CancelExtension(ctx context.Context, extensionContract common.Address, txa ethapi.SendTxArgs) (string, error)
CancelExtension allows the creator to cancel the given extension contract, ensuring that no more calls for votes or accepting can be made
func (*PrivateExtensionAPI) ExtendContract ¶
func (api *PrivateExtensionAPI) ExtendContract(ctx context.Context, toExtend common.Address, newRecipientPtmPublicKey string, recipientAddr common.Address, txa ethapi.SendTxArgs) (string, error)
ExtendContract deploys a new extension management contract to the blockchain to start the process of extending a contract to a new participant Create a new extension contract that signifies that we want to add a new participant to an existing contract This should contain: - arguments for sending a new transaction (the same as sendTransaction) - the contract address we want to extend - the new PTM public key - the Ethereum addresses of who can vote to extend the contract
func (*PrivateExtensionAPI) GetExtensionStatus ¶
func (api *PrivateExtensionAPI) GetExtensionStatus(ctx context.Context, extensionContract common.Address) (string, error)
Returns the extension status from management contract
type PrivateExtensionProxyAPI ¶
type PrivateExtensionProxyAPI struct { PrivateExtensionAPI // contains filtered or unexported fields }
func (*PrivateExtensionProxyAPI) ActiveExtensionContracts ¶
func (api *PrivateExtensionProxyAPI) ActiveExtensionContracts(ctx context.Context) []ExtensionContract
ActiveExtensionContracts returns the list of all currently outstanding extension contracts
func (*PrivateExtensionProxyAPI) ApproveExtension ¶
func (api *PrivateExtensionProxyAPI) ApproveExtension(ctx context.Context, addressToVoteOn common.Address, vote bool, txa ethapi.SendTxArgs) (string, error)
ApproveContractExtension submits the vote to the specified extension management contract. The vote indicates whether to extend a given contract to a new participant or not
func (*PrivateExtensionProxyAPI) CancelExtension ¶
func (api *PrivateExtensionProxyAPI) CancelExtension(ctx context.Context, extensionContract common.Address, txa ethapi.SendTxArgs) (string, error)
func (*PrivateExtensionProxyAPI) ExtendContract ¶
type ServicesFactory ¶
type ServicesFactory interface { AccountManager() *accounts.Manager DataHandler() DataHandler StateFetcher() *StateFetcher }
type StateFetcher ¶
type StateFetcher struct {
// contains filtered or unexported fields
}
StateFetcher manages retrieving state from the database and returning it in a usable form by the extension API.
func NewStateFetcher ¶
func NewStateFetcher(chainAccessor ChainAccessor) *StateFetcher
Creates a new StateFetcher from the ethereum service
func (*StateFetcher) GetAddressStateFromBlock ¶
func (fetcher *StateFetcher) GetAddressStateFromBlock(blockHash common.Hash, addressToFetch common.Address, psi types.PrivateStateIdentifier) ([]byte, error)
GetAddressStateFromBlock is a public method that combines the other functions of a StateFetcher, retrieving the state of an address at a given block, represented in JSON.
func (*StateFetcher) GetPrivacyMetaData ¶
func (fetcher *StateFetcher) GetPrivacyMetaData(blockHash common.Hash, address common.Address, psi types.PrivateStateIdentifier) (*state.PrivacyMetadata, error)
returns the privacy metadata
func (*StateFetcher) GetStorageRoot ¶
func (fetcher *StateFetcher) GetStorageRoot(blockHash common.Hash, address common.Address, psi types.PrivateStateIdentifier) (common.Hash, error)
returns the privacy metadata