Scanner API Guidelines
Development guide prepared for the implementation of additional functions after NFT holder verification.
Last updated
Development guide prepared for the implementation of additional functions after NFT holder verification.
Last updated
This document is a development guideline prepared for implementing additional functions after NFT holder verification.
Understanding of SDKs such as web3.js and ethers may be required to implement blockchain-related functions.
If you develop an API endpoint server by referring to this document, you can add the features of the example below.
Check how many NFTs the user who authenticated the wallet has Send NFTs or tokens to users recognized by the scanner Offline Stamp tour using FAVORLET and FAVORLET Scanner Access check and record management at offline holder party Various functions suitable for other situations
Please refer to the Basic usage guideline page for basic usage guide for FAVORLET scanner.
You can receive a request to the registered API server after scanning the user's authentication QR code by putting it in the service endpoint URL
on the scanner setting screen.
On the scanner settings screen, you can set in the following three ways.
If only the collection contract address
is entered: Only the scanner's NFT holder will be verified.
If you only put the service endpoint URL
: Skip scanner's NFT holder verification and send request to API server.
If you put both the collection contract address
and service endpoint URL
: Send a request to the API server after verifying the scanner's NFT holder.
Either the collection contract address
or the service endpoint URL
must be entered
The flow of communication between FAVORLET, Scanner, and Server is as below.
FAVORLET users generate a verification QR.
The scanner checks the QR code whether it is valid or not and passes the wallet address and other information to the endpoint URL (API server) you set.
The requested API server responds with a scanner for success or failure.
This is the data that FAVORLET scanner request to the API server set as the service endpoint URL.
Method: POST
Header: Content-Type:application/json
Body
Parameter Description
walletAddress
string
This is the wallet address delivered through QR verification.
contractAddress
string
This is the address registered in the collection contract address
on the scanner settings screen.
If left blank, no data will appear.
signature
string
This is the data for verifying whether walletAddress
and expireTime
have changed. The usage of the value is optional, see below for detailed explanation.
expireTime
string
The expiration date for the QR code generated by the user. The format is YYYY-MM-DDTHH:mm:ss.sssZ
.
what issignature
?
블록체인에서 문자열에 대해 지갑의 private key로 서명하여 나오는 데이터로, 이 signature
를 다시 복구했을 때 지갑 주소가 나온다면 해당 지갑으로 서명한 데이터임을 검증할 수 있습니다.
This is the data that comes from signing the string with the private key of the wallet on the blockchain.
If the wallet address is found when this signature is recovered, it can be verified that the data was signed by the wallet.
Favorlet에서 QR 인증 시 "i-love-fingerlabs_" + walletAddress + "_" + expireTime
텍스트로
서명하게 되며, walletAddress
과 expireTime
값을 검증할 수 있습니다.
Favorlet에서 QR 인증에 대한 메세지 서명은 이더리움 prefix를 사용하게 되며, 자바스크립트에서는 ethers
와 web3.js
라이브러리를 사용하여 서명한 주소를 복구할 수 있습니다.
자바스크립트 라이브러리 중 caver-js
는 클레이튼 prefix를 사용하므로 복구할 수 없습니다.
이더리움 prefix:"\x19Ethereum Signed Message:\n" + message.length + message
클레이튼 prefix: "\x19Klaytn Signed Message:\n" + message.length + message
메세지 서명과 관련된 자세한 내용을 알고 싶다면 Ethereum Signed Message Verification Tool를 참조 바라며, 검증에 대한 방법은 본 문서 아래의 서버 예제를 참고 바랍니다.
This is the data that the API server you set as the service endpoint URL should respond with FAVORLET scanner.
Header: Content-Type:application/json
Case1: success
Case2: fail
Screenshot
Parameter Description
success
boolean
요청에 대한 성공 여부이며 true
또는 false
를 반환해야 합니다.
title
string
스캐너에서 요청 결과 팝업 제목에 표시되는 텍스트입니다.
reason
string
스캐너에서 요청 결과 팝업 설명에 표시되는 텍스트입니다.
응답 결과는 JSON 형태로 응답해야 하며 Response status code는 스캐너에서 참조하지 않습니다.
1. Node.js 설치
2. 프로젝트 폴더 생성 및 이동
3. 패키지 설치
4. index.js
파일 작성
5. 터미널에서 실행
6. 새 터미널에서 테스트
7. 결과 확인
만약 스캐너앱의 기본 기능 외에 다른 액션을 추가하고 싶으신데 개발에 어려움을 겪고 있다면 favorlet@fingerlabs.io 로 이메일 주시길 바랍니다.