일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- 데이터캡
- 채굴
- 암호화폐
- 바이낸스
- BTC
- 이더리움
- 레이어2
- FILECOIN
- filfox
- 파일코인플러스
- Q-code
- 스토리지
- MATIC
- nft
- datacap
- 투자
- FIL
- 가상자산
- 코인
- 파일코인
- 코로나
- 민팅
- nft민팅
- Mining
- 알위브
- 스토리지코인
- 공증인
- 비트코인
- Arweave
- 채산성
- Today
- 96
- Total
- 125,460
목록2022/12/12 (2)
Blockchain & Devops, bitetiger
내가 구현한 블록체인과 통신할 수 있는 CLI를 구현해본다. flag를 사용해서 port와 사용할 mode를 설정한다. package cli import ( "flag" "fmt" "os" ) func usage() { fmt.Printf("This is vatacoin\n\n") fmt.Printf("Please use the following flags:\n\n") fmt.Printf("-port:Set the PORT of the server\n") fmt.Printf("-mode:Choose between 'html' and 'rest'\n\n") os.Exit(0) } func Start() { if len(os.Args) == 1 { usage() } port := flag.Int("port"..
REST API를 GO로 구현해서 blockchain부터 특정 block을 확인하고, 추가할 수 있도록 해본다. package rest import ( "encoding/json" "fmt" "log" "net/http" "strconv" "github.com/gorilla/mux" ) var port string type url string func (u url) MarshalText() ([]byte, error) { url := fmt.Sprintf("http://localhost%s%s", port, u) return []byte(url), nil } type urlDescription struct { URL url `json:"url"` Method string `json:"method"` De..