Blockchain: dab tsi PoC peb yuav tsum tsim?

Koj ob lub qhov muag ntshai thiab koj txhais tes khaus!

Hauv cov ntawv dhau los, peb tau hais txog cov thev naus laus zis uas blockchains tsim (Dab tsi peb yuav tsum tsim kom muaj blockchain?) thiab cov xwm txheej uas tuaj yeem siv tau nrog lawv cov kev pab (Vim li cas peb yuav tsum tsim ib rooj plaub?). Nws yog lub sijhawm ua haujlwm nrog koj txhais tes! Txhawm rau siv cov tsav dav hlau thiab PoC (Cov Ntawv Pov Thawj ntawm Lub Tswv Yim), Kuv nyiam siv cov huab, vim tias ... lawv tuaj yeem nkag tau los ntawm txhua qhov chaw hauv ntiaj teb thiab, feem ntau, tsis tas yuav nkim sijhawm rau kev teeb tsa ntawm ib puag ncig, vim tias Muaj preset configurations. Yog li, cia peb ua ib yam dab tsi yooj yim, piv txwv li, ib lub network rau kev xa nyiaj npib ntawm cov neeg koom thiab cia peb hu nws ua Bitcoin. Rau qhov no peb yuav siv IBM huab thiab universal blockchain Hyperledger Fabric. Ua ntej, cia peb xav seb vim li cas Hyperledger Fabric hu ua universal blockchain?

Blockchain: dab tsi PoC peb yuav tsum tsim?

Hyperledger Fabric - ib tug universal blockchain

Feem ntau hais lus, universal information system yog:

  • Ib txheej ntawm cov servers thiab software core uas ua rau kev lag luam logic;
  • Interfaces rau kev sib cuam tshuam nrog lub system;
  • Cov cuab yeej rau kev sau npe, kev lees paub thiab kev tso cai ntawm cov khoom siv / cov neeg;
  • Database khaws cov ntaub ntawv ua haujlwm thiab cov ntaub ntawv khaws cia:

Blockchain: dab tsi PoC peb yuav tsum tsim?

Lub official version ntawm dab tsi Hyperledger Fabric yog nyeem tau ntawm qhov chaw, thiab luv luv, Hyperledger Fabric yog ib qho chaw qhib platform uas tso cai rau koj los tsim cov blockchains ntiag tug thiab ua tiav cov ntawv cog lus ntse uas tau sau hauv JS thiab Go programming lus. Cia peb saib hauv kev nthuav dav ntawm cov qauv ntawm Hyperledger Fabric thiab xyuas kom meej tias qhov no yog ib qho thoob ntiaj teb uas tsuas muaj qhov tshwj xeeb rau khaws cia thiab sau cov ntaub ntawv. Qhov tshwj xeeb yog tias cov ntaub ntawv, ib yam li hauv tag nrho cov blockchains, yog khaws cia rau hauv cov blocks uas tau muab tso rau hauv blockchain tsuas yog tias cov neeg tuaj koom tau txais kev pom zoo thiab tom qab sau cov ntaub ntawv tsis tuaj yeem kho ntsiag to lossis tshem tawm.

Hyperledger Fabric Architecture

Daim duab qhia txog Hyperledger Fabric architecture:

Blockchain: dab tsi PoC peb yuav tsum tsim?

Cov koom haum - cov koom haum muaj cov phooj ywg, i.e. blockchain tshwm sim vim kev txhawb nqa ntawm cov koom haum. Cov koom haum sib txawv tuaj yeem yog ib feem ntawm tib lub channel.

Channel - cov qauv kev xav uas sib sau ua phooj ywg rau hauv pab pawg, i.e. lub blockchain tau teev tseg. Hyperledger Npuag tuaj yeem ua tiav ib txhij ua ntau yam blockchains nrog kev lag luam sib txawv.

