# groups gitlab-runner
gitlab-runner : gitlab-runner



# usermod -a -G root gitlab-runner



# groups gitlab-runner
gitlab-runner : gitlab-runner root

 

'시스템' 카테고리의 다른 글

ipfs 사용법  (0) 2021.12.06
gitlab ci Docker 연동(React)  (0) 2021.11.24
gitlab ci Docker 연동(nodejs)  (2) 2021.08.23
Configuring tzdata Dockerfile  (0) 2021.07.27
방화벽 설정  (0) 2020.10.26
블로그 이미지

iesay

,

구현 환경  : AWS(ubuntu 20.04) , nodejs

 

출처 : 

[GitLab CI] docker gitlab-runner 등록 및 간단 예제 (tistory.com)

https://www.devopsschool.com/blog/setup-docker-service-to-use-insecurehttp-registry-instead-of-https/

https://hihellloitland.tistory.com/65

https://hihellloitland.tistory.com/63

https://otrodevym.tistory.com/474

https://not-to-be-reset.tistory.com/326

https://gitlab.com/gitlab-org/gitlab-runner/-/issues/5026

 

-  Docker  private registry 설치

우분투 초기 이미지 업데이트 레포 찾음 
apt update

도커 컴포저 설치 
apt install docker-compose

도커 레지스트리 설치 
docker pull registry:latest


레지스트리 이미지 구동
docker run --name local-registry -d --restart=always -p 5000:5000 -v /data/registry:/var/lib/registry/docker/registry/v2 registry:latest





빨간색 처럼 private repo 컨테이너 올라가면  실패 재설치

아래 그림처럼 올라가면 성공

 

 

본인이 구축할 private repo IP주소를 작성하면 됩니다.

push시 https만 허용만 가능하여 이렇게 강제로 설정해 줍니다.

 

vi /etc/docker/daemon.json

{

"insecure-registries" : ["13.125.27.25:5000"]

}

 

도커 재 실행 

service docker restart

 

- 방화벽 오픈 (5000, 8900번)

윈도우 도스창에서
telnet  xxx.xxx.xxx.xxx 5000
제대로 접근 가능한지 확인

##############################################################################

-  Gitlab runnuer 설치

 

mkdir -p /opt/gopath/src/gitlab/

cd /opt/gopath/src/gitlab/

vi docker-compose.gitlab.runner.yml 파일 생성

gitlab-runner:
 container_name: gitlab-runner
 image: 'gitlab/gitlab-runner:latest'
 restart: always
 volumes:
  - '/srv/gitlab-runner/config:/etc/gitlab-runner'
  - '/var/run/docker.sock:/var/run/docker.sock'
  - '/usr/bin/docker:/usr/bin/docker'

 

도커 compose파일 실행 

도커 컴포저 실행

docker-compose -f /opt/gopath/src/gitlab/docker-compose.gitlab.runner.yml up -d

컨테이너 실행 확인 
docker container ls

 

gitlab  새로운 project에 파일 3개 생성

Dockerfile

# This file is a template, and might need editing before it works on your project.
FROM node

WORKDIR /usr/src/app

ARG NODE_ENV
ENV NODE_ENV $NODE_ENV

COPY package.json /usr/src/app/
RUN npm install

COPY . /usr/src/app

# replace this with your application's default port
EXPOSE 8900
CMD [ "npm", "start" ]

 

 

index.js

const express = require('express')
const app = express()

app.get('/', function(req, res) {
    res.send('Hello Gitlab!!!!!!안녕하세요!!!!!!!')
})

app.listen(8900, function() {
    console.log('Example app listening on port 8900!')
})
 

 

package.json

{
  "name": "sample",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "scripts": {
    "start": "node index.js"
  },
  "dependencies": {
    "express": "^4.17.1"
  }
}

 

 

토큰값 확인 

신용카드 auth도 진행하는데 해외결제 그낭 카드번호만 넣으면 완료

 

 

gitlab-runner 컨테이너에서 등록

아래 보라색 두값만 위 2번에 맞게 쓰시면 되고 Docker 컨테이너 내부 에서 유일하게 진행하는 작업.

그외는 모두 Docker 밖에서 실행

도커 gitlab-runner 컨테이너 실행
docker container exec -it gitlab-runner bash


root@4abec937906f:/# gitlab-runner register -n \
--url https://gitlab.com/ \
--registration-token M9토큰값 \
--description gitlab-runner \
--executor docker \
--docker-image docker:latest \
--docker-volumes /var/run/docker.sock:/var/run/docker.sock

 

