{"id":2766,"date":"2020-07-09T17:33:09","date_gmt":"2020-07-09T05:33:09","guid":{"rendered":"http:\/\/www.talkcrypto.org\/blog\/?p=2766"},"modified":"2020-07-28T19:23:57","modified_gmt":"2020-07-28T07:23:57","slug":"error-callback-was-already-called-ganache","status":"publish","type":"post","link":"https:\/\/www.talkcrypto.org\/blog\/2020\/07\/09\/error-callback-was-already-called-ganache\/","title":{"rendered":"Error: Callback was already called &#8211; Ganache"},"content":{"rendered":"\n<p>OpenZeppelin has some neat docs to show how to create, deploy and interact with smart contracts centered around installing node, using the OpenZeppelin libraries, compiling via CLI, and deploying via Ganache which is a local blockchain environment for development and testing. <\/p>\n\n\n\n<p>Some of you may remember TestRPC. Ganache is the new name of TestRPC. <\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>&nbsp;The TestRPC quickly became more powerful than simply a blockchain environment used for testing. To stay with the sweet Truffle brand, we decided to rename it Ganache, as Ganache is (often) the core of your favorite chocolate truffle. It&#8217;s a much catchier name (and a much tastier one too).<\/p><cite><a href=\"https:\/\/www.trufflesuite.com\/blog\/testrpc-is-now-ganache\">https:\/\/www.trufflesuite.com\/blog\/testrpc-is-now-ganache<\/a><\/cite><\/blockquote>\n\n\n\n<p>The problem though is when you follow the docs at <a href=\"https:\/\/docs.openzeppelin.com\/learn\/deploying-and-interacting\">https:\/\/docs.openzeppelin.com\/learn\/deploying-and-interacting<\/a>  and run:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">npx ganache-cli --deterministic <\/pre>\n\n\n\n<p>to get a list of all the available accounts, you might encounter this error:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Ganache CLI v6.9.1 (ganache-core: 2.10.2)<br>Error: Callback was already called.<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img fetchpriority=\"high\" decoding=\"async\" width=\"983\" height=\"349\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2020\/07\/image.png\" alt=\"\" class=\"wp-image-2767\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2020\/07\/image.png 983w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2020\/07\/image-300x107.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2020\/07\/image-768x273.png 768w\" sizes=\"(max-width: 983px) 100vw, 983px\" \/><\/figure>\n\n\n\n<p>The problem is because you probably have node v14 installed. Run:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">node -v<\/pre>\n\n\n\n<p>to check. For me, I installed node initially with the brew command<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">brew install node<\/pre>\n\n\n\n<p>which downloaded the latest version which was v14.5.0<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"480\" height=\"66\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2020\/07\/node-version-1.png\" alt=\"\" class=\"wp-image-2770\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2020\/07\/node-version-1.png 480w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2020\/07\/node-version-1-300x41.png 300w\" sizes=\"(max-width: 480px) 100vw, 480px\" \/><\/figure>\n\n\n\n<p>The reason is an issue related to ganache-core&#8217;s internals not yet being Node v14 compatible. <a href=\"https:\/\/github.com\/trufflesuite\/ganache-cli\/issues\/732\">https:\/\/github.com\/trufflesuite\/ganache-cli\/issues\/732<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Workaround<\/h3>\n\n\n\n<p>Install Node v12 for the time being. First run<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">brew search node<\/pre>\n\n\n\n<p>What this does is lists all available formula (aka packages) and the online equivalent is <a href=\"http:\/\/searchbrew.com\/\">http:\/\/searchbrew.com\/<\/a>. You should see node, node@12, node@10 in the results. <\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"1024\" height=\"104\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2020\/07\/brew-search-1024x104.png\" alt=\"\" class=\"wp-image-2784\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2020\/07\/brew-search-1024x104.png 1024w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2020\/07\/brew-search-300x31.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2020\/07\/brew-search-768x78.png 768w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2020\/07\/brew-search.png 1296w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Install node v12<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">brew install node@12<\/pre>\n\n\n\n<p>You should then get a green tick beside node and node@12. If you run node -v again you will still get the new version because you have to run 2 more commands.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">brew unlink node<br>brew link node@12<\/pre>\n\n\n\n<p>You might get some errors here asking you to use the &#8211;overwrite flag to overwrite all the conflicting files (\/usr\/local\/bin\/npm already existing for instance) and also to add the &#8211;force flag because node@12 is keg-only. <\/p>\n\n\n\n<p>Keg only means that node will only be installed at \/usr\/local\/Cellar but not linked into places like \/usr\/local\/bin, \/usr\/local\/lib, etc. That means other software that depends on it has to be compiled with specific instructions to use the files in \/usr\/local\/Cellar. <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">brew link --overwrite node@12 --force<\/pre>\n\n\n\n<p>Then check the version again with node -v and it should be at 12.x. Now if you run <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">npx ganache-cli --deterministic <br><\/pre>\n\n\n\n<p>You should get<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><br>Ganache CLI v6.9.1 (ganache-core: 2.10.2)<br> <br><br> Available Accounts<br> ==================<br> (0) 0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1 (100 ETH)<br> (1) 0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0 (100 ETH)<br> (2) 0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b (100 ETH)<br> (3) 0xE11BA2b4D45Eaed5996Cd0823791E0C93114882d (100 ETH)<br> (4) 0xd03ea8624C8C5987235048901fB614fDcA89b117 (100 ETH)<br> (5) 0x95cED938F7991cd0dFcb48F0a06a40FA1aF46EBC (100 ETH)<br> (6) 0x3E5e9111Ae8eB78Fe1CC3bb8915d5D461F3Ef9A9 (100 ETH)<br> (7) 0x28a8746e75304c0780E011BEd21C72cD78cd535E (100 ETH)<br> (8) 0xACa94ef8bD5ffEE41947b4585a84BdA5a3d3DA6E (100 ETH)<br> (9) 0x1dF62f291b2E969fB0849d99D9Ce41e2F137006e (100 ETH)<br> <br><br> Private Keys<br> ==================<br> (0) 0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d<br> (1) 0x6cbed15c793ce57650b9877cf6fa156fbef513c4e6134f022a85b1ffdd59b2a1<br> (2) 0x6370fd033278c143179d81c5526140625662b8daa446c22ee2d73db3707e620c<br> (3) 0x646f1ce2fdad0e6deeeb5c7e8e5543bdde65e86029e2fd9fc169899c440a7913<br> (4) 0xadd53f9a7e588d003326d1cbf9e4a43c061aadd9bc938c843a79e7b4fd2ad743<br> (5) 0x395df67f0c2d2d9fe1ad08d1bc8b6627011959b79c53d7dd6a3536a33ab8a4fd<br> (6) 0xe485d098507f54e7733a205420dfddbe58db035fa577fc294ebd14db90767a52<br> (7) 0xa453611d9419d0e56f499079478fd72c37b251a94bfde4d19872c44cf65386e3<br> (8) 0x829e924fdf021ba3dbbc4225edfece9aca04b929d6e75613329ca6f1d31c0bb4<br> (9) 0xb0057716d5917badaf911b193b12b910811c1497b5bada8d7711f758981c3773<br> <br><br> HD Wallet<br> ==================<br> Mnemonic:&nbsp; &nbsp; &nbsp; myth like bonus scare over problem client lizard pioneer submit female collect<br> Base HD Path:&nbsp; m\/44'\/60'\/0'\/0\/{account_index}<br> <br><br> Gas Price<br> ==================<br> 20000000000<br> <br><br> Gas Limit<br> ==================<br> 6721975<br> <br><br> Call Gas Limit<br> ==================<br> 9007199254740991<br> <br><br> Listening on 127.0.0.1:8545 <br><br><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>OpenZeppelin has some neat docs to show how to create,<\/p>\n","protected":false},"author":1,"featured_media":2795,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2766","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"featured_image_urls":{"full":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2020\/07\/Errors.jpg",194,100,false],"thumbnail":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2020\/07\/Errors-150x100.jpg",150,100,true],"medium":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2020\/07\/Errors.jpg",194,100,false],"medium_large":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2020\/07\/Errors.jpg",194,100,false],"large":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2020\/07\/Errors.jpg",194,100,false],"1536x1536":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2020\/07\/Errors.jpg",194,100,false],"2048x2048":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2020\/07\/Errors.jpg",194,100,false],"chromenews-featured":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2020\/07\/Errors.jpg",194,100,false],"chromenews-large":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2020\/07\/Errors.jpg",194,100,false],"chromenews-medium":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2020\/07\/Errors.jpg",194,100,false]},"author_info":{"info":["seandotau"]},"category_info":"<a href=\"https:\/\/www.talkcrypto.org\/blog\/category\/uncategorized\/\" rel=\"category tag\">Uncategorized<\/a>","tag_info":"Uncategorized","comment_count":"0","_links":{"self":[{"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/posts\/2766","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/comments?post=2766"}],"version-history":[{"count":5,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/posts\/2766\/revisions"}],"predecessor-version":[{"id":2796,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/posts\/2766\/revisions\/2796"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/media\/2795"}],"wp:attachment":[{"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/media?parent=2766"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/categories?post=2766"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/tags?post=2766"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}