Kev Pabcuam Tswvcuab (MSP) yog CA (Certificate Authority) rau kev tshaj tawm tus kheej thiab muab lub luag haujlwm. Txhawm rau tsim cov node, koj yuav tsum cuam tshuam nrog MSP.

Peer nodes - txheeb xyuas kev lag luam, khaws cov blockchain, ua cov ntawv cog lus ntse thiab cuam tshuam nrog cov ntawv thov. Cov phooj ywg muaj tus kheej (daim ntawv pov thawj digital), uas yog muab los ntawm MSP. Tsis zoo li Bitcoin lossis Etherium network, qhov twg tag nrho cov nodes muaj txoj cai sib npaug, hauv Hyperledger Fabric nodes ua lub luag haujlwm sib txawv:

  • Peer tej zaum pom zoo cov phooj ywg (EP) thiab ua cov ntawv cog lus ntse.
  • Ua phooj ywg (CP) - tsuas yog khaws cov ntaub ntawv hauv blockchain thiab hloov kho "Lub Ntiaj Teb Lub Xeev".
  • Anchor Peer (AP) - yog tias muaj ntau lub koom haum koom nrog hauv blockchain, ces cov neeg sib tw thauj tog rau nkoj yog siv rau kev sib txuas lus ntawm lawv. Txhua lub koom haum yuav tsum muaj ib lossis ntau tus neeg koom nrog. Siv AP, txhua tus phooj ywg hauv ib lub koom haum tuaj yeem tau txais cov ntaub ntawv hais txog txhua tus phooj ywg hauv lwm lub koom haum. Siv los synchronize cov ntaub ntawv ntawm APs lus xaiv raws tu qauv.
  • Leader Peer - yog tias ib lub koom haum muaj ntau tus phooj ywg, tsuas yog tus thawj coj ntawm cov phooj ywg yuav tau txais cov blocks los ntawm Ordering service thiab muab rau lwm tus phooj ywg. Tus thawj coj tuaj yeem raug teev tseg los yog xaiv dynamically los ntawm cov phooj ywg hauv lub koom haum. Cov txheej txheem lus xaiv kuj tseem siv los synchronize cov ntaub ntawv hais txog cov thawj coj.

cov cuab tam - cov chaw uas muaj nqi thiab khaws cia rau ntawm blockchain. Tshwj xeeb tshaj yog, qhov no yog cov ntaub ntawv tseem ceeb hauv JSON hom. Nws yog cov ntaub ntawv no uas tau sau tseg hauv Blockchain. Lawv muaj keeb kwm, uas tau khaws cia hauv blockchain, thiab lub xeev tam sim no, uas tau muab khaws cia rau hauv "Lub Xeev Lub Ntiaj Teb" database. Cov txheej txheem cov ntaub ntawv tau sau arbitrarily nyob ntawm kev ua lag luam. Tsis muaj qhov yuav tsum tau ua, qhov kev pom zoo tsuas yog tias cov cuab yeej cuab tam yuav tsum muaj tus tswv thiab muaj txiaj ntsig.

Ledger - suav nrog Blockchain thiab Word lub xeev database, uas khaws cov khoom tam sim no. Ntiaj teb lub xeev siv LevelDB lossis CouchDB.

Ntse daim ntawv cog lus - siv cov ntawv cog lus ntse, kev lag luam logic ntawm qhov system yog siv. Hauv Hyperledger Fabric, cov ntawv cog lus ntse hu ua chaincode. Siv chaincode, khoom muaj nqis thiab kev lag luam tshaj lawv tau teev tseg. Hauv cov ntsiab lus, cov ntawv cog lus ntse yog software modules siv hauv JS lossis Go programming lus.

