P2Pのような中央集権型でない環境や、信頼できるノードが存在しないときは、合意形成が難しいため様々な手法が提案されています。
ここでは、麻雀を例にとり、各クライアントが自身の動作を悪意を持って制御可能な状況下で、 定められた手順通り正しく動作をしていて正しく動作し続けたことを後から検証する方法について述べます。
麻雀では山(壁牌)から牌を取り(自摸、ツモ)、手牌に加えたのち1枚を捨てる(打牌)ことを繰り返して役を揃えることを目指します。
package main | |
import ( | |
"net/http" | |
"net/url" | |
"io/ioutil" | |
"encoding/json" | |
"fmt" | |
) |
#encoding: utf-8 | |
require 'uri' | |
require 'net/http' | |
require 'json' | |
uri = 'http://food.kazoo04.com:8080/api/v0/upload' | |
img_url = 'http://www.example.com/image.jpg' | |
parsed = URI.parse(uri) |
# -*- coding: utf-8 -*- | |
import urllib.request | |
import urllib.response | |
import json | |
if __name__ == '__main__': | |
api_url = 'http://food.kazoo04.com:8080/api/v0/upload' | |
img_url = 'http://www.example.com/image.jpg' |
import arow; | |
import std.stdio; | |
import std.random; | |
import std.string; | |
import std.conv; | |
import std.file; | |
import std.stream; | |
struct example { | |
int label; |
<div class="row"> | |
<div class="col s12 m6"> | |
<div class="card"> | |
<div class="card-content blue-grey darken-1"> | |
<span class="card-title lighten-5-text">Card Title</span> | |
</div> | |
<div class="card-content grey lighten-5 darken-4-text"> | |
<p>I am a very simple card. I am good at containing small bits of information. | |
I am convenient because I require little markup to use effectively.</p> | |
</div> |
import std.stdio; | |
import std.array; | |
import std.utf; | |
void main() { | |
string s = "AあBい"; | |
foreach(c; array(s)) { | |
foreach(b; [c].toUTF8) { | |
writef("%02x ", b); | |
} |
import cv2 | |
import numpy as np | |
def create_template(): | |
templates = [] | |
for text in list('0123456789'): | |
img = np.zeros((200,200,1), dtype=np.uint8) | |
cv2.putText(img, text, (100, 100), cv2.FONT_HERSHEY_DUPLEX, 2, 255, 5) | |
contours, _ = cv2.findContours(img.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) | |
x, y, w, h = cv2.boundingRect(contours[0]) |