Edit를 클릭하여 Tags에  [gitlab-cicd-tag] 작성

 

위에 설정한 tag는 아래 yml파일에서도 사용

 

.gitlab-ci.yml

stages:
  - test
  - build
  - deploy

variables:
  IMAGE_NAME: 13.125.27.25:5000/nodejs-server-test:latest

cache:
  paths:
    - node_modules/
    
test:
  stage: test
  image: node:latest
  script:
    - env
    - npm install

build:
  stage: package
  tags:
    - gitlab-cicd-tag
  image: docker:latest
  services:
    - docker:dind
  stage: build
  script:
    - ls -al
    - docker container ls -a
    - docker build . -t $IMAGE_NAME
    - docker push $IMAGE_NAME
    - docker images | grep '13.125.27.25'

deploy:
  stage: deploy
  tags:
    - gitlab-cicd-tag
  image: docker:latest
  services:
    - docker:dind
  script:
    - docker container ls -a
    - docker container rm -f nodejs-server 
    - docker run -d -p 8900:8900 --name nodejs-server --restart always $IMAGE_NAME
    - docker container ls -a



 

 

 

 

 

gitlab 해당 프로젝트에 파일이 push뒤면 ci pipe라인에서 자동으로 실행 됩니다.

서버 사양은 꽤나 높으면 빠를거 같습니다.

'시스템' 카테고리의 다른 글

gitlab ci Docker 연동(React)  (0) 2021.11.24
gitlab CI_SERVER_TLS_CA_FILE: Permission denied  (0) 2021.08.30
Configuring tzdata Dockerfile  (0) 2021.07.27
방화벽 설정  (0) 2020.10.26
우분투 No space left on device  (0) 2020.06.26
블로그 이미지

iesay

,

환경 : 버추얼박스 , 우분투 20

Dockerfile에 apt updates 위줄에 옵션 추가 

#Avoiding user interaction with tzdata
ENV DEBIAN_FRONTEND=noninteractive

 

'시스템' 카테고리의 다른 글

gitlab CI_SERVER_TLS_CA_FILE: Permission denied  (0) 2021.08.30
gitlab ci Docker 연동(nodejs)  (2) 2021.08.23
방화벽 설정  (0) 2020.10.26
우분투 No space left on device  (0) 2020.06.26
gitlab 설치  (0) 2020.04.07
블로그 이미지

iesay

,

MongoError: Cannot use a session that has ended

종료된 세션을 사용 할수 없습니다.

 

출처 : https://stackoverflow.com/questions/59816298/how-to-fix-mongoerror-cannot-use-a-session-that-has-ended

원본코드

    } finally {
      await client.close();
    }

 

적용 후 

  } finally {
    //await client.close();
  }

Async로  close 함수가 먼저 실행되어 await를 붙여도 바로 실행 됨

'nodejs' 카테고리의 다른 글

DISCORD bot 제작  (0) 2021.10.22
nodejs so파일  (0) 2021.09.10
nodejs 버전 업데이트 하기  (0) 2021.07.15
nodemon 설정 방법  (0) 2020.12.09
axios 전송  (0) 2020.12.08
블로그 이미지

iesay

,

NVM 설치 

 

apt-get install build-essential libssl-dev
 


curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
 


source ~/.bashrc

 



v14.17.0버전 설치 


nvm install 14.17.0

nvm use v14.17.0

nvm alias default v14.17.0
node --version

'nodejs' 카테고리의 다른 글

nodejs so파일  (0) 2021.09.10
MongoError: Cannot use a session that has ended  (0) 2021.07.20
nodemon 설정 방법  (0) 2020.12.09
axios 전송  (0) 2020.12.08
web3.js 비동기 nodejs 함수 비교  (0) 2020.11.24
블로그 이미지

iesay

,

EIP-1559 분석

이더리움 2021. 7. 12. 19:27

출처 : https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md

        https://github.com/ethers-io/ethers.js/issues/1610

       https://web3py.readthedocs.io/en/stable/web3.eth.html

       https://github.com/ethers-io/ethers.js

항목 AS_IS TO_BE
Gas - 사용자가 실시간 현 시세를 인지 해야됨


- 거래소의 출금지갑이 pending 발생시
  이후 모든 트랜젝션이 오류 장애 발생 요인