Kev pom zoo txoj cai - rau txhua tus chaincode, koj tuaj yeem teeb tsa txoj cai ntawm pes tsawg qhov kev lees paub rau kev lag luam yuav tsum xav tau thiab los ntawm leej twg. Yog tias tsis tau teeb tsa txoj cai, ces lub neej ntawd yog: "kev hloov pauv yuav tsum tau lees paub los ntawm ib tus tswv cuab ntawm ib lub koom haum hauv channel." Piv txwv ntawm txoj cai:

  • Kev hloov pauv yuav tsum tau pom zoo los ntawm ib tus thawj coj ntawm lub koom haum;
  • Yuav tsum tau lees paub los ntawm ib tus tswv cuab lossis cov neeg siv khoom ntawm lub koom haum;
  • Yuav tsum tau lees paub los ntawm ib lub koom haum ua phooj ywg.

Ordering service - ntim cov khoom lag luam rau hauv cov blocks thiab xa mus rau cov phooj ywg hauv cov channel. Guarantes xa cov lus rau txhua tus phooj ywg hauv lub network. Siv rau industrial systems Kafka xov xwm broker, rau kev txhim kho thiab kev sim solo.

CallFlow

Blockchain: dab tsi PoC peb yuav tsum tsim?

  • Daim ntawv thov sib txuas lus nrog Hyperledger Fabric siv Go, Node.js lossis Java SDK;
  • Tus neeg siv khoom tsim txua kev lag luam thiab xa mus rau cov neeg pom zoo;
  • Tus Peer txheeb xyuas tus neeg siv khoom kos npe, ua tiav qhov kev sib pauv, thiab xa daim ntawv lees paub kos npe rov qab rau tus neeg siv khoom. Chaincode tsuas yog ua tiav ntawm cov phooj ywg pom zoo, thiab qhov tshwm sim ntawm nws qhov kev tua raug xa mus rau txhua tus phooj ywg. Qhov kev ua haujlwm no yog hu ua PBFT (Practical Byzantine Fault Tolerant) kev pom zoo. Qhov txawv ntawm Classic BFT qhov tseeb hais tias cov lus raug xa mus thiab kev pom zoo yuav tsum tsis yog los ntawm txhua tus neeg koom, tab sis tsuas yog los ntawm ib qho kev teeb tsa;
  • Tom qab tus neeg siv khoom tau txais cov lus teb raws li txoj cai pom zoo, nws xa cov kev hloov pauv mus rau qhov kev txiav txim;
  • Cov kev pabcuam Ordering tsim ib qho thaiv thiab xa mus rau txhua tus neeg ua haujlwm. Kev txiav txim kev pabcuam xyuas kom muaj cov ntaub ntawv teev tseg ntawm cov blocks, uas tshem tawm qhov kev hu ua ledger diav rawg (saib seem "Forks");
  • Cov phooj ywg tau txais ib qho thaiv, txheeb xyuas txoj cai pom zoo dua, sau qhov thaiv mus rau blockchain thiab hloov lub xeev hauv "World state" DB.

Cov. Qhov no ua rau muaj kev faib cov luag haujlwm ntawm cov nodes. Qhov no ua kom lub blockchain yog scalable thiab ruaj ntseg:

  • Cov ntawv cog lus ntse (chaincode) ua rau cov phooj ywg pom zoo. Qhov no ua kom tsis pub lwm tus paub ntawm cov ntawv cog lus ntse, vim Nws tsis yog khaws cia los ntawm txhua tus neeg koom, tab sis tsuas yog los ntawm kev pom zoo cov phooj ywg.
  • Kev txiav txim yuav tsum ua haujlwm sai. Qhov no tau ua pov thawj los ntawm qhov tseeb tias Kev Txiav Txim tsuas yog tsim ib qho thaiv thiab xa mus rau qhov chaw ruaj khov ntawm cov thawj coj cov phooj ywg.
  • Kev cog lus cov phooj ywg tsuas yog khaws cov blockchain - tuaj yeem muaj ntau ntawm lawv thiab lawv tsis tas yuav muaj lub zog ntau thiab ua haujlwm tam sim.

