{"id":301736,"date":"2020-04-13T03:00:14","date_gmt":"2020-04-13T03:00:14","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=301736"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=301736","title":{"rendered":"\u041d\u043e\u0432\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c Hyperledger Fabric: Go SDK"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/496872\/\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/sb\/qw\/s8\/sbqws8367mab59tnf8ln9jliky0.png\"><\/div>\n<p>  \u0412 <a href=\"https:\/\/habr.com\/ru\/post\/494880\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438 \u043e \u043d\u043e\u0432\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0447\u0435\u0439\u043d\u043a\u043e\u0434\u0430 \u0432 Hyperledger Fabric. \u0418 \u0445\u043e\u0442\u044f \u0440\u0435\u043b\u0438\u0437 \u043d\u043e\u0432\u043e\u0433\u043e Go SDK \u0435\u0449\u0451 \u043d\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043b\u0441\u044f, \u043d\u0438\u0447\u0442\u043e \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u043d\u0430\u043c \u0443\u0436\u0435 \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0447\u0442\u043e \u043d\u0430\u0441 \u0436\u0434\u0435\u0442 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0435\u043b\u0438\u0437\u0435, \u0438 \u0434\u0430\u0436\u0435 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u043e \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0435. \u041d\u0435 \u0432\u0441\u0451 \u0435\u0449\u0451 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e (\u043a\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/github.com\/hyperledger\/fabric-sdk-go\/blob\/master\/pkg\/gateway\/defaultcommithandlers.go#L50\" rel=\"nofollow\">commit handlers<\/a>), \u043d\u043e \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u0434\u0438\u0437\u0430\u0439\u043d \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0443\u0436\u0435 \u044f\u0441\u0435\u043d, \u0442\u0430\u043a \u0447\u0442\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u043d\u0435\u0433\u043e \u0431\u043b\u0438\u0436\u0435.<br \/>  <a name=\"habracut\"><\/a><br \/>  <a href=\"https:\/\/github.com\/VadimInshakov\/new-programming-model-sdk-tutorial\" rel=\"nofollow\">\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/a> \u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043b \u0441\u0435\u043c\u043f\u043b\u043e\u0432\u0443\u044e \u0441\u0435\u0442\u043a\u0443, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0430\u0441\u044c \u0441 \u0447\u0435\u0439\u043d\u043a\u043e\u0434\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0432\u0438\u0434\u0435\u043b\u0438 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043d\u043e\u0432\u043e\u0433\u043e API. \u0412 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0443 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u0441\u0435\u0442\u0438.<\/p>\n<p>  \u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c \u0432 <a href=\"https:\/\/github.com\/VadimInshakov\/new-programming-model-sdk-tutorial\/blob\/master\/app\/go.mod\" rel=\"nofollow\">go.mod<\/a>, \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e API \u043c\u044b \u0431\u0435\u0440\u0435\u043c \u043d\u0435 \u0440\u0435\u043b\u0438\u0437 (\u0440\u0435\u043b\u0438\u0437\u0430 \u0435\u0449\u0451 \u043d\u0435\u0442), \u0430 \u0432\u0441\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0434\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043a\u043e\u043c\u043c\u0438\u0442\u0430 (\u044d\u0442\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043c\u0435\u0440\u0430 \u0434\u043e \u0432\u044b\u043f\u0443\u0441\u043a\u0430 \u0440\u0435\u043b\u0438\u0437\u0430):<\/p>\n<p>  <code>require github.com\/hyperledger\/fabric-sdk-go v1.0.0-beta1.0.20200404205634-0e550fc1a918<br \/>  <\/code><br \/>  \u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0432 <a href=\"https:\/\/github.com\/VadimInshakov\/new-programming-model-sdk-tutorial\/blob\/master\/app\/app.go\" rel=\"nofollow\">app.go<\/a> \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043f\u0430\u043a\u0435\u0442 gateway<\/p>\n<p>  <code>&quot;github.com\/hyperledger\/fabric-sdk-go\/pkg\/gateway&quot;<\/code><\/p>\n<p>  \u0421\u0443\u0442\u044c \u043d\u043e\u0432\u043e\u0433\u043e API \u0432 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0435\u0434\u0438\u043d\u044b\u0445 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 SDK (go, node, java) \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0439 \u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u0435 \u0431\u043e\u0439\u043b\u0435\u0440\u043f\u043b\u0435\u0439\u0442\u0430, \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c \u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442. \u041e\u0434\u043d\u0430 \u0438\u0437 \u0442\u0430\u043a\u0438\u0445 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0439 \u2014 <b>Wallet<\/b>. \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f wallet&#8217;a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"go\">wallet, err := gateway.NewFileSystemWallet(&quot;wallet&quot;) if err != nil { \tfmt.Errorf(err.Error()) }  err = wallet.Put(&quot;admin&quot;, gateway.NewX509Identity(&quot;Org1MSP&quot;, string(cert), string(privKey))) if err != nil { \tfmt.Errorf(err.Error()) } <\/code><\/pre>\n<p>  Wallet \u2014 \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 WalletStore:<\/p>\n<pre><code class=\"go\">type WalletStore interface { \tPut(label string, stream []byte) error \tGet(label string) ([]byte, error) \tList() ([]string, error) \tExists(label string) bool \tRemove(label string) error }<\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u044d\u0442\u043e\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\u043c <a href=\"https:\/\/github.com\/hyperledger\/fabric-sdk-go\/blob\/master\/pkg\/gateway\/x509identity.go\" rel=\"nofollow\">identity<\/a> \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439. \u041a\u0440\u043e\u043c\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b identity \u043c\u043e\u0436\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0434\u0440\u0443\u0433\u0443\u044e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u0444\u0430\u0431\u0440\u0438\u043a\u0443 \u2014 <b>NewInMemoryWallet()<\/b>.<\/p>\n<p>  \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a \u0441\u0435\u0442\u0438:<\/p>\n<pre><code class=\"go\">gw, err := gateway.Connect(gateway.WithConfig(config.FromFile(&quot;.\/..\/connection-org1.yaml&quot;)), gateway.WithIdentity(wallet, &quot;admin&quot;), gateway.WithDiscovery(true), gateway.WithCommitHandler(gateway.DefaultCommitHandlers.OrgAny))<\/code><\/pre>\n<p>  <i>gateway.Connect()<\/i> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 <b>Gateway<\/b> \u2014 \u043e\u0431\u044a\u0435\u043a\u0442, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a \u0441\u0435\u0442\u0438. <i>gateway.WithCommitHandler<\/i> \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u043e\u043f\u0446\u0438\u044f \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u043a\u043e\u043c\u043c\u0438\u0442\u0430. \u041f\u043e\u043a\u0430 \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u043d\u0438\u043a\u0430\u043a\u0430\u044f \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f (\u0437\u043d\u0430\u0447\u0438\u0442 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f <a href=\"https:\/\/github.com\/hyperledger\/fabric-sdk-go\/blob\/0e550fc1a918fe8914d36f30dfb9c7a50798d479\/pkg\/client\/channel\/invoke\/txnhandler.go#L167\" rel=\"nofollow\">\u0434\u0435\u0444\u043e\u043b\u0442\u043d\u0430\u044f<\/a> \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f \u00ab\u0441\u0442\u0430\u0440\u043e\u0433\u043e\u00bb SDK <a href=\"https:\/\/github.com\/hyperledger\/fabric-sdk-go\/blob\/0e550fc1a918fe8914d36f30dfb9c7a50798d479\/pkg\/fab\/events\/service\/service.go#L243\" rel=\"nofollow\">\u00ab\u043e\u0434\u0438\u043d \u043a\u043e\u043c\u043c\u0438\u0442 \u043e\u0442 \u043b\u044e\u0431\u043e\u0433\u043e \u044d\u043d\u0434\u043e\u0440\u0441\u0435\u0440\u0430\u00bb<\/a>), \u043d\u043e \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<ul>\n<li>`gateway.DefaultCommitHandlers.OrgAll` \u2014 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u043c\u0438\u0442\u0430 \u043d\u0430 \u0432\u0441\u0435\u0445 \u043f\u0438\u0440\u0430\u0445 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e)<\/li>\n<li>`gateway.DefaultCommitHandlers.OrgAny` \u2014 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u043c\u0438\u0442\u0430 \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u043f\u0438\u0440\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438<\/li>\n<li>`gateway.DefaultCommitHandlers.NetworkAll` \u2014 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u043c\u0438\u0442\u0430 \u043d\u0430 \u0432\u0441\u0435\u0445 \u043f\u0438\u0440\u0430\u0445 \u0432\u0441\u0435\u0445 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0439 \u0432 \u043a\u0430\u043d\u0430\u043b\u0435<\/li>\n<li>`gateway.DefaultCommitHandlers.NetworkAny` \u2014 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u043c\u0438\u0442\u0430 \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u043f\u0438\u0440\u0435 \u0432 \u043a\u0430\u043d\u0430\u043b\u0435<\/li>\n<\/ul>\n<p>  \u041c\u043e\u0436\u043d\u043e \u0434\u0430\u0436\u0435 \u043d\u0435 \u0436\u0434\u0430\u0442\u044c \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043a\u043e\u043c\u043c\u0438\u0442\u043e\u0432, \u043e\u0431 \u044d\u0442\u043e\u043c \u0434\u0430\u043b\u0435\u0435, \u043d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u044d\u0442\u043e:<\/p>\n<pre><code class=\"go\">network, err := gw.GetNetwork(&quot;mychannel&quot;) if err != nil { \tpanic(err) }  contract := network.GetContract(&quot;mycc&quot;)<\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0437 \u043a\u0430\u043d\u0430\u043b\u0430 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0438\u0440\u043e\u0432, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0431\u0443\u0434\u0435\u043c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c, \u0430 \u0437\u0430\u0442\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 Contract, \u043c\u0435\u0442\u043e\u0434\u044b \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0442 \u043d\u0430\u043c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u0447\u0435\u0439\u043d\u043a\u043e\u0434\u043e\u043c. <\/p>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u0441\u0442\u043e\u0438\u0442 \u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044e \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u043a\u043e\u043c\u043c\u0438\u0442\u0430. <\/p>\n<pre><code class=\"go\">result, err := contract.SubmitTransaction(&quot;Create&quot;, &quot;b&quot;, &quot;50&quot;)<\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u043d\u0430 \u043f\u0438\u0440\u0435, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0442\u0432\u0435\u0442, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c proposal response \u043d\u0430 orderer, \u0434\u043e\u0436\u0438\u0434\u0430\u0435\u043c\u0441\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0438 \u043a\u043e\u043c\u043c\u0438\u0442\u0430 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0432\u044b\u0448\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0435\u0439 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u043a\u043e\u043c\u043c\u0438\u0442\u0430. \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u0438 \u0437\u043d\u0430\u043a\u043e\u043c\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u0421\u043c\u043e\u0442\u0440\u0438\u043c \u0434\u0430\u043b\u0435\u0435.<\/p>\n<pre><code class=\"go\">result, err := contract.EvaluateTransaction(&quot;Read&quot;, &quot;b&quot;) \tif err != nil { \t\tpanic(err) \t} fmt.Println(string(result))<\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043a\u043b\u0438\u0435\u043d\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 proposal response \u0438 \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0438\u0447\u0435\u0433\u043e. \u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f.<\/p>\n<pre><code class=\"go\">transient := make(map[string][]byte) transient[&quot;someTransient&quot;] = []byte(&quot;mytransientdata&quot;) txn, err := contract.CreateTransaction(&quot;Update&quot;, gateway.WithTransient(transient)) if err != nil { \tpanic(err) } result, err = txn.Submit(&quot;b&quot;, &quot;100&quot;) if err != nil { \tpanic(err) } <\/code><\/pre>\n<p>  <i>contract.CreateTransaction<\/i> \u0434\u0430\u0435\u0442 \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u043d\u0430\u0434 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0435\u0439, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u043f\u0446\u0438\u0438:<\/p>\n<ul>\n<li>gateway.WithTransient(transient) \u2014 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/li>\n<li>gateway.WithEndorsingPeers(\u00abpeer0.org1.example.com\u00bb) \u2014 \u0434\u043b\u044f \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f targets<\/li>\n<\/ul>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u043e\u0431\u0437\u043e\u0440 \u043d\u043e\u0432\u043e\u0433\u043e API \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f. \u041a\u0441\u0442\u0430\u0442\u0438, \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 wallet, commit handlers, identity \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043b\u0435\u0433\u043a\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0435\u043c, \u0447\u0442\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u0430\u0448\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0430\u043c, \u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0443 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0438\u0434\u0435\u0438 \u0438 \u043a\u043e\u0434.<\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/496872\/\"> https:\/\/habr.com\/ru\/post\/496872\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/496872\/\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/sb\/qw\/s8\/sbqws8367mab59tnf8ln9jliky0.png\"><\/div>\n<p>  \u0412 <a href=\"https:\/\/habr.com\/ru\/post\/494880\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438 \u043e \u043d\u043e\u0432\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0447\u0435\u0439\u043d\u043a\u043e\u0434\u0430 \u0432 Hyperledger Fabric. \u0418 \u0445\u043e\u0442\u044f \u0440\u0435\u043b\u0438\u0437 \u043d\u043e\u0432\u043e\u0433\u043e Go SDK \u0435\u0449\u0451 \u043d\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043b\u0441\u044f, \u043d\u0438\u0447\u0442\u043e \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u043d\u0430\u043c \u0443\u0436\u0435 \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0447\u0442\u043e \u043d\u0430\u0441 \u0436\u0434\u0435\u0442 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0435\u043b\u0438\u0437\u0435, \u0438 \u0434\u0430\u0436\u0435 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u043e \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0435. \u041d\u0435 \u0432\u0441\u0451 \u0435\u0449\u0451 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e (\u043a\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/github.com\/hyperledger\/fabric-sdk-go\/blob\/master\/pkg\/gateway\/defaultcommithandlers.go#L50\" rel=\"nofollow\">commit handlers<\/a>), \u043d\u043e \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u0434\u0438\u0437\u0430\u0439\u043d \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0443\u0436\u0435 \u044f\u0441\u0435\u043d, \u0442\u0430\u043a \u0447\u0442\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u043d\u0435\u0433\u043e \u0431\u043b\u0438\u0436\u0435.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-301736","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/301736","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=301736"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/301736\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=301736"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=301736"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=301736"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}