- 지갑 , Dapp 개발자 gas비 실시간
  조회 기능
- 수수료 예측 및 조회 확률이 이전 보다 높아짐

- Pending으로 인한 송금 실패는 현저히
  줄어 들것 임


- Dapp 더욱 더 활성화 될것으로 예상
채굴자 보상 -블록생성시 발생되는 이더리움과
  GAS 모두 채굴로 보상 받음
-단기적 보상이 줄어들어 이더리움 가격이
     상승이 동반 되지 않을시 채굴자 대거 이탈
     (이더리움 클래식, 제트캐쉬)


-전체 장비 중 일부만 운영 예상 (20% ~50%)
-
-장기적인 관점으로 트랜젝션이 늙어나고 소각량도 많아져 가격 상승하여 회귀 할것으로 예상
capacity - 블록사이즈(고정) : 12.5M
 
- 최초 가격이 현재 시세보다 높게 잡아
  사용자들이 지불 해야되는 비용이 증가


- 경쟁 방식 가장 높은 비용을 지불한
  사용자가 우선 전송
 
-블록사이즈(가변) :12.5 M  -> 25M
    네트워크 용량의 50%이상 사용시
    더 많은 데이터를 블록에 저장


- 이더리움 유통량이 점점 줄어들것으로 예상

 

 

 

기존 레거시 송금
https://ropsten.etherscan.io/tx/0xbc665337265e7d23f63ba50b2d2ba6db4b6e200c35c89b08cba7491996d9ef78

var Web3 = require("web3")
var web3 = new Web3("https://ropsten.infura.io/v3/API키")
var privateKey = "개인키"
const toAddress = "0x7a0e3AB3c9626018850c06A099981F0B1f183D95";
var tx = {
 to: toAddress,
 value: "300000000000000000",
 chainId: 3,
 gas: 21000
}

const app = async () => {
  try {
   var signed = await web3.eth.accounts.signTransaction(tx, privateKey);
   console.log('SIGN', web3.eth.sendSignedTransaction(signed.rawTransaction));
  }catch (error) { console.log('Task Failure',error);
 }
};
app();

 

 

 

 

EIP-1559 송금
https://ropsten.etherscan.io/tx/0x901cada97279cd77daf2e8202356d5a81eae0c918ab9bebe475eb1def7f213be

var Web3 = require("web3")
var web3 = new Web3("https://ropsten.infura.io/v3/API키")
var privateKey = 개인키
const toAddress = "0x07098B928D40E6Bd143EB9550FbBb5c2ca0Ec1E5";


var tx = {
 to: toAddress,
 value: "10000000000000000",
 chainId: 3,
 gasLimit: 21000,
 gasPrice:   10000,
 gasFeeCap:  10000,
 gasTipCap:  50000,
}


const app = async () => {
  try {
   var signed = await web3.eth.accounts.signTransaction(tx, privateKey);
   console.log('SIGN', web3.eth.sendSignedTransaction(signed.rawTransaction));

  }catch (error) { console.log('Task Failure',error);
 }
};
app();

Txn Type : 0 (Legacy) 로 보이는 부분은 아직 잘 모르곘다.

 

 

공식 문서로 정리를 하긴 할텐데 가장 짜증나던 부분이

같은 의미인데 여러가지 함수로 사용된 부분이다.

노드에서 sign트렌젝션에 대해 검증을 하면 결국 하나의 함수명으로 처리 될텐데

왜 이렇게 해깔리게 작성한지 모르겠다.

 

 

코드 npm 모듈 ethereumjs/tx

import Common from '@ethereumjs/common'
import { FeeMarketEIP1559Transaction } from '@ethereumjs/tx'

const common = new Common({ chain: 'ropsten'hardfork: 'london' })

const txData = {
  "data": "0x1a8451e600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "gasLimit": "0x02625a00",
  "maxPriorityFeePerGas": "0x01",
  "maxFeePerGas": "0xff",
  "nonce": "0x00",
  "to": "0xcccccccccccccccccccccccccccccccccccccccc",
  "value": "0x0186a0",
  "v": "0x01",
  "r": "0xafb6e247b1c490e284053c87ab5f6b59e219d51f743f7a4d83e400782bc7e4b9",
  "s": "0x479a268e0e0acd4de3f1e28e4fac2a6b32a4195e8dfa9d19147abe8807aa6f64",
  "chainId": "0x03",
  "accessList": [],
  "type": "0x02"
}