Cov ntsiab lus ntxiv ntawm cov kev daws teeb meem kev tsim vaj tsev ntawm Hyperledger Fabric thiab vim li cas nws ua haujlwm li no thiab tsis muaj lwm yam tuaj yeem pom ntawm no: Keeb kwm Architecture los yog ntawm no: Hyperledger Fabric: Ib Qhov Kev Ua Haujlwm Tshaj Tawm rau Kev Tso Cai Blockchains.

Yog li, Hyperledger Fabric yog ib qho kev siv thoob ntiaj teb uas koj tuaj yeem ua tau:

  • Ua raws li kev ua lag luam arbitrary logic siv lub ntse daim ntawv cog lus mechanism;
  • Sau thiab tau txais cov ntaub ntawv los ntawm blockchain database hauv JSON hom;
  • Tso cai thiab txheeb xyuas qhov kev nkag API siv daim ntawv pov thawj Authority.

Tam sim no peb nkag siab me ntsis txog qhov tshwj xeeb ntawm Hyperledger Fabric, thaum kawg peb ua qee yam muaj txiaj ntsig!

Deploying blockchain

Nqe lus ntawm qhov teeb meem

Lub luag haujlwm yog los siv Citcoin network nrog cov haujlwm hauv qab no: tsim ib tus as khauj, tau txais qhov nyiaj tshuav, sau koj tus lej nyiaj, hloov nyiaj npib los ntawm ib tus account mus rau lwm tus. Cia peb kos ib yam khoom qauv, uas peb yuav siv ntxiv rau hauv daim ntawv cog lus ntse. Yog li, peb yuav muaj cov nyiaj uas tau txheeb xyuas los ntawm cov npe thiab muaj qhov sib npaug, thiab cov npe ntawm cov nyiaj. Cov nyiaj thiab cov npe ntawm cov nyiaj yog, nyob rau hauv cov nqe lus ntawm Hyperledger Fabric cov cuab tam. Yog li ntawd, lawv muaj keeb kwm thiab lub xeev tam sim no. Kuv mam li sim kos qhov no kom meej:

Blockchain: dab tsi PoC peb yuav tsum tsim?

Cov duab saum toj kawg nkaus yog lub xeev tam sim no, uas tau muab cia rau hauv "Lub Xeev Lub Ntiaj Teb" database. Hauv qab no yog cov duab qhia txog keeb kwm uas khaws cia hauv blockchain. Lub xeev tam sim no ntawm cov cuab tam hloov pauv los ntawm kev hloov pauv. Cov khoom vaj khoom tsev hloov pauv tsuas yog tag nrho, yog li qhov tshwm sim ntawm kev sib pauv, ib qho khoom tshiab raug tsim, thiab tam sim no tus nqi ntawm cov cuab tam mus rau hauv keeb kwm.

IBM Cloud

Peb tsim ib tus account hauv IBM huab. Txhawm rau siv lub platform blockchain, nws yuav tsum tau hloov kho rau Them-As-You-Go. Cov txheej txheem no yuav tsis ceev, vim ... IBM thov cov ntaub ntawv ntxiv thiab txheeb xyuas nws tus kheej. Ntawm qhov kev ceeb toom zoo, kuv tuaj yeem hais tias IBM muaj cov ntaub ntawv kawm zoo uas tso cai rau koj los siv Hyperledger Fabric hauv lawv cov huab. Kuv nyiam cov kab lus hauv qab no thiab cov piv txwv:

Cov hauv qab no yog cov screenshots ntawm IBM Blockchain platform. Qhov no tsis yog ib qho kev qhia txog yuav ua li cas los tsim ib lub blockchain, tab sis tsuas yog ib qho kev qhia ntawm lub luag haujlwm ntawm txoj haujlwm. Yog li, rau peb lub hom phiaj, peb tsim ib lub Koom Haum:

Blockchain: dab tsi PoC peb yuav tsum tsim?

Peb tsim cov nodes hauv nws: Orderer CA, Org1 CA, Orderer Peer:

Blockchain: dab tsi PoC peb yuav tsum tsim?

