elements blockchain harucoin

➜ src git:(elements-bc2) ./elements-cli issueasset 1000 10 true harucoin
{
"txid": "cef1d6ee4b4c36ee7185d2178949a645802ce56102131b9b17127aa426b348e8",
"vin": 0,
"entropy": "c91481ac65fafca292aa023b19e85660ad5fed9da3f1e73ccfa46487329d572f",
"asset": "495d65c77fb310794e598656d2e8f74eb8d4144f360c0c4a9125ab4215ab14d9",
"token": "86b7b6c473c86315d7c179ea79312ae724176ed8fab4445a7f5c25ff5fedaf90"
}

GethとMeteorのセットアップメモ

 

gethのセットアップ

参考となるリンク:

1:Ethereum(geth)でプライベート・ネットワークを作る手順 - Qiita

2:

Creating a Private Chain/Testnet | Ethereum Tutorials and Tips by Hudson

3: 

Private network · ethereum/go-ethereum Wiki · GitHub

 

エラー:

flag provided but not defined: -genesis

解決:

geth --fast -natspec -networkid="2" -nat "none" --nodiscover -port 0 console

エラー:

Fatal: Error starting protocol stack: chain db corrupted. Could not find block 0.

Genesis blockが見つからないという問題

解決:

1: $ geth --dev --datadir ./data init genesis.json
2: $ geth --datadir /Users/HOkaniwa/blockchain_projects/geth_test --fast -natspec -networkid="2" -nat "none" --nodiscover -port 0 console

 

Meteorセットアップ

 

Meteorのインストール (参照: Meteor)

$ curl https://install.meteor.com/ | sh

結果:

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 7784 0 7784 0 0 9929 0 --:--:-- --:--:-- --:--:-- 9928
Downloading Meteor distribution
######################################################################## 100.0%

Meteor 1.5.1 has been installed in your home directory (~/.meteor).
Writing a launcher script to /usr/local/bin/meteor for your convenience.

To get started fast:

$ meteor create ~/my_cool_app
$ cd ~/my_cool_app
$ meteor

Or see the docs at:

docs.meteor.com

 

例えばtest_projectという名前のサンプルプロジェクトを作るコマンド:

$ meteor create test_project

または

$ meteor create ~/test_project

作成されたフォルダに行き、meteorと打つとサーバーが立てられて、ウェブブラウザでみることができる。

 

エラー: 他のMeteorプロジェクトをMeteorで開こうとしたが起動できない場合

=> Exited with code: 1

Unable to resolve some modules:

"babel-runtime/helpers/taggedTemplateLiteralLoose" in
/Users/HO/blockchain_projects/test_meteor/test_1/client/lib/MyContract.js
(web.browser)

If you notice problems related to these missing modules, consider running:

meteor npm install --save babel-runtime

=> Your application is crashing. Waiting for file change.

 

解決: meteor npm install -g babel-runtime

/Users/HOk/.meteor/packages/meteor-tool/.1.5.1.gda7tv++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib
└─┬ babel-runtime@6.23.0
├── core-js@2.4.1
└── regenerator-runtime@0.10.5

 

 

補足:

➜ test_1 meteor npm install --save babel-runtimeではWARNINGが出てできなかった
npm WARN saveError ENOENT: no such file or directory, open '/Users/HO/blockchain_projects/test_meteor/test_1/package.json'
/Users/HO/blockchain_projects/test_meteor/test_1
└─┬ babel-runtime@6.23.0
├── core-js@2.4.1
└── regenerator-runtime@0.10.5

npm WARN enoent ENOENT: no such file or directory, open '/Users/HO/blockchain_projects/test_meteor/test_1/package.json'
npm WARN test_1 No description
npm WARN test_1 No repository field.
npm WARN test_1 No README data
npm WARN test_1 No license field.

 

 

アカウントの管理 -unlock accounts

1: geth create account

新規アカウント作成

2: geth account list

リストアップ

