Coder Social home page Coder Social logo

dorucioclea / nft-handler Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chaingers-2021/nft-handler

0.0 2.0 0.0 1.47 MB

NFT handler | Chainlink node | ERC1155

Home Page: https://chaingers-2021.github.io/nft-handler/

License: MIT License

Shell 0.56% Solidity 33.47% JavaScript 65.97%

nft-handler's Introduction

HODLTogether NFT Distribution

How to setup chainlink node

Setting up the .env file

  • mkdir ~/.chainlink-kovan

  • touch .env

  • Put this inside your ~/.chainlink-kovan/.env file:

    ROOT=/chainlink
    LOG_LEVEL=debug
    ETH_CHAIN_ID=42
    MIN_OUTGOING_CONFIRMATIONS=2
    LINK_CONTRACT_ADDRESS=0xa36085F69e2889c224210F603D836748e7dC0088
    CHAINLINK_TLS_PORT=0
    SECURE_COOKIES=false
    GAS_UPDATER_ENABLED=true
    ALLOW_ORIGINS=*
    ETH_URL=CHANGEME

Set the local postgres DATABASE_URL Config

  • sudo -i -u postgres
  • psql
  • ALTER USER postgres PASSWORD '12345678'
  • Postges setup:
    username: postgres
    password: postgres
    server: localhost
    port: 5432
    database: postgres
  • Add these to your ~/.chainlink-kovan/.env file:
    DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres
    DATABASE_TIMEOUT=0

Helpful resources

How to start chainlink node?

  • cd ~/.chainlink-kovan
  • docker run --name chainlink-kovan --network host -p 6688:6688 -v ~/.chainlink-kovan:/chainlink -it --env-file=.env smartcontract/chainlink:0.10.3 local n
  • Visit in browser: localhost:6688 and sign in with your credentials
  • docker network ls: make sure host is there.

Stopping & deleting container:

  • docker stop chainlink-kovan && docker container rm chainlink-kovan

Screenshots

How to deploy APIConsumer

  • Assuming that you have successfully setup the chainlink node.

  • truffle compile

  • truffle migrate --reset --network kovan/truffle migrate --f 3 --network kovan(If you update APIConsumer only.)

  • yarn verify

  • truffle exec scripts/1_fund_link.js --network kovan

  • Needs to be done for the first time:

    • truffle exec scripts/2_add_permission.js --network kovan
    • Add a new job from the NODE UI, with job spec from: job_specs/eth=>bool.json & don't forget to copy Oracle address into job_spec
  • truffle exec scripts/3_request.js --network kovan

  • You can see a job assingned in the node operator browser window:

    • as it will succeed, check the transaction hash for any errors
  • truffle exec scripts/4_read_val.js --network kovan

  • node help/postgres.check.js: Check postgres connection & NODE funds

How to run local express server

  • yarn server: Start in dev mode
  • yarn start: Start in prod mode
  • Open a query like: [http://localhost:5000/check/nft/0xcfdf8fffaa4dd7d777d448cf93dd01a45e97d782/LINK]

ENV variables for the project

A template of .env file is already given as .env.example, set them accordingly:

LINK_CONTRACT_ADDRESS="..."
RPC_URL="..."
MNEMONIC="..."
NODE_ADDRESS="..."
JOB_ID="..."
ETHERSCAN_API_KEY="..."

Directory structure

pam@g3:~/cl-node$ tree -I 'node_modules|build'
.
├── contracts
│   ├── Distributor
│   │   ├── APIConsumer.sol
│   │   └── TokenHandler.sol
│   ├── ERC1155
│   │   └── Token.sol
│   └── Migrations.sol
├── help
│   ├── node.info.js
│   ├── postgres.check.js
│   └── query.js
├── index.js
├── job_specs
│   └── eth=>bool.json
├── migrations
│   ├── 1_initial_migration.js
│   ├── 2_oracle.js
│   ├── 3_token.js
│   └── 4_testnet_consumer.js
├── package.json
├── README.md
├── scripts
│   ├── 1_fund_link.js
│   ├── 2_add_permission.js
│   ├── 3_request.js
│   └── 4_read_val.js
├── truffle-config.js
└── yarn.lock

7 directories, 21 files

Deployments

nft-handler's People

Contributors

anupam-io avatar shanzson avatar dependabot[bot] avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.