Peb tsim cov neeg siv:

Blockchain: dab tsi PoC peb yuav tsum tsim?

Tsim ib Channel thiab hu nws citcoin:

Blockchain: dab tsi PoC peb yuav tsum tsim?

Qhov tseem ceeb Channel yog blockchain, yog li nws pib nrog block xoom (Chivkeeb thaiv):

Blockchain: dab tsi PoC peb yuav tsum tsim?

Sau daim ntawv cog lus ntse

/*
 * Citcoin smart-contract v1.5 for Hyperledger Fabric
 * (c) Alexey Sushkov, 2019
 */
 
'use strict';
 
const { Contract } = require('fabric-contract-api');
const maxAccounts = 5;
 
class CitcoinEvents extends Contract {
 
    async instantiate(ctx) {
        console.info('instantiate');
        let emptyList = [];
        await ctx.stub.putState('accounts', Buffer.from(JSON.stringify(emptyList)));
    }
    // Get all accounts
    async GetAccounts(ctx) {
        // Get account list:
        let accounts = '{}'
        let accountsData = await ctx.stub.getState('accounts');
        if (accountsData) {
            accounts = JSON.parse(accountsData.toString());
        } else {
            throw new Error('accounts not found');
        }
        return accountsData.toString()
    }
     // add a account object to the blockchain state identifited by their name
    async AddAccount(ctx, name, balance) {
        // this is account data:
        let account = {
            name: name,
            balance: Number(balance),       
            type: 'account',
        };
        // create account:
        await ctx.stub.putState(name, Buffer.from(JSON.stringify(account)));
 
        // Add account to list:
        let accountsData = await ctx.stub.getState('accounts');
        if (accountsData) {
            let accounts = JSON.parse(accountsData.toString());
            if (accounts.length < maxAccounts)
            {
                accounts.push(name);
                await ctx.stub.putState('accounts', Buffer.from(JSON.stringify(accounts)));
            } else {
                throw new Error('Max accounts number reached');
            }
        } else {
            throw new Error('accounts not found');
        }
        // return  object
        return JSON.stringify(account);
    }
    // Sends money from Account to Account
    async SendFrom(ctx, fromAccount, toAccount, value) {
        // get Account from
        let fromData = await ctx.stub.getState(fromAccount);
        let from;
        if (fromData) {
            from = JSON.parse(fromData.toString());
            if (from.type !== 'account') {
                throw new Error('wrong from type');
            }   
        } else {
            throw new Error('Accout from not found');
        }
        // get Account to
        let toData = await ctx.stub.getState(toAccount);
        let to;
        if (toData) {
            to = JSON.parse(toData.toString());
            if (to.type !== 'account') {
                throw new Error('wrong to type');
            }  
        } else {
            throw new Error('Accout to not found');
        }
 
        // update the balances
        if ((from.balance - Number(value)) >= 0 ) {
            from.balance -= Number(value);
            to.balance += Number(value);
        } else {
            throw new Error('From Account: not enought balance');          
        }
 
        await ctx.stub.putState(from.name, Buffer.from(JSON.stringify(from)));
        await ctx.stub.putState(to.name, Buffer.from(JSON.stringify(to)));
                 
        // define and set Event
        let Event = {
            type: "SendFrom",
            from: from.name,
            to: to.name,
            balanceFrom: from.balance,
            balanceTo: to.balance,
            value: value
        };
        await ctx.stub.setEvent('SendFrom', Buffer.from(JSON.stringify(Event)));
 
        // return to object
        return JSON.stringify(from);
    }
 
    // get the state from key
    async GetState(ctx, key) {
        let data = await ctx.stub.getState(key);
        let jsonData = JSON.parse(data.toString());
        return JSON.stringify(jsonData);
    }
    // GetBalance   
    async GetBalance(ctx, accountName) {
        let data = await ctx.stub.getState(accountName);
        let jsonData = JSON.parse(data.toString());
        return JSON.stringify(jsonData);
    }
     