const tx = FeeMarketEIP1559Transaction.fromTxData(txData, { common })
console.log(tx);


 

 

실행 결과 

[nodemon] 2.0.12
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `babel-node ether.js`
FeeMarketEIP1559Transaction {
  activeCapabilities: [ 1559, 2718, 2930 ],
  DEFAULT_CHAIN: 'mainnet',
  DEFAULT_HARDFORK: 'london',
  _type: 2,
  nonce: <BN: 0>,
  gasLimit: <BN: 2625a00>,
  to: Address {
    buf: <Buffer cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc>
  },
  value: <BN: 186a0>,
  data: <Buffer 1a 84 51 e6 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... 18 more bytes>,
  v: <BN: 1>,
  r: <BN: afb6e247b1c490e284053c87ab5f6b59e219d51f743f7a4d83e400782bc7e4b9>,
  s: <BN: 479a268e0e0acd4de3f1e28e4fac2a6b32a4195e8dfa9d19147abe8807aa6f64>,
  common: Common {
    _events: [Object: null prototype] {},
    _eventsCount: 0,
    _maxListeners: undefined,
    _supportedHardforks: [],
    _eips: [],
    _customChains: [],
    _chainParams: {
      name: 'ropsten',
      chainId: 3,
      networkId: 3,
      defaultHardfork: 'istanbul',
      consensus: [Object],
      comment: 'PoW test network',
      url: 'https://github.com/ethereum/ropsten',
      genesis: [Object],
      hardforks: [Array],
      bootstrapNodes: [Array],
      dnsNetworks: [Array]
    },
    DEFAULT_HARDFORK: 'istanbul',
    _hardfork: 'london',
    [Symbol(kCapture)]: false
  },
  chainId: <BN: 3>,
  accessList: [],
  AccessListJSON: [],
  maxFeePerGas: <BN: ff>,
  maxPriorityFeePerGas: <BN: 1>
}
[nodemon] clean exit - waiting for changes before restart

 

 

 

 

'이더리움' 카테고리의 다른 글

풀노드 구축  (0) 2024.03.13
graphsq + mongodb  (0) 2021.06.08
스마트컨트렉 함수 접근 방법  (0) 2020.12.08
token 송금  (0) 2019.10.28
rinkeby.io facebook으로 테스트 이더 받기  (0) 2019.10.25
블로그 이미지

iesay

,

golang 개발환경 구축

go 2021. 6. 21. 17:33




wget https://go.dev/dl/go1.18.4.linux-amd64.tar.gz

tar -zxvf go1.18.4.linux-amd64.tar.gz

mv go /usr/local

echo 'GOPATH="/usr/local/go"' >> ~/.profile

echo 'PATH="$PATH:$GOPATH/bin"' >> ~/.profile

source .profile

 

'go' 카테고리의 다른 글

cryptopunks raritysniper json 파싱  (0) 2022.04.15
JSON Transfer  (0) 2022.04.14
Web Handler  (0) 2022.04.14
go언어 설치  (0) 2022.04.14
routing module  (0) 2022.04.14
블로그 이미지

iesay

,

graphsq + mongodb

이더리움 2021. 6. 8. 13:20





wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -





echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-

org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list



apt-get update

apt-get install -y mongodb-org

​​

ps --no-headers -o comm 1


systemctl start mongod


systemctl status mongod

mongo


root@server:~# mongo
MongoDB shell version v4.4.6
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("6b814716-52cb-4dde-8d9d-f365adc26916") }
MongoDB server version: 4.4.6
Welcome to the MongoDB shell.

>use admin

>db.createUser({ user: 'server', pwd: '1234', roles: ['root'] })

몽고 DB  ID/PASSWORD 설정

 


mongoimport --db beer-market --collection beers --file ./beers.json --jsonArray



bind_ip 를 0.0.0.0 으로 수정

service mongod restart


apt install npm

npm install

 

 npm init

 npm install express --save

 

 npm install express


npm install --save express express-graphql graphql

npm install nodemon -g

npm install node-cron

npm start

 

'이더리움' 카테고리의 다른 글

풀노드 구축  (0) 2024.03.13
EIP-1559 분석  (2) 2021.07.12
스마트컨트렉 함수 접근 방법  (0) 2020.12.08
token 송금  (0) 2019.10.28
rinkeby.io facebook으로 테스트 이더 받기  (0) 2019.10.25
블로그 이미지

iesay

,

