How to run a Chainlink Node and Postgres Database with Docker

Problem Statement:

You want to setup a Chainlink Node quickly with Docker and without paying additional fees for a cloud based Postgres database service, e.g. on on the Google Cloud Platform (GCP)?

Solution:

You can achieve this by running the Chainlink Node itself and also its PostgreSQL database in separate Docker containers.
Watch this YouTube video and see how to setup Chainlink and its PostgreSQL Database with Docker:

With this approach you can save the fees for the database service and you also can save time by utilizing a Container Optimized OS (COS) – Image with Docker already preinstalled.

Follow this 10 steps process to setup the Chainlink Node and its PostgreSQL database with Docker :

  1. Create a VM instance on the Google Cloud Platform (GCP). Choose a machine type with at least 2GB of memory and change the boot disk from Debian to Container Optimized OS. Then create the instance and SSH into it.
  2. Create the directories for the Chainlink Database and the Chainlink Node:
    mkdir -p chainlink/db
    mkdir -p chainlink/chainlink_rinkeby
  3. Create the container for the PostgreSQL database
    docker run --name postgres-chainlink -v $HOME/chainlink/db:/var/lib/postgresql/data -e POSTGRES_PASSWORD=myPostgresPW -d -p 5432:5432 postgres:11.12
  4. Create the chainlink Postgres user in postgres database container:
    docker exec -it postgres-chainlink psql -U postgres -c "CREATE USER chainlink WITH PASSWORD 'myChainlinkPW';"
  5. Create the Chainlink Database (for the Rinkeby test-network in this sample)
    docker exec -it postgres-chainlink psql -U postgres -c "CREATE DATABASE "chainlink_rinkeby";"
  6. Grant the provilieges to the chainlink user
    docker exec -it postgres-chainlink psql -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE "chainlink_rinkeby" TO chainlink;"
  7. Create the .env file for the chainlink node and refer to the required Ethereum network and to our new Postgres Database
    vi chainlink/chainlink_rinkeby/.env

    and enter

    ROOT=/chainlink
    LOG_LEVEL=debug
    ETH_CHAIN_ID=4
    MIN_OUTGOING_CONFIRMATIONS=2
    LINK_CONTRACT_ADDRESS=0x01BE23585060835E02B77ef475b0Cc51aA1e0709
    CHAINLINK_TLS_PORT=0
    SECURE_COOKIES=false
    GAS_UPDATER_ENABLED=true
    ALLOW_ORIGINS=*
    ETH_URL=wss://rinkeby.infura.io/ws/v3/<YOUR_INFURA_PROJECT_ID>
    DATABASE_URL=postgresql://chainlink:myChainlinkPW@localhost:5432/chainlink_rinkeby?sslmode=disable

    For this demo we use Infura as external provider for the connectivity to the Ethereum blockchain.
    If you want to use Infura as well, make sure that you adapt the Infura Project ID accordingly.

    Also make sure that you use the same Chainlink Postgres password here that you have used to create the Chainlink Postgres User before.

  8. Create the .password file which holds the password for your node wallet
    vi chainlink/chainlink_rinkeby/.password

    Enter your password for your node wallet. This password
    – must be longer than 12 characters
    – must contain at least 3 uppercase characters
    – must contain at least 3 numbers
    – must contain at least 3 symbols

  9. Create the .api file which holds the credentials for the GUI interface of the node
    vi chainlink/chainlink_rinkeby/.api

    and enter your email address and password. This password must be 8 to 50 characters.

    <YOUR_EMAIL_ADDRESS>
    <YOUR_NODE_GUI_PASSWORD>

  10. Now we can create the container for the chainlink node itself
    docker run --name chainlink_rinkeby --network host -p 6688:6688 -v $HOME/chainlink/chainlink_rinkeby:/chainlink -it --env-file=$HOME/chainlink/chainlink_rinkeby/.env smartcontract/chainlink:0.10.8 local n -p /chainlink/.password -a /chainlink/.api

    Note that we have added “–network host” to the command since we run the database locally from the node’s perspective.

Access the GUI of your new Chainlink node:

  1. Open a command prompt on our local machine and authenticate with gcloud, in order to be able to access the GUI of your new Chainlink Node
    gcloud auth login

    Note: Alternatively you can download and authenticate with your API keys

  2. Create a SSH tunnel for port 6688
    gcloud compute ssh instance-1 --project <YOUR_GCP_PROJECT_ID> --zone=<YOUR_GCP_ZONE> -- -L 6688:localhost:6688

 

Maintenance – How to stop and start your chainlink containers from your VM SSH shell:

Stop and start the PostgresSQL Database container:

docker stop postgres-chainlink
docker start postgres-chainlink

Stop and start the Chainlink Node container:

docker stop chainlink_rinkeby
docker start chainlink_rinkeby

(Start and attach: docker start -i chainlink_rinkeby)

Detach from and attach to the Chainlink Node container:

Ctrl-PQ
docker attach chainlink_rinkeby

Need further support or consulting?

Please checkout our Consulting hours.

 

 

Global Tax Blockchain Link: Live Demo and Architectural Overview

How Google Maps interacts with the Ethereum Blockchain to display global indirect tax rates. 

