diff --git a/README.MD b/README.md similarity index 94% rename from README.MD rename to README.md index b7d3a25..f696054 100644 --- a/README.MD +++ b/README.md @@ -36,21 +36,28 @@ to: Binaries for the latest version of `dkc` can be obtained from [the releases page](https://github.com/p2p-org/dkc/releases/latest). +### Nix + +If you have nix flakes enabled you can run `dkc` using this command: + +```sh +$ nix run github:p2p-org/dkc +``` + ### Source `dkc` can be built locally using the command ```sh -go build . +$ go build . ``` + ## Usage > [!CAUTION] > Before you begin, make sure you backup keys and store recovered wallets and passwords securely. -`dkc` uses [herumi/bls-eth-go-binary](https://github.com/herumi/bls-eth-go-binary). Some research code of using [herumi/bls-eth-go-binary](https://github.com/herumi/bls-eth-go-binary) in `dkc` is available [here](./research/research.go) - -You can test `dkc` on predefiened inputs [here](.github/workflows/func-tests.yml). +`dkc` uses [herumi/bls-eth-go-binary](https://github.com/herumi/bls-eth-go-binary). You can test `dkc` on predefiened inputs [here](.github/workflows/func-tests.yml). ### Config @@ -58,9 +65,9 @@ An example config for each pair could be found [here](.github/examples/) The example below shows how to convert wallets from `distributed` type to `hierarchical deterministic` type. -`Base-dir` for `distributed` wallets is located in `./i_wallet` see more info about `distributed` wallet file structure [here](#distributed) +`base-dir` for `distributed` wallets is located in `./i_wallet` see more info about `distributed` wallet file structure [here](#distributed) -`Base-dir` for `hierarchical deterministic` wallets is located in `./o_wallet` see more info about `hierarchical deterministic` wallet file structure [here](#hierarchical-deterministic) +`base-dir` for `hierarchical deterministic` wallets is located in `./o_wallet` see more info about `hierarchical deterministic` wallet file structure [here](#hierarchical-deterministic) ```yaml input: #Input section diff --git a/nix/package.nix b/nix/package.nix index b40bd68..1f14e7b 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -7,7 +7,7 @@ }: let inherit (inputs'.ethereum-nix.packages) mcl bls; pname = "dkc"; - version = "0.1.1"; + version = "1.0.0"; dkc = pkgs.buildGoModule { inherit pname version; src = ../.; diff --git a/research/docker-compose.yaml b/research/docker-compose.yaml deleted file mode 100644 index 23ef1df..0000000 --- a/research/docker-compose.yaml +++ /dev/null @@ -1,72 +0,0 @@ -version: "3.9" -services: - old1: - image: attestant/dirk - hostname: old1 - restart: always - command: --base-dir /data - volumes: - - type: bind - source: ./podman-data/old/1 - target: /data - read_only: false - old2: - image: attestant/dirk - hostname: old2 - restart: always - command: --base-dir /data - volumes: - - type: bind - source: ./podman-data/old/2 - target: /data - read_only: false - old3: - image: attestant/dirk - hostname: old3 - restart: always - command: --base-dir /data - volumes: - - type: bind - source: ./podman-data/old/3 - target: /data - read_only: false - new1: - image: attestant/dirk - hostname: new1 - restart: always - command: --base-dir /data - volumes: - - type: bind - source: ./podman-data/new/1 - target: /data - read_only: false - new2: - image: attestant/dirk - hostname: new2 - restart: always - command: --base-dir /data - volumes: - - type: bind - source: ./podman-data/new/2 - target: /data - read_only: false - new3: - image: attestant/dirk - hostname: new3 - restart: always - command: --base-dir /data - volumes: - - type: bind - source: ./podman-data/new/3 - target: /data - read_only: false - admin: - image: wealdtech/ethdo - hostname: admin - restart: always - entrypoint: bash -c "sleep 10000" - volumes: - - type: bind - source: ./podman-data/admin - target: /data - read_only: false diff --git a/research/research.go b/research/research.go deleted file mode 100644 index fb1440e..0000000 --- a/research/research.go +++ /dev/null @@ -1,69 +0,0 @@ -// nolint -package main - -import ( - "encoding/binary" - "encoding/hex" - "fmt" - "log" - - "github.com/herumi/bls-eth-go-binary/bls" - // e2wallet "github.com/wealdtech/go-eth2-wallet" - // distributed "github.com/wealdtech/go-eth2-wallet-distributed" - // keystorev4 "github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4" - // filesystem "github.com/wealdtech/go-eth2-wallet-store-filesystem" - // e2wtypes "github.com/wealdtech/go-eth2-wallet-types/v2" -) - -const THRESHOLD = 2 -const PARTICIPANTS = 3 -const KEYSTR = "3eb84bbe03db1c6341c490142a647655f33983ed693d0f43c696ed0378fdc492" - -func newBlsID(id uint64) *bls.ID { - var res bls.ID - buf := [8]byte{} - binary.LittleEndian.PutUint64(buf[:], id) - if err := res.SetLittleEndian(buf[:]); err != nil { - panic(err) - } - return &res -} - -func sample() { - // msg := []byte("Hello") - var mk1 bls.SecretKey - var mk2 bls.SecretKey - mk1_byte, _ := hex.DecodeString("3eb84bbe03db1c6341c490142a647655f33983ed693d0f43c696ed0378fdc492") - mk2_byte, _ := hex.DecodeString("56826b2549ba1c26eb4dcbb73807fc81d49d8c754c4a034a578bd808b0d2f56c") - mk1.Deserialize(mk1_byte) - mk2.Deserialize(mk2_byte) - - fmt.Printf("mk1=%v\nmk2=%v\n", mk1.SerializeToHexStr(), mk2.SerializeToHexStr()) - - masterSKs := []bls.SecretKey{mk1, mk2} - var partSKs []bls.SecretKey - // Generate - for i := 0; i < 3; i++ { - id := newBlsID(uint64(i + 1)) - var sk bls.SecretKey - if err := sk.Set(masterSKs, id); err != nil { - log.Fatalf("Failed to Set secret key: %s", err) - } - partSKs = append(partSKs, sk) - fmt.Printf("partsk[%d]=%v\n", i, sk.SerializeToHexStr()) - } - //Recover - subSKs := []bls.SecretKey{partSKs[0], partSKs[1]} - subIDs := []bls.ID{*newBlsID(1), *newBlsID(2)} - var rk bls.SecretKey - if err := rk.Recover(subSKs, subIDs); err != nil { - } - fmt.Printf("Recovered key=%v\n", rk.SerializeToHexStr()) - -} - -func main() { - bls.Init(bls.BLS12_381) - bls.SetETHmode(bls.EthModeDraft07) - sample() -}