This microservice belonging to Hancock's ecosystem, allows you to send transactions to DLT and to sign the transactions with the help of a sign provider service previously configured.
Hancock is a research product conceived within BBVA New digital business - R&D that provides convenient services to integrate with different DLT networks. We provide simplicity, adaptability and efficiently to develop in any DLT. Hancock can be divided into three main components:
-
DLT Adapter - Keep it simple Interface to abstract interaction with different DLT networks.
-
Wallet Hub - Enroute Interactions Enable connect their signer wallets, or wallet service providers, to the wallet hub, that will then route any ready-to-sign transaction.
-
DLT Broker - Real time notifications Provides a websocket connection that propagates any DLT event the user is subscribed. Thus, provides an interface to easily and efficiently subscribe to blockchain asynchronous events to avoid constant request of status.
-
SDKs - Provides a simplified consumption, minimizing the risk for errors and improving product quality
To be able to sign transactions in blockchain we need a private key. To avoid centralizing the user's private key we need to support different signature providers. In order to have different signature providers, we need to add a service to the system that will allow suppliers to be registered, making it possible for the system to be able to consume them, thus allowing a user to choose their signature provider.able to consume them, thus allowing a user to choose their signature provider.
- Ethereum
- Node.js >= v8.9.3 (npm v5.5.1)
Clone the project:
# Clone the project
git clone https://github.com/BBVA/hancock-wallet-hub.git
cd kst-hancock-ms-dlt-adapter
Once you have downloaded:
# with npm
npm install
nnpm run build:ts
npm run serve:prod
# or using yarn
yarn install
yarn run build:ts
yarn run serve:prod
With docker:
# Build the docker image
docker build -t hancock_wallet_hub .
# Run the docker container
docker run -d -it --name -p 80:80 hancock_wallet_hub_container hancock_wallet_hub
Once the installation of the service have finished, we need to fix some environment vars. You can find all environment vars
available to configure the service in config/custom-environment-variables.yaml
.
An example of configuration of the most important vars:
- Ethereum rpc node:
export HANCOCK_BLOCKCHAIN_ETHEREUM_PROTOCOL="http"
export HANCOCK_BLOCKCHAIN_ETHEREUM_HOST="52.80.128.77"
export HANCOCK_BLOCKCHAIN_ETHEREUM_PORT="34774"
- Mongo ddbb host:
export HANCOCK_DB_HOSTS="localhost:27017"
export HANCOCK_DB_DATABASE="hancock"
export HANCOCK_DB_ETHEREUM_DATABASE="hancock_eth"
Before sign our transactions, we need to insert a new row in mongodb, into "providers" collection with the data of our signer.
- "alias" : "fakeprovider"
- "className" : "FakeProviderSigner"
We have an specific option to configure Cryptvault like our signer, to that end, we need to fill the cryptvault environment vars of the config section.
Wallet-HUB provides some endpoints to interact with the blockchain, allowing send and sing transactions with an external signer to a specific DLT. Take a look at the diferent sections of the API documentation to see examples of use.
If you are thinking about contributing to the project, you should know that:
-
The code has been written following the clean architecture principles, as well as SOLID design principles.
-
The project is built in typescript v2.9.2 using the recommended guidelines. Also there is a linter rules configured to follow this guidelines, so you can search for a plugin for your favourite IDE to be warned about this linter errors. first version of docs