The on- and off-chain pieces of ECDSA keeps and Bonded ECDSA keeps for the Keep network. Builds on top of and requires the core system
See solidity directory.
If you’re on macOS, install Homebrew and run scripts/macos-setup.sh
.
Note that if you don’t have Homebrew or you’re not on macOS, the below
information details what you’ll need. The script additionally sets up
pre-commit hooks.
./scripts/macos-setup.sh
The directory structure used in this Keep repository is very similar to that used in other Go projects:
keep-ecdsa/
Dockerfile
main.go, *.go
docs/
solidity/ (1)
cmd/ (2)
pkg/ (3)
chain/
chain.go, *.go (4)
ethereum/
gen/
gen.go (5)
client/
client.go, *.go
ecdsa/
ecdsa.go, *.go
-
Keep smart contracts are implemented here.
-
Keep subcommands are implemented here, though they should be minimal and deal solely with user interaction. The meat of the commands should exist in a package fit for the appropriate purpose.
-
All additional packages live in
pkg/
. -
The high-level interfaces for a package
mypackage
live inmypackage.go
.chain
is an interface package that expose a common interface to blockchain layer. Its subpackages provide particular implementations. Onlycmd/
and the main package should interact with the implementations directly. -
When a package requires generated code, it should have a subpackage named
gen/
. This subpackage should contain a single file,gen.go
, with a// go:generate
annotation to trigger appropriate code generation. All code generation is done with a single invocation ofgo generate
at build time.
Specifically developer documentation for the various parts of Keep ECDSA.
The smart contracts behind the ECDSA keeps.
They handle creating and managing ECDSA keeps, bridging off-chain secret storage and the public blockchain.
The heart of the ECDSA keep Go client.
It runs hosts ECDSA keep nodes, and participates in keep computations.
Currently the easiest way to build the client is using the
Dockerfile
at the root of the repository. A simple docker build
should get you a functioning container.
To build manually, you’ll need to install jq+
, truffle
, and
npm
. Then you can follow the steps in the next section.
To quickly install and start a single client use the installation script.
To run the script some manual preparation is needed:
-
config file for the single client (default name:
config.toml
), -
npm authorized to access private packages in GitHub’s Package Registry.
Please note that the client config file doesn’t have to be pre-configured with contracts addresses as they will be populated during installation.
The install.sh
script will:
-
fetch external contracts addresses,
-
migrate contracts,
-
build client.
The script will ask you for the password to previously created ethereum accounts.
To start the installation execute:
./scripts/install.sh
The initialize.sh
script should be called after external customer
application contract (i.e. TBTCSystem
) using keep-ecdsa is known.
The script will:
-
set address to the customer application,
-
initialize contracts,
-
update client contracts configuration.
The script will ask for the client config file path.
It also requires an external client application address which is an address of an external contract that will be requesting keeps creation. For local smoke test execution this address should be the same as the account you will use in the smoke test to request keep opening.
To start the initialization execute:
./scripts/initialize.sh
Building keep-ecdsa
requires Go version 1.13 or later.
Dependencies are managed by Modules feature.
configs/config.toml
is default path to the config file. To provide
custom configuration CLI supports --config
flag. Sample
configuration can be found in [config.toml.SAMPLE](configs/config.toml.SAMPLE).
To run a smoke test execute:
cd solidity/
truffle exec integration/smoke_test.js --network local