Account #0: {e0caiugasd25209758b339d53a518} /Users/HO/Library/Ethereum/keystore/UTC--2016-11-18T05-28-28.484953824Z--e0ca95aba4e44fe72003asdguadsb339d53a518
Account #1: {f9cf85f7csdfasdug682983c02b} /Users/HO/Library/Ethereum/keystore/UTC--2016-11-18T05-28-48.854926189Z--f9cf85f7c162395c8f7a42c1fg34949983c02b
Account #2: {a5e7casgdadg3b67e6a47f440e2756aasfasgdadgs21} /Users/HO/Library/Ethereum/keystore/UTC--2017-07-20T02-57-23.454914085Z--a5e7c3b67e63uf88498uf89902975dd2f221

3:パスワードを使って開く

(パスワードの場所: /Users/HO/Library/Ethereum/keystore/UTC-- など)

参考:

Managing your accounts · ethereum/go-ethereum Wiki · GitHub

Ethereum: アカウントをアンロックする方法 - Qiita

 

 

コマンド: 

geth --datadir /Users/HO/blockchain_projects/geth_test --fast -natspec -networkid="2" -nat "none" --nodiscover --unlock 2 --password /Users/HO/Library/Ethereum/keystore/UTC--2017-07-20T02-57-23.454914085Z--asdfasdgjagriaw34t493583046q93tgj -port 0 console

エラー: 

Fatal: Could not list accounts: account index 2 out of range [0, -1]

=>?

コマンド:

geth --unlock 3 --password "/Users/HO/Library/Ethereum/keystore/UTC--2017-07-20T02-57-23.454914085Z--asdfasdgjagriaw34t493583046q93tgj"

エラー: 

Fatal: Could not list accounts: account index 3 out of range [0, 2]

=> アカウント2までしかないのに3をアンロックしようとしたらこうなる

 

コマンド:

geth --unlock --password "/Users/HO/Library/Ethereum/keystore/UTC--2017-07-20T02-57-23.454914085Z--asdfasdgjagriaw34t493583046q93tgj"

結果:

A, Bが交互に出る

結果A:

geth --unlock 2 --password "/Users/HOkaniwa/Library/Ethereum/keystore/UTC--2017-07-20T02-57-23.454914085Z--a5e7c3b67e6a47f440e2756a289902975dd2f221"

I0807 18:31:51.368453 ethdb/database.go:82] Allotted 128MB cache and 1024 file handles to /Users/HOkaniwa/Library/Ethereum/chaindata
fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0x22ff6c4104e8 pc=0x4027bab]

runtime stack:
runtime.throw(0x4da8680, 0x2a)
/usr/local/opt/go/libexec/src/runtime/panic.go:547 +0x90
runtime.sigpanic()
/usr/local/opt/go/libexec/src/runtime/sigpanic_unix.go:12 +0x5a
runtime.unlock(0x5429320)
/usr/local/opt/go/libexec/src/runtime/lock_sema.go:107 +0x14b
runtime.(*mheap).alloc_m(0x5429320, 0x1000, 0x100000000, 0x542b9a0)
/usr/local/opt/go/libexec/src/runtime/mheap.go:492 +0x314
runtime.(*mheap).alloc.func1()
/usr/local/opt/go/libexec/src/runtime/mheap.go:502 +0x41
runtime.systemstack(0x70000e19cdc8)
/usr/local/opt/go/libexec/src/runtime/asm_amd64.s:307 +0xab
runtime.(*mheap).alloc(0x5429320, 0x1000, 0x10100000000, 0x402d55c)
/usr/local/opt/go/libexec/src/runtime/mheap.go:503 +0x63
runtime.largeAlloc(0x2000000, 0x1, 0x2d)
/usr/local/opt/go/libexec/src/runtime/malloc.go:766 +0xb3
runtime.mallocgc.func3()
/usr/local/opt/go/libexec/src/runtime/malloc.go:664 +0x33
runtime.systemstack(0xc82001c000)
/usr/local/opt/go/libexec/src/runtime/asm_amd64.s:291 +0x79
runtime.mstart()
/usr/local/opt/go/libexec/src/runtime/proc.go:1051