    // Refill own balance
    async RefillBalance(ctx, toAccount, value) {
        // get Account to
        let toData = await ctx.stub.getState(toAccount);
        let to;
        if (toData) {
            to = JSON.parse(toData.toString());
            if (to.type !== 'account') {
                throw new Error('wrong to type');
            }  
        } else {
            throw new Error('Accout to not found');
        }
 
        // update the balance
        to.balance += Number(value);
        await ctx.stub.putState(to.name, Buffer.from(JSON.stringify(to)));
                 
        // define and set Event
        let Event = {
            type: "RefillBalance",
            to: to.name,
            balanceTo: to.balance,
            value: value
        };
        await ctx.stub.setEvent('RefillBalance', Buffer.from(JSON.stringify(Event)));
 
        // return to object
        return JSON.stringify(from);
    }
}
module.exports = CitcoinEvents;

Intuitively, txhua yam yuav tsum tau meej ntawm no:

  • Muaj ntau txoj haujlwm (AddAccount, GetAccounts, SendFrom, GetBalance, RefillBalance) uas qhov kev pab cuam demo yuav hu siv Hyperledger Fabric API.
  • Lub SendFrom thiab RefillBalance ua haujlwm tsim Cov Txheej Txheem uas qhov kev pab cuam demo yuav tau txais.
  • Qhov kev ua haujlwm instantiate hu ua ib zaug thaum daim ntawv cog lus ntse yog instantiated. Qhov tseeb, nws raug hu tsis yog ib zaug xwb, tab sis txhua zaus cov ntawv cog lus ntse hloov pauv. Yog li ntawd, pib ib daim ntawv teev npe nrog ib qho array khoob yog ib lub tswv yim phem, vim Tam sim no, thaum peb hloov lub version ntawm daim ntawv cog lus ntse, peb yuav poob cov npe tam sim no. Tab sis nws tsis ua li cas, kuv tsuas yog kawm).
  • Cov nyiaj thiab cov npe ntawm cov nyiaj yog JSON cov ntaub ntawv qauv. JS yog siv rau kev tswj cov ntaub ntawv.
  • Koj tuaj yeem tau txais tus nqi tam sim no ntawm cov cuab yeej cuab tam siv getState muaj nuj nqi hu, thiab hloov kho nws siv putState.
  • Thaum tsim ib tug Account, lub AddAccount muaj nuj nqi hu ua, nyob rau hauv uas ib tug sib piv yog tsim rau cov nyiaj ntau tshaj nyob rau hauv lub blockchain (maxAccounts = 5). Thiab ntawm no muaj ib qho jamb (koj puas tau pom?), uas ua rau muaj kev nce qib ntawm cov nyiaj. Tej kev ua yuam kev no yuav tsum zam)

Tom ntej no, peb thauj cov ntawv cog lus ntse rau hauv Channel thiab instantiate nws:

Blockchain: dab tsi PoC peb yuav tsum tsim?

Cia peb saib ntawm kev sib pauv rau kev txhim kho Smart Contract:

Blockchain: dab tsi PoC peb yuav tsum tsim?

Cia peb saib cov ntsiab lus ntawm peb Channel:

Blockchain: dab tsi PoC peb yuav tsum tsim?

Raws li qhov tshwm sim, peb tau txais daim duab hauv qab no ntawm blockchain network hauv IBM huab. Daim duab kos kuj qhia txog qhov kev ua haujlwm demo khiav hauv Amazon huab ntawm lub server virtual (ntau ntxiv txog nws nyob rau ntu tom ntej):

Blockchain: dab tsi PoC peb yuav tsum tsim?

Tsim GUI rau Hyperledger Fabric API hu

Hyperledger Fabric muaj API uas tuaj yeem siv rau:

  • Tsim channel;
  • Kev sib txuas ua phooj ywg rau channel;
  • Installation thiab instantiation ntawm ntse daim ntawv cog lus nyob rau hauv lub channel;
  • Hu rau kev lag luam;
  • Thov cov ntaub ntawv ntawm blockchain.

