Skip to content

Commit c2d10ad

Browse files
committed
Merge branch '48-as-a-lisk-user-i-want-to-use-utu-protocol-without-switching-wallets-or-networks' into 'main'
From 48-as-a-lisk-user-i-want-to-use-utu-protocol-without-switching-wallets-or-networks into main Change branches Closes #48 See merge request ututrust/utu-trust-token-solidity!58
2 parents e6f05d0 + 8341408 commit c2d10ad

1 file changed

Lines changed: 4 additions & 158 deletions

File tree

README.md

Lines changed: 4 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -234,167 +234,13 @@ endorsement rewards (see
234234
The following describes how to set up and run a custom Chainlink Oracle node
235235
on AWS.
236236

237-
### Set up a Chainlink Node in AWS
238-
239-
Based on the following sources:
240-
241-
- [Running a Chainlink Node](https://docs.chain.link/docs/running-a-chainlink-node/)
242-
- [Quick Start Reference Deployment](https://aws-quickstart.github.io/quickstart-chainlinklabs-chainlink-node/)
243-
- [Set Up a Chainlink Node on AWS Console | Tutorial](https://www.youtube.com/watch?v=klqQnzBUqUw)
244-
245-
We need to create an EC2 instance:
246-
* 1\. Creating a new instance
247-
* 1.1\. Visit the EC2 dashboard. If there’s a running instance (and it’s dedicated for the chainlink node job), skip to step 2.1. If there’s no such instance, proceed to the next step.
248-
* 1.2\. Click the `Launch instance` button.
249-
* 1.3\. Select `t2.small` instance type.
250-
* 1.4\. Click on the `Review and Launch` button.
251-
* 1.5\. Click on the `Launch` button.
252-
* 1.6\. Set a key pair name.
253-
* 1.7\. If you would like to SSH into the instance later (through your chosen terminal emulator, instead of the AWS web UI), hit the `Download Key Pair` button.
254-
* 1.8\. Click on the `Launch instances` button.
255-
* 1.9\. Click on the `View instances` button, to see the running instances (incl. the one we’ve just launched).
256-
* 2\. Connecting to the instance.
257-
* 2.1\. Click on the instance ID.
258-
* 2.2\. Click on the `Connect` button (it will redirect you to the `Connect to instance` page).
259-
* 2.3\. Click on the `Connect` button (it will open a new terminal session).
260-
* 2.4\. Check if Docker is up-and-running by executing the following command:
237+
### Chainlink Node
261238

262-
```shell
263-
$ systemctl status docker
264-
```
265-
266-
If it’s running, procced to step 2.6. If it’s not, proceed to the next step.
267-
268-
* 2.5\. Since Docker is not set up, you’ll have to manually install and configure it by issuing the following commands:
269-
270-
```shell
271-
$ sudo systemctl start docker
272-
$ sudo gpasswd -a $USER docker
273-
```
274-
275-
* 2.6\. Go ahead and create a directory for the Chainlink node.
276-
277-
```shell
278-
$ mkdir ~/.chainlink
279-
$ cd ~/.chainlink
280-
```
281-
282-
* 2.7\. Create a new .env file inside the directory and fill in the credentials.
283-
284-
```shell
285-
$ vim ~/.chainlink/.env
286-
```
287-
288-
RDS instance:
289-
* 3\. Creating a new database instance.
290-
* 3.1\. Visit the RDS dashboard. If there’s a PostgreSQL instance running (and it’s dedicated for the chainlink node job), skip to step 4.1. If there’s no such instance, proceed to the next step.
291-
* 3.2\. Click on the `Create database` button.
292-
* 3.3\. Select PostgreSQL.
293-
* 3.4\. Select PostgerSQL 14.5 version.
294-
* 3.5\. Select `Free tier` template (if it’s not available, try with different versions and keep in mind that the UI might take several seconds to update the set of available templates).
295-
* 3.6\. Set database identifier, e.g. `chainlink-db`.
296-
* 3.7\. Set master username, e.g. `postgres`.
297-
* 3.8\. Set master password and write it down somewhere safe.
298-
* 3.9\. Disable storage autoscaling by deselecting `Enable storage autoscaling`.
299-
* 3.10\. Click on `Additional configuration`.
300-
* 3.11\. Set your initial database name, e.g. `chainlink-ethereum-db`.
301-
* 3.12\. Disable automatic backups by deselecting `Enable automatic backups`.
302-
* 3.13\. Go ahead and hit `Create database`.
303-
* 4\. Set up database credentials.
304-
* 4.1\. Visit the RDS dashboard.
305-
* 4.2\. Click on the DB identifier, e.g. `chainlink-db`.
306-
* 4.3\. Copy the database endpoint (Connectivity & security panel). If it’s not available, it’s probably because you’ve just created the database and it has not been fully deployed. Take a short break and give it a few minutes.
307-
* 4.4\. Connect to the EC2 instance (as described in steps 2.1/2.2./2.3.)
308-
* 4.5\. Edit `~/.chainlink/.env` (as described in step 2.7) and update the database endpoint (the environment variable is called `DATABASE_URL` and you have to replace all nested variables).
239+
A Dockerfile and accompanying docker-compose.yml are provided under the [chainlink-node](chainlink-node) directory.
309240

310-
```
311-
DATABASE_URL=postgresql://$USERNAME:$PASSWORD@$SERVER:$PORT/$DATABASE
312-
```
313-
314-
`$USERNAME` and `$PASSWORD` have been created in step 3.7.
315-
must be set to the default value of 5432 (unless something else has been set during the database creation).
316-
`$DATABASE` is what we’ve set in step 3.11.
317-
`$SERVER` corresponds to the endpoint we’ve copied in step 4.3.
318-
319-
Docker:
320-
* 5\. Set up the Docker container
321-
* 5.1\. Pull the image from hub.docker.com/r/smartcontract/chainlink.
322-
323-
```shell
324-
$ docker pull smartcontract/chainlink:1.7.1-root
325-
```
326-
327-
* 5.2\. Change your working directory
241+
It automatically creates the correct configuration and jobs, using templates under the [config](chainlink-node/config) and [jobs](chainlink-node/jobs) sub-directories.
328242

329-
```shell
330-
$ cd ~/.chainlink
331-
```
332-
333-
* 5.3\. Start the container.
334-
335-
```shell
336-
$ docker run -p 6688:6688 -v ~/.chainlink:/chainlink -it --env-file=.env smartcontract/chainlink:1.7.1-root local n
337-
```
338-
339-
### Set up a Chainlink Node job
340-
341-
1. Visit `$NODE_ADDRESS:6688` (`$NODE_ADDRESS` is the public IPv4 DNS of your previously configured EC2 instance).
342-
2. Login with your ChainLink node account credentials.
343-
3. Navigate to the jobs page (press the "Jobs" button in the top menu).
344-
4. Press the "New Job" button.
345-
5. Paste the following TOML job specification
346-
6. Replace `REPLACE_WITH_ORACLE_CONTRACT_ADDRESS` with the oracle contract address everywhere specified in the job definition
347-
7. Replace `REPLACE_WITH_UTU_CLIENT_DB_ID` with the utu client db id in the job definition
348-
8. Press Create Job
349-
350-
```toml
351-
type = "directrequest"
352-
schemaVersion = 1
353-
name = "UTT Check Previous Endorsers Job"
354-
contractAddress = "REPLACE_WITH_ORACLE_CONTRACT_ADDRESS"
355-
maxTaskDuration = "0s"
356-
observationSource = """
357-
decode_log [type="ethabidecodelog"
358-
abi="OracleRequest(bytes32 indexed specId, address requester, bytes32 requestId, uint256 payment, address callbackAddr, bytes4 callbackFunctionId, uint256 cancelExpiration, uint256 dataVersion, bytes data)"
359-
data="$(jobRun.logData)"
360-
topics="$(jobRun.logTopics)"]
361-
362-
decode_cbor [type="cborparse" data="$(decode_log.data)"]
363-
364-
decode_log -> decode_cbor -> http
365-
366-
http [type="http"
367-
method=POST
368-
url="http://trust-api-core-service/previousEndorsersRequest"
369-
headers="[\\"UTU-Trust-Api-Client-Id\\", \\"REPLACE_WITH_UTU_CLIENT_DB_ID\\"]"
370-
requestData="{\\"sourceAddress\\": $(decode_cbor.sourceAddress), \\"targetAddress\\": $(decode_cbor.targetAddress), \\"transactionId\\": $(decode_cbor.transactionId)}"
371-
allowUnrestrictedNetworkAccess=true]
372-
373-
firstLevelPreviousEndorsers [type="jsonparse"
374-
data="$(http)"
375-
path="result,firstLevelPreviousEndorsers"]
376-
377-
secondLevelPreviousEndorsers [type="jsonparse"
378-
data="$(http)"
379-
path="result,secondLevelPreviousEndorsers"]
380-
381-
http -> firstLevelPreviousEndorsers -> encode_mwr
382-
http -> secondLevelPreviousEndorsers -> encode_mwr
383-
384-
encode_mwr [type="ethabiencode"
385-
abi="(bytes32 requestId, address[] firstLevelPreviousEndorsers, address[] secondLevelPreviousEndorsers)"
386-
data="{\\"requestId\\": $(decode_log.requestId), \\"firstLevelPreviousEndorsers\\": $(firstLevelPreviousEndorsers), \\"secondLevelPreviousEndorsers\\": $(secondLevelPreviousEndorsers) }"]
387-
388-
encode_tx [type="ethabiencode"
389-
abi="fulfillOracleRequest2(bytes32 requestId, uint256 payment, address callbackAddress, bytes4 callbackFunctionId, uint256 expiration, bytes calldata data)"
390-
data="{\\"requestId\\": $(decode_log.requestId), \\"payment\\": $(decode_log.payment), \\"callbackAddress\\": $(decode_log.callbackAddr), \\"callbackFunctionId\\": $(decode_log.callbackFunctionId), \\"expiration\\": $(decode_log.cancelExpiration), \\"data\\": $(encode_mwr)}"]
391-
392-
submit_tx [type="ethtx" to="REPLACE_WITH_ORACLE_CONTRACT_ADDRESS" data="$(encode_tx)" minConfirmations="2"]
393-
394-
encode_mwr -> encode_tx -> submit_tx
395-
"""
396-
externalJobID = "0eec7e1d-d0d2-476c-a1a8-72dfb6633f48"
397-
```
243+
The Makefile can be used to conveniently build and deploy the docker image.
398244

399245
### Feed contracts with tokens
400246

0 commit comments

Comments
 (0)