1. 程式人生 > >區塊鏈教程Fabric1.0原始碼分析Fabric1.0.4go程式碼量統計

區塊鏈教程Fabric1.0原始碼分析Fabric1.0.4go程式碼量統計

  區塊鏈教程Fabric1.0原始碼分析Fabric1.0.4go程式碼量統計,2018年下半年,區塊鏈行業正逐漸褪去發展之初的浮躁、迴歸理性,表面上看相關人才需求與身價似乎正在回落。但事實上,正是初期泡沫的漸退,讓人們更多的關注點放在了區塊鏈真正的技術之上。

Fabric 1.0原始碼筆記 之Fabric 1.0.4 go程式碼量統計

1、概述

除test、vendor、mocks、example、protos外,go核心程式碼檔案341個,核心程式碼行63433行。

find ./ |grep -vE 'test|vendor|mocks|example|protos' | grep '\.go$' | wc -l
341
wc -l `find ./ |grep -vE 'test|vendor|mocks|example|protos' | grep '\.go$'`
63433 total

2、程式碼分佈

<TABLE>
<TR>
  <TD>目錄</TD>
  <TD>程式碼量</TD>
  <TD>程式碼量佔比</TD>
</TR>
<TR>
  <TD>bccsp</TD>
  <TD>5605</TD>
  <TD>8.84%</TD>
</TR>
<TR>
  <TD>common</TD>
  <TD>12998</TD>
  <TD>20.49%</TD>
</TR>
<TR>
  <TD>core</TD>
  <TD>22613</TD>
  <TD>35.65%</TD>
</TR>
<TR>
  <TD>events</TD>
  <TD>1069</TD>
  <TD>1.69%</TD>
</TR>
<TR>
  <TD>gossip</TD>
  <TD>9389</TD>
  <TD>14.80%</TD>
</TR>
<TR>
  <TD>msp</TD>
  <TD>2425</TD>
  <TD>3.82%</TD>
</TR>
<TR>
  <TD>orderer</TD>
  <TD>5199</TD>
  <TD>8.20%</TD>
</TR>
<TR>
  <TD>peer</TD>
  <TD>4135</TD>
  <TD>6.52%</TD>
</TR>
</TABLE>