In this video we show you how Google Maps receives global indirect tax rates for VAT, GST and US Sales Tax through the Global Tax Blockchain Link from Blue Antoinette and GT4M. Be prepared for deep insights into the architecture behind the scenes, like the Ethereum Blockchain, Web3,js and Chainlink.

Blue Antoinette to Launch a Chainlink Node

Blue Antoinette to Launch a Chainlink Node to Make Global Tax Solutions Available to Smart Contracts

 

With the rapid increase in financial applications being launched on blockchain-based smart contract platforms, there is increasing demand for tax information from developers building these “DeFi” products. This is especially important for organizations that want to sell their products via public blockchains and decentralized platforms and to accept cryptocurrencies under applicable law.

In order to service this new and growing demand, we are pleased to announce that Blue Antoinette will launch our own official Chainlink oracle node to make Global Tax solutions (GT4M) available to smart contracts. The Chainlink node provides us with a universal gateway for getting our existing APIs blockchain-enabled across the leading smart contract platforms. By doing so, we can provide our tax data and solutions directly to blockchain applications, as well as sign our data on-chain using a unique cryptographic signature (private key) to prove that all data submitted by our node is tamperproof and directly from Blue Antoinette.

 

Our Chainlink node, which runs on the most widely used oracle network in the industry, gives developers across various blockchains access to our entire suite APIs. Not only does this exposure to new markets enhance our ability to earn more revenue, but businesses will be able to build innovative solutions on the blockchain under consideration of potential tax relevant information. This helps fill a needed gap in automated on-chain tax services and enables an entirely new crop of applications to emerge that require financial compliance as a foundational primitive.

 

Building Tax-Compliant Smart Contracts Using Blue Antoinette and Chainlink

Our Global Tax Rate APIs (GT4M) allow businesses to build on-chain applications that calculate indirect taxes in real-time based on combining up-to-date tax rates with on-chain financial transactions. Using the GT4M solution, financial services providers, merchants or marketplaces can define global tax rules for VAT, sales tax, GST, and any other indirect taxes. This allows businesses to build tax-compliant eCommerce solutions that utilize smart contract backends and dApp developers to build on-chain tax services specifically tailored for DeFi.

While there are numerous possibilities around automated on-chain tax compliance, there is a fundamental limitation, smart contracts cannot natively make API calls to external systems. Thus, smart contracts cannot not access current tax rate data. In order to overcome this, smart contracts need to make use of a blockchain oracle, which retrieves external data, attest to its validity, and broadcast it on the blockchain for consumption. 

Upon reviewing various oracle solutions, we identified Chainlink as providing the most extensive set of capabilities towards maximizing our ability to monetize GT4M usage within the smart contract economy. Some of the key features of being a node operator on the Chainlink Network include:

  • Data Signing – the Chainlink node cryptographically signs every piece of data it posts on-chain, allowing us to provide clear proof that the data originated from our API. 
  • Blockchain and API Agnostic – Chainlink nodes can integrate with any blockchain and API, providing us with a single gateway to sell our data to all blockchains and from any API that exists both now and in the future.
  • Large Addressable Market – The Chainlink Network is the most widely used oracle solution in the smart contract economy, presenting us with a large and growing market of potential users that include large and small projects alike.
  • Time-Tested Infrastructure – Chainlink is thoroughly audited open-source software that collectively secures billions of dollars in value on mainnet, proving its ability to protect and trigger the movement of real economic value.

These are just a few of the many reasons why we are confident in the Chainlink Network and look forward to joining its fast-growing ecosystem. A parallel financial system is being built using a new tech stack: blockchains, smart contracts and oracles. Through Chainlink we can take an active role in its provisioning by supplying tax data directly to developers building next generation applications on it, both expanding our own addressable market and supporting the creation of new financial products.

“The rapid increase in DeFi development and adoption is putting increasing demands on tax solutions to service the wide variety of unique financial applications being deployed,” said Blue Antoinette CEO Robert Schmid. “Running our own Chainlink node allows Blue Antoinette to be directly involved via providing key tax data solutions to businesses, developers and/or applications, ultimately empowering more efficient ways to automate compliance on-chain across different jurisdictions.”

 

About Chainlink

Chainlink is the most widely used and secure way to power universally connected smart contracts. With Chainlink, developers can connect any blockchain with high-quality data sources from other blockchains as well as real-world data. Managed by a global, decentralized community of hundreds of thousands of people, Chainlink is introducing a fairer model for contracts. Its network currently secures billions of dollars in value for smart contracts across the decentralized finance (DeFi), insurance and gaming ecosystems, among others.

Chainlink is trusted by hundreds of organizations to deliver definitive truth via secure, reliable data feeds. To learn more, visit chain.link, subscribe to the Chainlink newsletter, and follow @chainlink on Twitter.
Docs | Discord | Reddit | YouTube | Telegram | Events | GitHub | Price Feeds | DeFi | VRF

 

About Blue Antoinette:

Blue Antoinette is a diversified technology group. It provides Global Tax Solutions, a Commerce Cloud, an Online Marketplace, highly specialized software and global services.
To learn more visit blueantoinette.com and gt4m.com and subscribe to the Blue Antoinette newsletter