환경 :  버추얼박스 , Ubuntu 20.04.1 LTS,  vscode, 클레이튼

인프런 강좌에 NFT 개발 환경 구축을 위해서 클레이튼을 사용 하던데

클레이튼 구축이라고 보면  옳다.

 

 출처 ㅣ https://github.com/kkagill/crypto-ytt-starter.git

 

nodejs 설치 되어 있지 않는 default한 우분투20에서 

npm만 설치 해준다.

 

#apt update
#apt install npm 
# nodejs -v
 v10.19.0

 

인프런 강의 따라 하는디 디펜던시 하도 심해서 내가 환경 구축에 대한 가이드를 작성중이다.

무조건  nodejs 버전은 10대로 가야 된다.

바로 노드 설치하면 14 , 16이 설치 되어 버리니   npm만 설치하면 nodejs 버전이 10.19가 깔린다.

 

#git clone https://github.com/kkagill/crypto-ytt-starter.git
#cd crypto-ytt-starter/
#npm cache clean --force
#npm install

#npm install -g npm@6.4.1
#npm install -g truffle
#truffle version
Truffle v5.3.2 (core: 5.3.2)
Solidity v0.5.16 (solc-js)
Node v10.19.0
Web3.js v1.3.5

#npm install fs

 

vscode로 버추얼박스에 설치된 이미지에 remote develoment를 실행시킨다.

remote developer 접속

 

 

 

src 소스 수정

webpack.config.js를 아래와 같이 수정해주고

const webpack = require('webpack')

const path = require('path')

const fs = require('fs')

const CopyWebpackPlugin = require("copy-webpack-plugin");

const host = process.env.HOST || '0.0.0.0';

 

module.exports = {

  entry: "./src/index.js",

  mode: 'development',

  node: {

    fs: 'empty',

    net: 'empty',

  },

  output: {

    filename: "index.js",

    path: path.resolve(__dirname'dist')   

  },

  plugins: [   

    new webpack.DefinePlugin({

      DEPLOYED_ADDRESS: JSON.stringify(fs.readFileSync('deployedAddress''utf8').replace(/\n|\r/g"")),

      DEPLOYED_ABI: fs.existsSync('deployedABI') && fs.readFileSync('deployedABI''utf8'),

 

      DEPLOYED_ADDRESS_TOKENSALES: JSON.stringify(fs.readFileSync('deployedAddress_TokenSales''utf8').replace(/\n|\r/g"")),

      DEPLOYED_ABI_TOKENSALES: fs.existsSync('deployedABI_TokenSales') && fs.readFileSync('deployedABI_TokenSales''utf8')

    }),

    new CopyWebpackPlugin([{ from: "./src/index.html"to: "index.html"}])

  ],

  devServer: { contentBase: path.join(__dirname"dist"), compress: true,disableHostCheck: true }

}

 

index.js

import Caver from "caver-js";

import { Spinner } from 'spin.js';

 

const config = {

  rpcURL: 'https://api.baobab.klaytn.net:8651'

}

const cav = new Caver(config.rpcURL);

//const yttContract = new cav.klay.Contract(DEPLOYED_ABI, DEPLOYED_ADDRESS);

 

