Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Stakedllc/go-eth2-wallet-mpc

 
 

Repository files navigation

go-eth2-wallet-mpc

Tag License GoDoc Travis CI codecov.io Go Report Card

Multi-Party Computation Ethereum 2 wallet.

Table of Contents

Install

go-eth2-wallet-mpc is a standard Go module which can be installed with:

go get github.com/Stakedllc/go-eth2-wallet-mpc

Usage

Access to the wallet is usually via go-eth2-wallet; the first two examples below shows how this can be achieved.

This wallet generates keys non-deterministically, i.e. there is no relationship between keys or idea of a "seed".

Wallet and account names may be composed of any valid UTF-8 characters; the only restriction is they can not start with the underscore (_) character.

Note that although multi-party wallets do not have passphrases they still need to be unlocked before accounts can be created. This can be carried out with walllet.Unlock(nil)

Example

Creating a wallet

package main

import (
	e2wallet "github.com/Stakedllc/go-eth2-wallet"
)

func main() {

    // Create a wallet
    wallet, err := e2wallet.CreateWallet("My wallet", e2wallet.WithType("multi-party"))
    if err != nil {
        panic(err)
    }

    ...
}

Accessing a wallet

package main

import (
	e2wallet "github.com/Stakedllc/go-eth2-wallet"
)

func main() {

    // Open a wallet
    wallet, err := e2wallet.OpenWallet("My wallet")
    if err != nil {
        panic(err)
    }

    ...
}

Creating an account

package main

import (
	e2wallet "github.com/Stakedllc/go-eth2-wallet"
)

func main() {

    // Open a wallet
    wallet, err := e2wallet.OpenWallet("My wallet")
    if err != nil {
        panic(err)
    }

    err = wallet.Unlock(nil)
    if err != nil {
        panic(err)
    }
    // Always immediately defer locking the wallet to ensure it does not remain unlocked outside of the function.
    defer wallet.Lock()
    
    account, err := wallet.CreateAccount("My account", []byte("my account secret"))
    if err != nil {
        panic(err)
    }
    // Wallet should be locked as soon as unlocked operations have finished; it is safe to explicitly call wallet.Lock() as well
    // as defer it as per above.
    wallet.Lock()

    ...
}

Maintainers

Jim McDonald: @mcdee. Max Bucci: @mbucci

Contribute

Contributions welcome. Please check out the issues.

License

Apache-2.0 © 2019 Weald Technology Trading Ltd Apache-2.0 © 2020 Staked Securely LLC

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%