goroutine 1 [running]:
runtime.systemstack_switch()
/usr/local/opt/go/libexec/src/runtime/asm_amd64.s:245 fp=0xc8224c62f8 sp=0xc8224c62f0
runtime.mallocgc(0x2000000, 0x49002c0, 0x1, 0x4ec9199)
/usr/local/opt/go/libexec/src/runtime/malloc.go:665 +0x9eb fp=0xc8224c63d0 sp=0xc8224c62f8
runtime.newarray(0x49002c0, 0x2000000, 0x42f1330)
/usr/local/opt/go/libexec/src/runtime/malloc.go:798 +0xc9 fp=0xc8224c6410 sp=0xc8224c63d0
runtime.makeslice(0x48dd4e0, 0x0, 0x2000000, 0x0, 0x0, 0x0)
/usr/local/opt/go/libexec/src/runtime/slice.go:32 +0x165 fp=0xc8224c6460 sp=0xc8224c6410
github.com/syndtr/goleveldb/leveldb/memdb.New(0x5e833d8, 0xc8204189e0, 0x2000000, 0xc8224c6500)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/memdb/memdb.go:466 +0xa4 fp=0xc8224c64f0 sp=0xc8224c6460
github.com/syndtr/goleveldb/leveldb.(*DB).mpoolGet(0xc820060300, 0x0, 0xc82023c210)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db_state.go:86 +0x1a6 fp=0xc8224c6548 sp=0xc8224c64f0
github.com/syndtr/goleveldb/leveldb.(*DB).newMem(0xc820060300, 0x0, 0x0, 0x0, 0x0)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db_state.go:137 +0x3a6 fp=0xc8224c6620 sp=0xc8224c6548
github.com/syndtr/goleveldb/leveldb.(*DB).recoverJournal(0xc820060300, 0x0, 0x0)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db.go:610 +0xd2e fp=0xc8224c6a50 sp=0xc8224c6620
github.com/syndtr/goleveldb/leveldb.openDB(0xc820256790, 0x0, 0x0, 0x0)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db.go:124 +0x963 fp=0xc8224c6bd8 sp=0xc8224c6a50
github.com/syndtr/goleveldb/leveldb.Open(0x5ec5350, 0xc8203ef880, 0xc8224c6d68, 0x0, 0x0, 0x0)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db.go:196 +0x17d fp=0xc8224c6c28 sp=0xc8224c6bd8
github.com/syndtr/goleveldb/leveldb.OpenFile(0xc8203f46c0, 0x2a, 0xc8224c6d68, 0x0, 0x0, 0x0)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/db.go:218 +0xb3 fp=0xc8224c6c88 sp=0xc8224c6c28
github.com/ethereum/go-ethereum/ethdb.NewLDBDatabase(0xc8203f46c0, 0x2a, 0x80, 0x400, 0x2a, 0x0, 0x0)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/ethdb/database.go:89 +0x40b fp=0xc8224c6ea0 sp=0xc8224c6c88
github.com/ethereum/go-ethereum/cmd/utils.MakeChainDatabase(0xc8203d1180, 0x0, 0x0)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/cmd/utils/flags.go:866 +0x174 fp=0xc8224c6fa0 sp=0xc8224c6ea0
github.com/ethereum/go-ethereum/cmd/utils.MustMakeChainConfig(0xc8203d1180, 0x0)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/cmd/utils/flags.go:792 +0x2e fp=0xc8224c6fd8 sp=0xc8224c6fa0
github.com/ethereum/go-ethereum/cmd/utils.MakeSystemNode(0x4c15de8, 0x4, 0xc8203f23c0, 0x17, 0x42b04cca70977bfa, 0x406d73374fc8ca96, 0x1df1c2541, 0x5, 0x27d955115b12c4a4, 0xa198b46391021466, ...)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/cmd/utils/flags.go:682 +0xaf5 fp=0xc8224c7520 sp=0xc8224c6fd8
main.geth(0xc8203d1180, 0x0, 0x0)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/cmd/geth/main.go:271 +0xbe fp=0xc8224c75c8 sp=0xc8224c7520
runtime.call32(0xc820416d40, 0x4ecd510, 0xc8203f2ee0, 0x800000018)
/usr/local/opt/go/libexec/src/runtime/asm_amd64.s:472 +0x3e fp=0xc8224c75f0 sp=0xc8224c75c8
reflect.Value.call(0x496d320, 0x4ecd510, 0x13, 0x4c15030, 0x4, 0xc8224c7ad0, 0x1, 0x1, 0x0, 0x0, ...)
/usr/local/opt/go/libexec/src/reflect/value.go:435 +0x120d fp=0xc8224c7940 sp=0xc8224c75f0
reflect.Value.Call(0x496d320, 0x4ecd510, 0x13, 0xc8224c7ad0, 0x1, 0x1, 0x0, 0x0, 0x0)
/usr/local/opt/go/libexec/src/reflect/value.go:303 +0xb1 fp=0xc8224c79a0 sp=0xc8224c7940
gopkg.in/urfave/cli%2ev1.HandleAction(0x496d320, 0x4ecd510, 0xc8203d1180, 0x0, 0x0)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/Godeps/_workspace/src/gopkg.in/urfave/cli.v1/app.go:480 +0x2ee fp=0xc8224c7b58 sp=0xc8224c79a0
gopkg.in/urfave/cli%2ev1.(*App).Run(0xc820082f00, 0xc820084000, 0x5, 0x5, 0x0, 0x0)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/Godeps/_workspace/src/gopkg.in/urfave/cli.v1/app.go:241 +0xb05 fp=0xc8224c7e58 sp=0xc8224c7b58
main.main()
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/cmd/geth/main.go:241 +0x53 fp=0xc8224c7f00 sp=0xc8224c7e58
runtime.main()
/usr/local/opt/go/libexec/src/runtime/proc.go:188 +0x2b0 fp=0xc8224c7f50 sp=0xc8224c7f00
runtime.goexit()
/usr/local/opt/go/libexec/src/runtime/asm_amd64.s:1998 +0x1 fp=0xc8224c7f58 sp=0xc8224c7f50

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
/usr/local/opt/go/libexec/src/runtime/asm_amd64.s:1998 +0x1