3、詳情

     65 ./bccsp/aesopts.go
    144 ./bccsp/bccsp.go
     49 ./bccsp/ecdsaopts.go
     93 ./bccsp/factory/factory.go
     87 ./bccsp/factory/nopkcs11.go
     35 ./bccsp/factory/opts.go
    106 ./bccsp/factory/pkcs11.go
     66 ./bccsp/factory/pkcs11factory.go
     82 ./bccsp/factory/swfactory.go
     70 ./bccsp/hashopts.go
     34 ./bccsp/keystore.go
    326 ./bccsp/opts.go
    108 ./bccsp/pkcs11/conf.go
    120 ./bccsp/pkcs11/ecdsa.go
     97 ./bccsp/pkcs11/ecdsakey.go
    535 ./bccsp/pkcs11/impl.go
    617 ./bccsp/pkcs11/pkcs11.go
     81 ./bccsp/rsaopts.go
     89 ./bccsp/signer/signer.go
    161 ./bccsp/sw/aes.go
     65 ./bccsp/sw/aeskey.go
     81 ./bccsp/sw/conf.go
     49 ./bccsp/sw/dummyks.go
    171 ./bccsp/sw/ecdsa.go
    120 ./bccsp/sw/ecdsakey.go
    431 ./bccsp/sw/fileks.go
     37 ./bccsp/sw/hash.go
    393 ./bccsp/sw/impl.go
     94 ./bccsp/sw/internals.go
    157 ./bccsp/sw/keyderiv.go
     67 ./bccsp/sw/keygen.go
    162 ./bccsp/sw/keyimport.go
     72 ./bccsp/sw/rsa.go
    136 ./bccsp/sw/rsakey.go
     26 ./bccsp/utils/errs.go
     69 ./bccsp/utils/io.go
    459 ./bccsp/utils/keys.go
     25 ./bccsp/utils/slice.go
     26 ./bccsp/utils/x509.go
    119 ./common/cauthdsl/cauthdsl.go
    174 ./common/cauthdsl/cauthdsl_builder.go
     68 ./common/cauthdsl/policy.go
     34 ./common/cauthdsl/policy_util.go
    279 ./common/cauthdsl/policyparser.go
    115 ./common/config/api.go
     96 ./common/config/application.go
     38 ./common/config/application_util.go
     94 ./common/config/applicationorg.go
    241 ./common/config/channel.go
     74 ./common/config/channel_util.go
    128 ./common/config/consortium.go
     99 ./common/config/consortiums.go
     44 ./common/config/consortiums_util.go
    150 ./common/config/msp/config.go
    108 ./common/config/msp/config_util.go
    247 ./common/config/orderer.go
     57 ./common/config/orderer_util.go
    129 ./common/config/organization.go
    152 ./common/config/proposer.go
     93 ./common/config/root.go
    105 ./common/config/standardvalues.go
    114 ./common/configtx/api/api.go
    186 ./common/configtx/compare.go
    282 ./common/configtx/config.go
    168 ./common/configtx/configmap.go
    155 ./common/configtx/initializer.go
    305 ./common/configtx/manager.go
    291 ./common/configtx/template.go
    412 ./common/configtx/tool/configtxgen/main.go
     38 ./common/configtx/tool/configtxgen/metadata/metadata.go
    268 ./common/configtx/tool/localconfig/config.go
    276 ./common/configtx/tool/provisional/provisional.go
    208 ./common/configtx/update.go
     99 ./common/configtx/util.go
     42 ./common/crypto/random.go
     28 ./common/crypto/signer.go
    104 ./common/errors/codes.go
    204 ./common/errors/errors.go
     61 ./common/flogging/grpclogger.go
    233 ./common/flogging/logging.go
     75 ./common/genesis/genesis.go
     75 ./common/ledger/blkstorage/blockstorage.go
    218 ./common/ledger/blkstorage/fsblkstorage/block_serialization.go
    209 ./common/ledger/blkstorage/fsblkstorage/block_stream.go
    117 ./common/ledger/blkstorage/fsblkstorage/blockfile_helper.go
    696 ./common/ledger/blkstorage/fsblkstorage/blockfile_mgr.go
     94 ./common/ledger/blkstorage/fsblkstorage/blockfile_rw.go
    381 ./common/ledger/blkstorage/fsblkstorage/blockindex.go
    101 ./common/ledger/blkstorage/fsblkstorage/blocks_itr.go
     54 ./common/ledger/blkstorage/fsblkstorage/config.go
     93 ./common/ledger/blkstorage/fsblkstorage/fs_blockstore.go
     65 ./common/ledger/blkstorage/fsblkstorage/fs_blockstore_provider.go
     53 ./common/ledger/ledger_interface.go
     99 ./common/ledger/util/ioutil.go
    165 ./common/ledger/util/leveldbhelper/leveldb_helper.go
    152 ./common/ledger/util/leveldbhelper/leveldb_provider.go
     56 ./common/ledger/util/protobuf_util.go
     62 ./common/ledger/util/util.go
     74 ./common/localmsp/signer.go
     24 ./common/metadata/metadata.go
     83 ./common/policies/implicitmeta.go
     69 ./common/policies/implicitmeta_util.go
    376 ./common/policies/policy.go
     66 ./common/tools/configtxlator/main.go
     32 ./common/tools/configtxlator/metadata/metadata.go
    125 ./common/tools/configtxlator/rest/configtxlator_handlers.go
    109 ./common/tools/configtxlator/rest/protolator_handlers.go
     40 ./common/tools/configtxlator/rest/router.go
    147 ./common/tools/configtxlator/sanitycheck/sanitycheck.go
    234 ./common/tools/configtxlator/update/update.go
    175 ./common/tools/cryptogen/ca/generator.go
     77 ./common/tools/cryptogen/csp/csp.go
    568 ./common/tools/cryptogen/main.go
     32 ./common/tools/cryptogen/metadata/metadata.go
    224 ./common/tools/cryptogen/msp/generator.go
    157 ./common/tools/protolator/api.go
    149 ./common/tools/protolator/dynamic.go
    445 ./common/tools/protolator/json.go
    111 ./common/tools/protolator/nested.go
    152 ./common/tools/protolator/statically_opaque.go
    124 ./common/tools/protolator/variably_opaque.go
    195 ./common/util/utils.go
    327 ./common/viperutil/config_util.go
     73 ./core/admin.go
    122 ./core/chaincode/ccproviderimpl.go
    759 ./core/chaincode/chaincode_support.go
     91 ./core/chaincode/chaincodeexec.go
    106 ./core/chaincode/exectransaction.go
   1459 ./core/chaincode/handler.go
     91 ./core/chaincode/platforms/car/platform.go
     89 ./core/chaincode/platforms/golang/env.go
     84 ./core/chaincode/platforms/golang/list.go
    149 ./core/chaincode/platforms/golang/package.go
    462 ./core/chaincode/platforms/golang/platform.go
     89 ./core/chaincode/platforms/java/hash.go
     48 ./core/chaincode/platforms/java/package.go
    148 ./core/chaincode/platforms/java/platform.go
    227 ./core/chaincode/platforms/platforms.go
    247 ./core/chaincode/platforms/util/utils.go
    882 ./core/chaincode/shim/chaincode.go
    807 ./core/chaincode/shim/handler.go
     45 ./core/chaincode/shim/inprocstream.go
    235 ./core/chaincode/shim/interfaces.go
     46 ./core/chaincode/shim/response.go
    127 ./core/comm/config.go
    215 ./core/comm/connection.go
     80 ./core/comm/creds.go
    101 ./core/comm/producer.go
    364 ./core/comm/server.go
     41 ./core/committer/committer.go
    130 ./core/committer/committer_impl.go
    673 ./core/committer/txvalidator/validator.go
    245 ./core/common/ccpackage/ccpackage.go
     70 ./core/common/ccprovider/ccinfocache.go
    466 ./core/common/ccprovider/ccprovider.go
    282 ./core/common/ccprovider/cdspackage.go
    346 ./core/common/ccprovider/sigcdspackage.go
     79 ./core/common/sysccprovider/sysccprovider.go
    435 ./core/common/validation/msgvalidation.go
    191 ./core/config/config.go
     37 ./core/container/api/core.go
     76 ./core/container/ccintf/ccintf.go
    266 ./core/container/controller.go
    473 ./core/container/dockercontroller/dockercontroller.go
    252 ./core/container/inproccontroller/inproccontroller.go
     41 ./core/container/inproccontroller/inprocstream.go
     72 ./core/container/util/dockerutil.go
    171 ./core/container/util/writer.go
    101 ./core/container/vm.go
    230 ./core/deliverservice/blocksprovider/blocksprovider.go
    246 ./core/deliverservice/client.go
    231 ./core/deliverservice/deliveryclient.go
     88 ./core/deliverservice/requester.go
    537 ./core/endorser/endorser.go
     72 ./core/fsm.go
     60 ./core/ledger/kvledger/history/historydb/histmgr_helper.go
     41 ./core/ledger/kvledger/history/historydb/historydb.go
    217 ./core/ledger/kvledger/history/historydb/historyleveldb/historyleveldb.go
    155 ./core/ledger/kvledger/history/historydb/historyleveldb/historyleveldb_query_executer.go
    247 ./core/ledger/kvledger/kv_ledger.go
    341 ./core/ledger/kvledger/kv_ledger_provider.go
     33 ./core/ledger/kvledger/recovery.go
    268 ./core/ledger/kvledger/txmgmt/rwsetutil/query_results_helper.go
    123 ./core/ledger/kvledger/txmgmt/rwsetutil/rwset_builder.go
    103 ./core/ledger/kvledger/txmgmt/rwsetutil/rwset_proto_util.go
    264 ./core/ledger/kvledger/txmgmt/statedb/statecouchdb/query_wrapper.go
    492 ./core/ledger/kvledger/txmgmt/statedb/statecouchdb/statecouchdb.go
    229 ./core/ledger/kvledger/txmgmt/statedb/statedb.go
    206 ./core/ledger/kvledger/txmgmt/statedb/stateleveldb/stateleveldb.go
     35 ./core/ledger/kvledger/txmgmt/statedb/util.go
    244 ./core/ledger/kvledger/txmgmt/txmgr/lockbasedtxmgr/helper.go
     64 ./core/ledger/kvledger/txmgmt/txmgr/lockbasedtxmgr/lockbased_query_executer.go
     83 ./core/ledger/kvledger/txmgmt/txmgr/lockbasedtxmgr/lockbased_tx_simulator.go
    133 ./core/ledger/kvledger/txmgmt/txmgr/lockbasedtxmgr/lockbased_txmgr.go
     36 ./core/ledger/kvledger/txmgmt/txmgr/txmgr.go
    174 ./core/ledger/kvledger/txmgmt/validator/statebasedval/combined_iterator.go
    157 ./core/ledger/kvledger/txmgmt/validator/statebasedval/range_query_validator.go
    252 ./core/ledger/kvledger/txmgmt/validator/statebasedval/state_based_validator.go
     27 ./core/ledger/kvledger/txmgmt/validator/validator.go
     75 ./core/ledger/kvledger/txmgmt/version/version.go
    127 ./core/ledger/ledger_interface.go
     93 ./core/ledger/ledgerconfig/ledger_config.go
    160 ./core/ledger/ledgermgmt/ledger_mgmt.go
     46 ./core/ledger/util/couchdb/config.go
   1426 ./core/ledger/util/couchdb/couchdb.go
    169 ./core/ledger/util/couchdb/couchdbutil.go
     55 ./core/ledger/util/txvalidationflags.go
     34 ./core/ledger/util/util.go
    150 ./core/peer/config.go
    562 ./core/peer/peer.go
    210 ./core/policy/policy.go
     43 ./core/policyprovider/provider.go
    235 ./core/scc/cscc/configure.go
    179 ./core/scc/escc/endorser_onevalidsignature.go
    144 ./core/scc/importsysccs.go
    905 ./core/scc/lscc/lscc.go
    218 ./core/scc/qscc/query.go
     91 ./core/scc/samplesyscc/samplesyscc.go
     73 ./core/scc/sccproviderimpl.go
    178 ./core/scc/sysccapi.go
    459 ./core/scc/vscc/validator_onevalidsignature.go
     29 ./events/consumer/adapter.go
    256 ./events/consumer/consumer.go
    123 ./events/producer/eventhelper.go
    345 ./events/producer/events.go
    188 ./events/producer/handler.go
     72 ./events/producer/producer.go
     56 ./events/producer/register_internal_events.go
     71 ./gossip/api/channel.go
     71 ./gossip/api/crypto.go
     68 ./gossip/comm/comm.go
    642 ./gossip/comm/comm_impl.go
    381 ./gossip/comm/conn.go
    122 ./gossip/comm/crypto.go
     97 ./gossip/comm/demux.go
    195 ./gossip/comm/mock/mock_comm.go
     58 ./gossip/comm/msg.go
     64 ./gossip/common/common.go
    140 ./gossip/discovery/discovery.go
   1044 ./gossip/discovery/discovery_impl.go
    171 ./gossip/election/adapter.go
    487 ./gossip/election/election.go
     77 ./gossip/filter/filter.go
    344 ./gossip/gossip/algo/pull.go
    148 ./gossip/gossip/batcher.go
    156 ./gossip/gossip/certstore.go
    733 ./gossip/gossip/channel/channel.go
    168 ./gossip/gossip/chanstate.go
     97 ./gossip/gossip/gossip.go
   1257 ./gossip/gossip/gossip_impl.go
    279 ./gossip/gossip/msgstore/msgs.go
    378 ./gossip/gossip/pull/pullstore.go
    214 ./gossip/identity/identity.go
     94 ./gossip/integration/integration.go
    120 ./gossip/service/eventer.go
    322 ./gossip/service/gossip_service.go
     72 ./gossip/state/metastate.go
    144 ./gossip/state/payloads_buffer.go
    689 ./gossip/state/state.go
     69 ./gossip/util/logging.go
    202 ./gossip/util/misc.go
     82 ./gossip/util/msgs.go
    133 ./gossip/util/pubsub.go
    146 ./msp/cert.go
    278 ./msp/configbuilder.go
    218 ./msp/identities.go
     69 ./msp/mgmt/deserializer.go
    172 ./msp/mgmt/mgmt.go
     73 ./msp/mgmt/principal.go
    190 ./msp/msp.go
   1172 ./msp/mspimpl.go
    107 ./msp/mspmgrimpl.go
    165 ./orderer/common/blockcutter/blockcutter.go
     28 ./orderer/common/bootstrap/bootstrap.go
     53 ./orderer/common/bootstrap/file/bootstrap.go
    162 ./orderer/common/broadcast/broadcast.go
     90 ./orderer/common/configtxfilter/filter.go
    223 ./orderer/common/deliver/deliver.go
    107 ./orderer/common/filter/filter.go
     75 ./orderer/common/sigfilter/sigfilter.go
     53 ./orderer/common/sizefilter/sizefilter.go
    150 ./orderer/configupdate/configupdate.go
    503 ./orderer/kafka/chain.go
     58 ./orderer/kafka/channel.go
     78 ./orderer/kafka/config.go
     76 ./orderer/kafka/consenter.go
     32 ./orderer/kafka/partitioner.go
     86 ./orderer/kafka/retry.go
     78 ./orderer/ledger/file/factory.go
    111 ./orderer/ledger/file/impl.go
    160 ./orderer/ledger/json/factory.go
    177 ./orderer/ledger/json/impl.go
     65 ./orderer/ledger/ledger.go
     97 ./orderer/ledger/ram/factory.go
    171 ./orderer/ledger/ram/impl.go
    105 ./orderer/ledger/util.go
    365 ./orderer/localconfig/config.go
    221 ./orderer/main.go
     35 ./orderer/metadata/metadata.go
    296 ./orderer/multichain/chainsupport.go
    319 ./orderer/multichain/manager.go
    189 ./orderer/multichain/systemchain.go
    126 ./orderer/sample_clients/broadcast_config/client.go
     31 ./orderer/sample_clients/broadcast_config/newchain.go
    105 ./orderer/sample_clients/broadcast_timestamp/client.go
    144 ./orderer/sample_clients/deliver_stdout/client.go
    166 ./orderer/sample_clients/single_tx_client/single_tx_client.go
     94 ./orderer/server.go
    120 ./orderer/solo/consensus.go
     85 ./orderer/util.go
    130 ./peer/chaincode/chaincode.go
    348 ./peer/chaincode/common.go
    210 ./peer/chaincode/install.go
    129 ./peer/chaincode/instantiate.go
     59 ./peer/chaincode/invoke.go
    193 ./peer/chaincode/package.go
     64 ./peer/chaincode/query.go
     77 ./peer/chaincode/signpackage.go
    132 ./peer/chaincode/upgrade.go
    188 ./peer/channel/channel.go
    214 ./peer/channel/create.go
    152 ./peer/channel/deliverclient.go
    110 ./peer/channel/fetchconfig.go
    144 ./peer/channel/join.go
    112 ./peer/channel/list.go
     90 ./peer/channel/update.go
     73 ./peer/clilogging/common.go
     55 ./peer/clilogging/getlevel.go
     48 ./peer/clilogging/logging.go
     55 ./peer/clilogging/revertlevels.go
     55 ./peer/clilogging/setlevel.go
    230 ./peer/common/common.go
     96 ./peer/common/mockclient.go
    103 ./peer/common/ordererclient.go
    319 ./peer/gossip/mcs.go
     88 ./peer/gossip/sa.go
    122 ./peer/main.go
     46 ./peer/node/node.go
    382 ./peer/node/start.go
     60 ./peer/node/status.go
     51 ./peer/version/version.go
  63433 total

-