Kev txhim kho daim ntawv thov

Hauv peb qhov kev pab cuam demo peb yuav siv API tsuas yog hu rau kev lag luam thiab thov cov ntaub ntawv, vim Peb twb tau ua tiav cov kauj ruam ntxiv uas siv IBM blockchain platform. Peb sau GUI siv cov txheej txheem thev naus laus zis: Express.js + Vue.js + Node.js. Koj tuaj yeem sau ib tsab xov xwm cais txog yuav ua li cas pib tsim cov ntawv thov web niaj hnub. Ntawm no kuv yuav tso ib qhov txuas mus rau cov lus qhuab qhia uas kuv nyiam tshaj plaws: Puv Stack Web App siv Vue.js & Express.js. Qhov tshwm sim yog daim ntawv thov tus neeg siv-server nrog kev paub graphical interface hauv Google's Material Design style. REST API ntawm cov neeg siv khoom thiab cov neeg rau zaub mov muaj ob peb hu:

  • HyperledgerDemo/v1/init - pib lub blockchain;
  • HyperledgerDemo/v1/accounts/list β€” tau ib daim ntawv teev tag nrho cov account;
  • HyperledgerDemo/v1/account?name=Bob&balance=100 β€” tsim Bob account;
  • HyperledgerDemo/v1/info?account=Bob β€” tau cov ntaub ntawv hais txog Bob account;
  • HyperledgerDemo/v1/transaction?from=Bob&to=Alice&volume=2 - hloov ob lub npib los ntawm Bob rau Alice;
  • HyperledgerDemo/v1/disconnect - kaw qhov kev twb kev txuas rau lub blockchain.

Kev piav qhia ntawm API nrog cov piv txwv suav nrog hauv Postman lub vev xaib - qhov kev pab cuam paub zoo rau kev sim HTTP API.

Demo daim ntawv thov hauv Amazon huab

Kuv upload daim ntawv thov rau Amazon vim ... IBM tseem tsis tuaj yeem hloov kho kuv tus account thiab tso cai rau kuv los tsim cov servers virtual. Yuav ua li cas ntxiv ib tug cherry rau lub sau: www.citcoin.info. Kuv yuav khaws lub server rau ib ntus, ces tua nws, vim ... xees rau nqi xauj tsev yog dripping, thiab citcoin npib tseem tsis tau teev nyob rau hauv Tshuag pauv) Kuv suav nrog cov screenshots ntawm cov demo nyob rau hauv tsab xov xwm kom lub logic ntawm kev ua hauj lwm kom meej. Daim ntawv thov demo tuaj yeem:

  • Pib lub blockchain;
  • Tsim ib Tus Account (tab sis tam sim no koj tsis tuaj yeem tsim tus Account tshiab, vim tias qhov ntau tshaj ntawm cov nyiaj tau teev tseg hauv daim ntawv cog lus ntse tau mus txog hauv blockchain);
  • Tau txais cov npe ntawm Cov Nyiaj Txiag;
  • Hloov citcoin npib ntawm Alice, Bob thiab Alex;
  • Tau txais cov xwm txheej (tab sis tam sim no tsis muaj txoj hauv kev los qhia cov xwm txheej, yog li rau qhov yooj yim, lub interface hais tias cov xwm txheej tsis txaus siab);
  • Log ua.

Ua ntej peb pib lub blockchain:

Blockchain: dab tsi PoC peb yuav tsum tsim?

Tom ntej no, peb tsim peb tus account, tsis txhob nkim sij hawm nrog qhov nyiaj tshuav:

Blockchain: dab tsi PoC peb yuav tsum tsim?

Peb tau txais cov npe ntawm txhua tus account muaj:

Blockchain: dab tsi PoC peb yuav tsum tsim?