goroutine 19 [select]:
github.com/ethereum/go-ethereum/logger.dispatchLoop()
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/logger/sys.go:81 +0x625
created by github.com/ethereum/go-ethereum/logger.init.1
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/logger/sys.go:60 +0x2b

goroutine 20 [chan receive]:
github.com/ethereum/go-ethereum/logger/glog.(*loggingT).flushDaemon(0x54237e0)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/logger/glog/glog.go:931 +0x67
created by github.com/ethereum/go-ethereum/logger/glog.init.1
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/logger/glog/glog.go:460 +0x6f

goroutine 34 [chan receive]:
github.com/rjeczalik/notify.(*recursiveTree).dispatch(0xc8200ab220)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/Godeps/_workspace/src/github.com/rjeczalik/notify/tree_recursive.go:125 +0x60
created by github.com/rjeczalik/notify.newRecursiveTree
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/Godeps/_workspace/src/github.com/rjeczalik/notify/tree_recursive.go:119 +0x2b1

goroutine 35 [sleep, locked to thread]:
time.Sleep(0x3b9aca00)
/usr/local/opt/go/libexec/src/runtime/time.go:59 +0xf9
github.com/rjeczalik/notify.gosource(0x0)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/Godeps/_workspace/src/github.com/rjeczalik/notify/watcher_fsevents_cgo.go:76 +0x20
github.com/rjeczalik/notify._cgoexpwrap_b138320e5461_gosource(0x0)
??:0 +0x21
github.com/rjeczalik/notify._Cfunc_CFRunLoopRun()
??:0 +0x36
github.com/rjeczalik/notify.init.1.func1()
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/Godeps/_workspace/src/github.com/rjeczalik/notify/watcher_fsevents_cgo.go:68 +0x112
created by github.com/rjeczalik/notify.init.1
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/Godeps/_workspace/src/github.com/rjeczalik/notify/watcher_fsevents_cgo.go:70 +0x48

goroutine 37 [chan receive]:
github.com/ethereum/go-ethereum/p2p/nat.discoverUPnP(0x0, 0x0)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/p2p/nat/natupnp.go:129 +0x112
github.com/ethereum/go-ethereum/p2p/nat.Any.func1.1(0xc820118cc0)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/p2p/nat/nat.go:155 +0x18
created by github.com/ethereum/go-ethereum/p2p/nat.Any.func1
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/p2p/nat/nat.go:155 +0x63

