# Install Postgres [Ubuntu] ```sh sudo apt install postgresql postgresql-contrib sudo -u postgres psql > CREATE DATABASE chainlink; > CREATE USER smartpy WITH ENCRYPTED PASSWORD '5martpy!'; > GRANT ALL PRIVILEGES ON DATABASE chainlink TO smartpy; ``` ### Tunnel posgres to your machine ssh root@alt.smartpy.io -L 5433:localhost:5433 # Install ChainLink Node ```sh # Install Docker curl -sSL https://get.docker.com/ | sh # Create chainlink folder mkdir ~/.chainlink # Setup Environment variables echo "ROOT=/chainlink FEATURE_EXTERNAL_INITIATORS=true DATABASE_URL=postgresql://smartpy:smartpy@localhost:5433/chainlink LOG_LEVEL=debug MIN_OUTGOING_CONFIRMATIONS=2 LINK_CONTRACT_ADDRESS=0x20fE562d797A42Dcb3399062AE9546cd06f63280 CHAINLINK_TLS_PORT=0 SECURE_COOKIES=false GAS_UPDATER_ENABLED=true ALLOW_ORIGINS=*" > ~/.chainlink-ropsten/.env ``` ``` docker run --name chainlink -d -p 6688:6688 -v ~/.chainlink-ropsten:/chainlink -it --network host --env-file=.chainlink/.env smartcontract/chainlink local n -p /chainlink/.password -a /chainlink/.api ``` ### Get the access tokens ```sh docker exec -it chainlink bash chainlink admin login chainlink initiators create chain-init http://localhost:8080/jobs ``` # Run initiator ``` ### Start the external-initiator /root/go/bin/external-initiator "{\"name\":\"xtz-delphinet\",\"type\":\"tezos\",\"url\":\"https://delphinet.smartpy.io\"}" --databaseurl postgresql://smartpy:smartpy@localhost:5433/ei --ic_accesskey cef6f7cf40d74b02b63adc251c663b3d --ic_secret LxuVPHQzx1/aZgqTtYlTH9sMJx/1J87WF2rxYwAKzT74yoaIxx2ZStImW46XYfsw --ci_accesskey nty2xKiZ11qVJ20Z/fQnUWNwYTevOkCPStJ3QFgTGAZxO+OhmEe3YyFUmdfH2Jhc --ci_secret GOlgdHf5Gec62KlJtNUdGBaIamQU3eYx9kr9jJNLSwmL9M0HbNmR3Q3x6H3N/Ag7 ``` # Initiator (job spec) ``` { "initiators": [ { "type": "external", "params": { "name": "chain-init", "body": { "endpoint": "xtz-delphinet", "addresses": ["KT1RnaTRiJH9fuhhbn2pW4jBKAagXo5AdS4v"] } } } ], "tasks": [ { "type": "tezos-adapter" } ] } ``` # Oracle one (job spec) ``` { "initiators": [ { "type": "external", "params": { "name": "chain-init", "body": { "endpoint": "xtz-delphinet", "addresses": ["<KT1TgGaskjRMqBHyXji2oYbWd6t7SvfjNzKY> change me"] } } } ], "tasks": [ { "type": "oracle-b", "params": { "address": "<KT1TgGaskjRMqBHyXji2oYbWd6t7SvfjNzKY> change me" } } ] } ``` # Oracle two (job spec) ``` { "initiators": [ { "type": "cron", "params": { "schedule": "CRON_TZ=UTC */1 * * * *" } } ], "tasks": [ { "type": "aggregator", "params": { "address": "<KT1EpD9SBVHYw6L7CeTQ7BsP6cBziwFwxfNr> change me" } } ] } ``` # Other things Folder `adapters` contains 1 initiator and 2 oracles. We have an example of them working here: http://alt.smartpy.io:4000 Our tezos adapter can be found here: https://github.com/RomarQ/chainlink-tezos-adapter-js