Peb xaiv tus xa thiab tus neeg txais, thiab tau txais lawv cov nyiaj tshuav. Yog tias tus neeg xa khoom thiab tus neeg tau txais zoo ib yam, ces nws tus account yuav raug muab ntxiv:

Blockchain: dab tsi PoC peb yuav tsum tsim?

Nyob rau hauv lub log peb saib xyuas qhov ua tiav ntawm kev hloov pauv:

Blockchain: dab tsi PoC peb yuav tsum tsim?

Qhov tseeb, qhov ntawd yog txhua yam nrog qhov kev pab cuam demo. Hauv qab no koj tuaj yeem pom peb qhov kev lag luam hauv blockchain:

Blockchain: dab tsi PoC peb yuav tsum tsim?

Thiab cov npe dav dav ntawm kev lag luam:

Blockchain: dab tsi PoC peb yuav tsum tsim?

Nrog rau qhov no, peb tau ua tiav qhov kev siv ntawm PoC los tsim Citcoin network. Yuav ua li cas lwm yam yuav tsum tau ua rau Citcoin los ua ib tug tag nrho-fledged network rau hloov npib? Tsawg heev:

  • Nyob rau theem tsim tus as khauj, siv lub cim ntawm tus kheej / pej xeem tus yuam sij. Tus yuam sij ntiag tug yuav tsum muab khaws cia nrog tus neeg siv nyiaj, tus yuam sij pej xeem yuav tsum muab khaws cia hauv blockchain.
  • Ua ib lub npib hloov pauv uas tus yuam sij pej xeem, tsis yog lub npe, siv los txheeb xyuas tus neeg siv.
  • Nkag mus rau kev lag luam los ntawm tus neeg siv mus rau lub server nrog nws tus yuam sij ntiag tug.

xaus

Peb tau siv Citcoin network nrog cov haujlwm hauv qab no: ntxiv ib tus as-qhauj, tau txais qhov nyiaj tshuav, sau koj tus lej nyiaj, hloov nyiaj npib los ntawm ib tus account mus rau lwm tus. Yog li, nws tau them nqi dab tsi rau peb los tsim PoC?

  • Koj yuav tsum kawm blockchain feem ntau thiab Hyperledger Fabric tshwj xeeb;
  • Kawm siv IBM lossis Amazon huab;
  • Kawm cov lus JS programming thiab qee lub vev xaib;
  • Yog tias qee cov ntaub ntawv xav tau khaws cia tsis nyob hauv blockchain, tab sis nyob rau hauv ib qho kev sib cais database, ces kawm ua ke, piv txwv li, nrog PostgreSQL;
  • Thiab qhov kawg tab sis tsis kawg - koj tsis tuaj yeem nyob hauv lub ntiaj teb niaj hnub tsis muaj kev paub txog Linux!)

Tau kawg, nws tsis yog foob pob hluav taws kev tshawb fawb, tab sis koj yuav tsum tau ua haujlwm hnyav!

Cov peev txheej ntawm GitHub

Qhov chaw muab tso rau GitHub. Cov lus piav qhia luv luv ntawm lub chaw khaws cia:
Catalog Β«neeg rau zaub movΒ» β€” Node.js server
Catalog Β«neegΒ» β€” Node.js tus thov kev pab
Catalog Β«blockchain"(qhov tseem ceeb thiab cov yuam sij, ntawm chav kawm, tsis ua haujlwm thiab tsuas yog muab ua piv txwv):

  • daim ntawv cog lus - daim ntawv cog lus ntse qhov chaws
  • hnab nyiaj - tus neeg siv cov yuam sij rau kev siv Hyperledger Fabric API.
  • *.cds - muab tso ua ke ntawm cov ntawv cog lus ntse
  • *.json cov ntaub ntawv - piv txwv ntawm cov ntaub ntawv teeb tsa rau kev siv Hyperledger Fabric API

Nws tsuas yog qhov pib xwb!

Tau qhov twg los: www.hab.com

Ntxiv ib saib