goroutine 22 [syscall]:
os/signal.signal_recv(0x0)
/usr/local/opt/go/libexec/src/runtime/sigqueue.go:116 +0x132
os/signal.loop()
/usr/local/opt/go/libexec/src/os/signal/signal_unix.go:22 +0x18
created by os/signal.init.1
/usr/local/opt/go/libexec/src/os/signal/signal_unix.go:28 +0x37

goroutine 23 [select, locked to thread]:
runtime.gopark(0x4ecddf8, 0xc820022f28, 0x4c1f470, 0x6, 0x18, 0x2)
/usr/local/opt/go/libexec/src/runtime/proc.go:262 +0x163
runtime.selectgoImpl(0xc820022f28, 0x0, 0x18)
/usr/local/opt/go/libexec/src/runtime/select.go:392 +0xa67
runtime.selectgo(0xc820022f28)
/usr/local/opt/go/libexec/src/runtime/select.go:215 +0x12
runtime.ensureSigM.func1()
/usr/local/opt/go/libexec/src/runtime/signal1_unix.go:279 +0x32c
runtime.goexit()
/usr/local/opt/go/libexec/src/runtime/asm_amd64.s:1998 +0x1

goroutine 4 [IO wait]:
net.runtime_pollWait(0x79a0f58, 0x72, 0x0)
/usr/local/opt/go/libexec/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).Wait(0xc82043e060, 0x72, 0x0, 0x0)
/usr/local/opt/go/libexec/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc82043e060, 0x0, 0x0)
/usr/local/opt/go/libexec/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).readFrom(0xc82043e000, 0xc820474000, 0x800, 0x800, 0x0, 0x0, 0x0, 0x5ec0028, 0xc82006c0a0)
/usr/local/opt/go/libexec/src/net/fd_unix.go:277 +0x2a5
net.(*UDPConn).ReadFromUDP(0xc820442000, 0xc820474000, 0x800, 0x800, 0x3, 0x4, 0x0, 0x0)
/usr/local/opt/go/libexec/src/net/udpsock_posix.go:61 +0x117
net.(*UDPConn).ReadFrom(0xc820442000, 0xc820474000, 0x800, 0x800, 0x3, 0x0, 0x0, 0x0, 0x0)
/usr/local/opt/go/libexec/src/net/udpsock_posix.go:79 +0x116
github.com/huin/goupnp/httpu.(*HTTPUClient).Do(0xc820430020, 0xc820446000, 0x7d2b7500, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/Godeps/_workspace/src/github.com/huin/goupnp/httpu/httpu.go:92 +0xbb4
github.com/huin/goupnp/ssdp.SSDPRawSearch(0xc820430020, 0x4dbe7c0, 0x31, 0x2, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/Godeps/_workspace/src/github.com/huin/goupnp/ssdp/ssdp.go:53 +0x67c
github.com/huin/goupnp.DiscoverDevices(0x4dbe7c0, 0x31, 0x0, 0x0, 0x0, 0x0, 0x0)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/Godeps/_workspace/src/github.com/huin/goupnp/goupnp.go:66 +0x114
github.com/ethereum/go-ethereum/p2p/nat.discover(0xc82006a060, 0x4dbe7c0, 0x31, 0x4ecc688)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/p2p/nat/natupnp.go:140 +0x3d
created by github.com/ethereum/go-ethereum/p2p/nat.discoverUPnP
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/p2p/nat/natupnp.go:115 +0x84

goroutine 25 [chan receive]:
github.com/ethereum/go-ethereum/p2p/nat.Any.func1(0x0, 0x0)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/p2p/nat/nat.go:158 +0xcf
github.com/ethereum/go-ethereum/p2p/nat.(*autodisc).wait.func1()
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/p2p/nat/nat.go:242 +0x47
sync.(*Once).Do(0xc820416e50, 0xc820023f78)
/usr/local/opt/go/libexec/src/sync/once.go:44 +0xe4
github.com/ethereum/go-ethereum/p2p/nat.(*autodisc).wait(0xc820416e40, 0x0, 0x0)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/p2p/nat/nat.go:244 +0x65
created by github.com/ethereum/go-ethereum/p2p/nat.startautodisc
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/p2p/nat/nat.go:203 +0xb2

goroutine 5 [IO wait]:
net.runtime_pollWait(0x79a0e98, 0x72, 0x0)
/usr/local/opt/go/libexec/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).Wait(0xc8200540d0, 0x72, 0x0, 0x0)
/usr/local/opt/go/libexec/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc8200540d0, 0x0, 0x0)
/usr/local/opt/go/libexec/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).readFrom(0xc820054070, 0xc820472000, 0x800, 0x800, 0x0, 0x0, 0x0, 0x5ec0028, 0xc82006c0a0)
/usr/local/opt/go/libexec/src/net/fd_unix.go:277 +0x2a5
net.(*UDPConn).ReadFromUDP(0xc820028010, 0xc820472000, 0x800, 0x800, 0x49002c0, 0x800, 0x0, 0x0)
/usr/local/opt/go/libexec/src/net/udpsock_posix.go:61 +0x117
net.(*UDPConn).ReadFrom(0xc820028010, 0xc820472000, 0x800, 0x800, 0x800, 0x0, 0x0, 0x0, 0x0)
/usr/local/opt/go/libexec/src/net/udpsock_posix.go:79 +0x116
github.com/huin/goupnp/httpu.(*HTTPUClient).Do(0xc820012220, 0xc820448000, 0x7d2b7500, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/Godeps/_workspace/src/github.com/huin/goupnp/httpu/httpu.go:92 +0xbb4
github.com/huin/goupnp/ssdp.SSDPRawSearch(0xc820012220, 0x4dbe800, 0x31, 0x2, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/Godeps/_workspace/src/github.com/huin/goupnp/ssdp/ssdp.go:53 +0x67c
github.com/huin/goupnp.DiscoverDevices(0x4dbe800, 0x31, 0x0, 0x0, 0x0, 0x0, 0x0)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/Godeps/_workspace/src/github.com/huin/goupnp/goupnp.go:66 +0x114
github.com/ethereum/go-ethereum/p2p/nat.discover(0xc82006a060, 0x4dbe800, 0x31, 0x4ecc690)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/p2p/nat/natupnp.go:140 +0x3d
created by github.com/ethereum/go-ethereum/p2p/nat.discoverUPnP
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/p2p/nat/natupnp.go:127 +0xc7

goroutine 26 [select]:
github.com/syndtr/goleveldb/leveldb/util.(*BufferPool).drain(0xc8202108c0)
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/buffer_pool.go:206 +0x29e
created by github.com/syndtr/goleveldb/leveldb/util.NewBufferPool
/private/tmp/ethereum-20160716-73672-1brp1pi/build/_workspace/src/github.com/ethereum/go-ethereum/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/util/buffer_pool.go:237 +0x270

$

結果B:

Fatal: Failed to unlock account 2 (could not decrypt key with given passphrase)

 

 

 

 

 

IBM Watson Speech to Text API セットアップ + 日本語対応

音声を文字におこすWatsonのAPIを使うためにIBMのサイトとパソコンからの通信環境をセットアップする方法 

API

Speech to Text | IBM Watson Developer Cloud

公式チュートリアルSpeech to Text | Getting started | IBM Watson Developer Cloud

0:利用のための各種登録

Bluemixへ登録する。

https://console.ng.bluemix.net/registration/

ログインする。

クレジットカードを登録する。

Speech to Text APIを利用するためにはプロフィールページからクレジットカードを登録しなければいけない。

結果としてAccount TypeがPremium(以下のような画面)になれば、Speech to Text APIを利用できる。

f:id:haruokny:20170613000904p:plain

 

1: flac ファイルをダウンロード

Speech to Text | Getting started | IBM Watson Developer Cloud より、以下でデモデータとして扱うファイルをダウンロードする。

 

2: BluemixのCatalogから、使いたいSpeech to Text機能を検索して選択

Speech to Textの検索画面

f:id:haruokny:20170613000543p:plain

 

Speech to Textの説明ページの右下「Create」をクリックする

(クレジットカードを登録していない場合 ここでinvalid account typeというエラーが出る)

f:id:haruokny:20170613000606p:plain

 

3:ターミナルからcurlでWatsonへアクセス

flacファイルのあるディレクトリへ移動

ターミナルへ入力

$ curl -X POST -u ここにusername:ここにpassword --header "Content-Type: audio/flac" --header "Transfer-Encoding: chunked" --data-binary @audio-file.flac "https://stream.watsonplatform.net/speech-to-text/api/v1/recognize"

(curl: no URL specified! curl: try 'curl --help' or 'curl --manual' for more informationなどのエラーがでた場合、curlコマンドの中の空白スペースが2つ以上でないか調べる)

 

成功した場合の結果:

ターミナルに、デモデータの音声を文字にした以下の文字列が現れる。

{
"results": [
{
"alternatives": [
{
"confidence": 0.891,
"transcript": "several tornadoes touch down as a line of severe thunderstorms swept through Colorado on Sunday "
}
],
"final": true
}
],
"result_index": 0
}%

 

日本語対応の場合:

curl -X POST -u ここにusername:ここにpassword --header "Content-Type: audio/flac" --header "Transfer-Encoding: chunked" --data-binary @audio-file.flac "https://stream.watsonplatform.net/speech-to-text/api/v1/models/ja-JP_BroadbandModel/recognize"

テストデータ&参考:IBM THINK Watson - Watsonにテープ起こしさせてみた - Japan

 

音声データ:「ただいまワトソンのテスト 中。本日は晴天なり。本日は晴天なり」

出力結果:

{
"results": [
{
"alternatives": [
{
"confidence": 0.73,
"transcript": "ただいま ワトソン の テスト 中 長芋 と その テスト 中 の 日 は 晴天 なり の 日 は 晴天 なり "
}
],
"final": true
}
],
"result_index": 0
}%

 

 

グラフがプロットされず ウィンドウが出てこない

問題:グラフがプロットされず ウィンドウが出てこない

 

解決:

import pylab
pylab.show()

python - No plot window in matplotlib - Stack Overflow

 

 

Python モジュールの 「matplotlib」 と 「pylab」 との関係性 ~「pylab」って何だっけ? - Qiita

Mysql rails s ができない

rails s ができない

エラー:

/Users/HO/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mysql2-0.4.4/lib/mysql2.rb:31:in `require': dlopen(/Users/HO/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mysql2-0.4.4/lib/mysql2/mysql2.bundle, 9): Library not loaded: /usr/local/lib/libmysqlclient.18.dylib (LoadError)

ーーーーー

コマンド:brew upgrade mysql

結果:Error: mysql not installed

ーーーーー

コマンド:brew doctor

結果:

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
/usr/local/lib/libtcl8.6.dylib
/usr/local/lib/libtk8.6.dylib

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

 

Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
iojs

Warning: Your Xcode (7.3.1) is outdated.
Please update to Xcode 8.2 (or delete it).
Xcode can be updated from the App Store.

 

〜〜〜

 

(1) XcodeのCommand Line ToolsをUpdate

リンク:Sign in with your Apple ID - Apple Developer 

10.12 OX verからしかインストール出来ないようなのでOSをアップデート

 

問題:disk spaceが足りない

解決:hard drive - Not enough storage for El Capitan; no way to free up space - Ask Different

 

(2)

mysql --version
mysql Ver 14.14 Distrib 5.5.49, for osx10.11 (x86_64) using EditLine wrapper

 

(3) brew install mysql

最新版のXCodeをインストールして解決

 

(4)Unexpected dylibs:を治す

コマンド:brew doctor

結果:

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
/usr/local/lib/libtcl8.6.dylib
/usr/local/lib/libtk8.6.dylib

Homebrewのエラーを治す - Qiita

MySQL:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

* "mysql.server start"をしないで mysql と打った場合も同じエラーが出ます。

 

<エラー状態>

$ mysql start
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 

$ mysql.server stop
ERROR! MySQL server PID file could not be found!

$ sudo mysql.server start

Starting MySQL
.. ERROR! The server quit without updating PID file (/usr/local/var/mysql/Harus-MacBook-Air.local.pid).

-----------------------------------------------------

<mysqlのインストール方法>

homebrew

<mysql.sockの場所を確認> ( =>なし)

ソケットファイルのパスを/etc/my.cnfとして自分で作成し、指定しても同じ

 -----------------------------------------------------

<成功した方法>

1: MySQLをhomebrewでアンインストール

   homebrewでアンインストール

   homebrewをアップデート

   最新のmysqlをインストール

2:my.cnfファイル(それまでに他の解決策として/etc/my.cnfとして自分で作成していたもの)を消す

MySQL ERROR! The server quit without updating PID file

3: mysql.server start

....SUCCESS!

--------------------------------------------------------

<他に試された解決方法(一部)>

<mysqlをrestart> (=> できない, 上のエラー文)

 

<mysqlインスタンスが他で走っているか確認> ( => 走っていない)

ps ax | grep mysql

 

<mysqlインスタンスを消す>(=>変化なし)

kill $(pgrep mysql)

 

<touch メソッド でpidファイル作成> (=>変化なし)

mysql.server startとすると、ファイルが消えただけで同じエラー。

 

 

<touch mysql.sock でソケットファイル作成> (=>変化なし)

mysql.server startとすると、ファイルが消えただけで同じエラー。

 

<mysqlの権限を変える> (=> 変化なし)

権限の確認

➜ ls -ll
total 0
drwxr-xr-x 3 myname admin 102 Dec 16 2015 cache
drwxr-xr-x 4myname admin 136 Oct 6 21:48 homebrew
drwxr-xr-x 2myname admin 68 Nov 11 11:32 log
drwxr-xr-x 27 _mysql _mysql 918 Mar 3 15:19 mysql
drwx------ 23 myname admin 782 Mar 29 2015 postgres

 

権限の変更

➜ var sudo chown -Rmyname:admin /usr/local/var/mysql
➜ ls -ll
total 0
drwxr-xr-x 3 myname admin 102 Dec 16 2015 cache
drwxr-xr-x 4 myname admin 136 Oct 6 21:48 homebrew
drwxr-xr-x 2 myname admin 68 Nov 11 11:32 log
drwxr-xr-x 27 myname admin 918 Mar 3 15:19 mysql
drwx------ 23 myname admin 782 Mar 29 2015 postgres

 

<MySQLd を起動> (=> エラー)

$ mysqld start

2017-03-03 15:19:57 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-03-03 15:19:57 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2017-03-03 15:19:57 0 [Note] mysqld (mysqld 5.6.34) starting as process 25611 ...
2017-03-03 15:19:57 25611 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2017-03-03 15:19:57 25611 [Note] Plugin 'FEDERATED' is disabled.
2017-03-03 15:19:57 25611 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-03-03 15:19:57 25611 [Note] InnoDB: The InnoDB memory heap is disabled
2017-03-03 15:19:57 25611 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-03-03 15:19:57 25611 [Note] InnoDB: Memory barrier is not used
2017-03-03 15:19:57 25611 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-03-03 15:19:57 25611 [Note] InnoDB: Using CPU crc32 instructions
2017-03-03 15:19:57 25611 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-03-03 15:19:57 25611 [Note] InnoDB: Completed initialization of buffer pool
2017-03-03 15:19:57 25611 [Note] InnoDB: Highest supported file format is Barracuda.
InnoDB: No valid checkpoint found.
InnoDB: If you are attempting downgrade from MySQL 5.7.9 or later,
InnoDB: please refer to http://dev.mysql.com/doc/refman/5.6/en/upgrading-downgrading.html
InnoDB: If this error appears when you are creating an InnoDB database,
InnoDB: the problem may be that during an earlier attempt you managed
InnoDB: to create the InnoDB data files, but log file creation failed.
InnoDB: If that is the case, please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/error-creating-innodb.html
2017-03-03 15:19:57 25611 [ERROR] Plugin 'InnoDB' init function returned error.
2017-03-03 15:19:57 25611 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
mysqld: Too many arguments (first extra is 'start').
Use --verbose --help to get a list of available options
2017-03-03 15:19:57 25611 [ERROR] Aborting

2017-03-03 15:19:57 25611 [Note] Binlog end
2017-03-03 15:19:57 25611 [Note] Shutting down plugin 'partition'
...
2017-03-03 15:19:57 25611 [Note] mysqld: Shutdown complete

 

 

<試す可能性のある方法>

<(sockファイルがある場合)mysql.sockのパスをリンクさせる> 

If you find the same file in another location then symlink it:

For ex: I have it in /data/mysql_datadir/mysql.sock

Switch user to mysql and execute as mentioned below:

su mysql

ln -s /data/mysql_datadir/mysql.sock /var/lib/mysql/mysql.sock