const App = {

  auth: {

    accessType: 'keystore',

    keystore: '',

    password: ''

  },

 

  //#region 계정 인증

  

  start: async function () {

    const walletFromSession = sessionStorage.getItem('walletInstance');

    if (walletFromSession) {

      try {

        cav.klay.accounts.wallet.add(JSON.parse(walletFromSession));

        this.changeUI(JSON.parse(walletFromSession));

      } catch (e) {

        sessionStorage.removeItem('walletInstance');

      }

    }

  },

 

  handleImport: async function () {

    const fileReader = new FileReader();

    fileReader.readAsText(event.target.files[0]);

    fileReader.onload = (event=> {

      try {

        console.log("event.target.result"event.target.result);

        /*

        if (!this.checkValidKeystore(event.target.result)) {

          $('#message').text('유효하지 않은 keystore 파일입니다.');

          return;

        }

        */

        this.auth.keystore = event.target.result;

        $('#message').text('keystore 통과. 비밀번호를 입력하세요.');

        document.querySelector('#input-password').focus();

      } catch (event) {

        $('#message').text('유효하지 않은 keystore 파일입니다.');

        return;

      }

    }

  },

 

  handlePassword: async function () {

    this.auth.password = event.target.value;

  },

 

  handleLogin: async function () {

    if (this.auth.accessType === 'keystore') {

      try {

        const privateKey = cav.klay.accounts.decrypt(this.auth.keystorethis.auth.password).privateKey;

        this.integrateWallet(privateKey);

      } catch (e) {

        $('#message').text('비밀번호가 일치하지 않습니다.');

      }

    }

  },

 

  handleLogout: async function () {

    this.removeWallet();

    location.reload();

  }, 

 

  getWallet: function () {

    if (cav.klay.accounts.wallet.length) {

      return cav.klay.accounts.wallet[0];

    }

  },

 

  checkValidKeystore: function (keystore) {

    const parsedKeystore = JSON.parse(keystore);

    const isValidKeystore = parsedKeystore.version &&

      parsedKeystore.id &&

      parsedKeystore.address &&

      parsedKeystore.crypto;

 

    return isValidKeystore;

  },

 

  integrateWallet: function (privateKey) {

    const walletInstance = cav.klay.accounts.privateKeyToAccount(privateKey);

    cav.klay.accounts.wallet.add(walletInstance)

    sessionStorage.setItem('walletInstance'JSON.stringify(walletInstance));

    this.changeUI(walletInstance);

  },

 

  reset: function () {

    this.auth = {

      keystore: '',

      password: ''

    };

  },

 

  changeUI: async function (walletInstance) {

    $('#loginModal').modal('hide');

    $("#login").hide();

    $('#logout').show();

    // ...

    $('#address').append('<br>' + '<p>' + '내 계정 주소: ' + walletInstance.address + '</p>');  

    // ...   

    // ...

    // ...

  },

 

  removeWallet: function () {

    cav.klay.accounts.wallet.clear();

    sessionStorage.removeItem('walletInstance');

    this.reset();

  }, 

 

  showSpinner: function () {

    var target = document.getElementById('spin');

    return new Spinner(opts).spin(target);

  },

  //#endregion

 

  checkTokenExists: async function () {   

   

  },

 

  createToken: async function () {   

    

  },  

 

  mintYTT: async function (videoIdauthordateCreatedhash) {    

    

  },    

  

  displayMyTokensAndSale: async function (walletInstance) {       

   

  },   

 

  displayAllTokens: async function (walletInstance) {   

    

  },

   

  renderMyTokens: function (tokenIdyttmetadata) {    

    

  },

 

  renderMyTokensSale: function (tokenIdyttmetadataprice) { 

   

  },

 

  renderAllTokens: function (tokenIdyttmetadata) {   

     

  },    

 

  approve: function () {

      

  },

 

  cancelApproval: async function () {

          

  },

 

  checkApproval: async function(walletInstance) {

       

  },

 

  sellToken: async function (button) {    

       

  },

 

  buyToken: async function (button) {

      

  },

 

  onCancelApprovalSuccess: async function (walletInstance) {

  

  },     

 

  isTokenAlreadyCreated: async function (videoId) {

   

  },

 

  getERC721MetadataSchema: function (videoIdtitleimgUrl) {

    

  },

 

  getBalanceOf: async function (address) {

   

  },

 

  getTokenOfOwnerByIndex: async function (addressindex) {

  

  },

 

  getTokenUri: async function (tokenId) {

    

  },

 

  getYTT: async function (tokenId) {

   

  },

 

  getMetadata: function (tokenUri) {

   

  },

 

  getTotalSupply: async function () {

   

  },

 

  getTokenByIndex: async function (index) {

    

  },  

 

  isApprovedForAll: async function (owneroperator) {

 

  },  

 

  getTokenPrice: async function (tokenId) {

   

  },  

 

  getOwnerOf: async function (tokenId) {

   

  },

 

  getBasicTemplate: function(templatetokenIdyttmetadata) {  

  

  }

};

 

window.App = App;

 

window.addEventListener("load"function () {

  App.start(); 

  $("#tabs").tabs().css({'overflow': 'auto'});

});

 

var opts = {

  lines: 10// The number of lines to draw

  length: 30// The length of each line

  width: 17// The line thickness

  radius: 45// The radius of the inner circle

  scale: 1// Scales overall size of the spinner

  corners: 1// Corner roundness (0..1)

  color: '#5bc0de'// CSS color or array of colors

  fadeColor: 'transparent'// CSS color or array of colors

  speed: 1// Rounds per second

  rotate: 0// The rotation offset

  animation: 'spinner-line-fade-quick'// The CSS animation name for the lines

  direction: 1// 1: clockwise, -1: counterclockwise

  zIndex: 2e9// The z-index (defaults to 2000000000)

  className: 'spinner'// The CSS class to assign to the spinner

  top: '50%'// Top position relative to parent

  left: '50%'// Left position relative to parent

  shadow: '0 0 1px transparent'// Box-shadow for the lines

  position: 'absolute' // Element positioning

};

 

index.html

<!DOCTYPE html>

<html lang="en">

 

<head>

  <meta charset="utf-8">

  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

  <meta name="theme-color" content="#000000">

  <title>크립토 유튜브 썸네일</title>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>

  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

  <script src="index.js"></script>

  <link href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css' rel='stylesheet'>

  <link href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet">

</head>

 

<body>

  <div class="container">

    <div class="row">

      <div class="col-md-8 col-md-offset-2">    

        <h3 class="text-center">크립토 <span style="color: red;">유튜브</span> 썸네일</h1>

        <h3 class="text-center">

          <code>Collect, Buy and Sell YouTube Thumbnails!</code>           

          <button type="button" 

                  class="btn btn-info pull-right" 

                  id="login" 

                  data-toggle="modal"

                  data-target="#loginModal">

                  로그인

          </button>

          <button type="button" 

                  class="btn btn-info pull-right" 

                  id="logout" 

                  style="display: none;"

                  onclick="App.handleLogout()">

                  로그아웃

          </button>

        </h3>         

        <div class="text-center" id="address"></div>         

      </div>

    </div>  

 

    <div id="spin"></div>   

  </div>  

 

  <!-- Modals -->

 

  <div class="modal fade" tabindex="-1" role="dialog" id="loginModal">

    <div class="modal-dialog modal-sm">

      <div class="modal-content">         

        <div class="modal-body">

          <div class="form-group">

            <label for="keystore">Keystore</label>

            <input type="file" id="keystore" onchange="App.handleImport()">

          </div>

          <div class="form-group">

            <label for="input-password">비밀번호</label>

            <input type="password" class="form-control" id="input-password" onchange="App.handlePassword()">

            <p class="help-block" id="message"></p>

          </div>

        </div>

        <div class="modal-footer">

          <button type="button" class="btn btn-default" data-dismiss="modal">닫기</button>

          <button type="button" class="btn btn-primary" onclick="App.handleLogin()">제출</button>

        </div>

      </div><!-- /.modal-content -->

    </div><!-- /.modal-dialog -->

  </div><!-- /.modal -->

</body>

 

<!-- Templates -->

 

</html>

 

<style>

  @keyframes spinner-line-fade-more {

    0%, 100% {

      opacity0;

    }

    1% {

      opacity1;

    }

  }

 

  @keyframes spinner-line-fade-quick {

    0%, 39%, 100% {

      opacity0.25;

    }

    40% {

      opacity1;

    }

  }

 

  @keyframes spinner-line-fade-default {

    0%, 100% {

      opacity0.22;

    }

    1% {

      opacity1;

    }

  }

 

  .panel-footer {

    height56px;   

    overflowhidden;

  }

</style>

 

 

 

소스를 위 소스로 변경해 준다.

npm run dev로 프로젝트를 실행하면 locahost에서는 접속이 가능하다.

root@server:~/crypto-ytt-starter# npm run dev

> crypto-youtube-thumbnail-starter@0.0.1 dev /root/crypto-ytt-starter
> webpack-dev-server

ℹ 「wds」: Project is running at http://localhost:8080/
ℹ 「wds」: webpack output is served from /
ℹ 「wds」: Content not from webpack is served from /root/crypto-ytt-starter/dist
ℹ 「wdm」: Hash: e0e5fdf71534985470fa

외부 접속 가능하게 ngrok로 포워딩 해준다.

#snap install ngrok
#ngrok http 8080

 

 

포워딩 해준 주소 접속하면 접속이 가능하다.

리엑트 개발자들은 더 좋은 방법이 있을거 같다.

 

ERC721등 여러 함수들은 직접 구현하길 바란다.

 

'NFT' 카테고리의 다른 글

NFT EIP-721 Non-Fungible Token Standard  (0) 2021.03.11
블로그 이미지

iesay

,

'NFT' 카테고리의 다른 글

NFT 클레이튼 개발 환경 구축  (0) 2021.04.22
블로그 이미지

iesay

,