Git Product home page Git Product logo

ethermint-deploy's Introduction

Ethermint web3 deploy starter code

Starter contract, deployment, and interaction with contract through web3 for a running Ethermint node. This is not exclusive to an Ethermint node, and can be used on any Ethereum node with the web3 api enabled and an unlocked key.

Ethermint can be found here: https://github.com/ChainSafe/ethermint

Installation

yarn install

Usage

Deploy contract to node

yarn start

Running an Ethermint node to run against

Clone Ethermint repository:

git clone https://github.com/ChainSafe/ethermint.git
cd ethermint

To start the node and RPC server, follow the README.md at https://github.com/ChainSafe/ethermint

Start instructions have changed slightly to use the OS keyring since the Getting started video

ethermint-deploy's People

Contributors

austinabell avatar fedekunze avatar noot avatar okwme avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ethermint-deploy's Issues

Error: Returned error: UnmarshalBinaryLengthPrefixed cannot decode empty bytes

192:ethermint-deploy a$ yarn start
yarn run v1.22.4
$ node ./web3/deploy_contract.js
Compiling contract code...
Unlocked account address: 0x16732d1b18a04A8106557a5806C992D33Ca12F59
Deploying contract...
Deployed contract Address: 0x81F59Ae90635FA0AF26131B77C9281f1463c6FbF
Error: Returned error: UnmarshalBinaryLengthPrefixed cannot decode empty bytes
at Object.ErrorResponse (/Users/a/go/src/github.com/ChainSafe/ethermint-deploy/node_modules/web3-core-helpers/src/errors.js:29:16)
at /Users/a/go/src/github.com/ChainSafe/ethermint-deploy/node_modules/web3-core-requestmanager/src/index.js:140:36
at XMLHttpRequest.request.onreadystatechange (/Users/a/go/src/github.com/ChainSafe/ethermint-deploy/node_modules/web3-providers-http/src/index.js:102:13)
at XMLHttpRequestEventTarget.dispatchEvent (/Users/a/go/src/github.com/ChainSafe/ethermint-deploy/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:22)
at XMLHttpRequest._setReadyState (/Users/a/go/src/github.com/ChainSafe/ethermint-deploy/node_modules/xhr2-cookies/dist/xml-http-request.js:208:14)
at XMLHttpRequest._onHttpResponseEnd (/Users/a/go/src/github.com/ChainSafe/ethermint-deploy/node_modules/xhr2-cookies/dist/xml-http-request.js:318:14)
at IncomingMessage. (/Users/a/go/src/github.com/ChainSafe/ethermint-deploy/node_modules/xhr2-cookies/dist/xml-http-request.js:289:61)
at IncomingMessage.emit (events.js:215:7)
at endReadableNT (_stream_readable.js:1184:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
Counter pre increment is: undefined
Sending add transaction...
Add tx finalized in block: 4048
Error: Returned error: UnmarshalBinaryLengthPrefixed cannot decode empty bytes
at Object.ErrorResponse (/Users/a/go/src/github.com/ChainSafe/ethermint-deploy/node_modules/web3-core-helpers/src/errors.js:29:16)
at /Users/a/go/src/github.com/ChainSafe/ethermint-deploy/node_modules/web3-core-requestmanager/src/index.js:140:36
at XMLHttpRequest.request.onreadystatechange (/Users/a/go/src/github.com/ChainSafe/ethermint-deploy/node_modules/web3-providers-http/src/index.js:102:13)
at XMLHttpRequestEventTarget.dispatchEvent (/Users/a/go/src/github.com/ChainSafe/ethermint-deploy/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:22)
at XMLHttpRequest._setReadyState (/Users/a/go/src/github.com/ChainSafe/ethermint-deploy/node_modules/xhr2-cookies/dist/xml-http-request.js:208:14)
at XMLHttpRequest._onHttpResponseEnd (/Users/a/go/src/github.com/ChainSafe/ethermint-deploy/node_modules/xhr2-cookies/dist/xml-http-request.js:318:14)
at IncomingMessage. (/Users/a/go/src/github.com/ChainSafe/ethermint-deploy/node_modules/xhr2-cookies/dist/xml-http-request.js:289:61)
at IncomingMessage.emit (events.js:215:7)
at endReadableNT (_stream_readable.js:1184:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
Counter post increment is: undefined
โœจ Done in 11.69s.

Error on `yarn start`

Seem to have a running version of emintd running but yarn start fails with this error:

> yarn start
yarn run v1.16.0
$ node ./web3/deploy_contract.js
Compiling contract code...
{ currentAccounts: [ '0x22FD28bAfe8D4a72fda7a59b5836f12Cf1FA4374' ] }
Unlocked account address: 	 0x22FD28bAfe8D4a72fda7a59b5836f12Cf1FA4374
Deploying contract...
Error: The transaction receipt didn't contain a contract address.
    at /home/billy/GitHub.com/chainsafe/ethermint-deploy/node_modules/web3-core-method/src/index.js:343:33
    at process._tickCallback (internal/process/next_tick.js:68:7)
Done in 3.71s.

Error in Deploying contract

$ yarn start yarn run v1.19.1 $ node ./web3/deploy_contract.js Compiling contract code... Unlocked account address: 0xDe547715a81BB7d664554336cBB4BD9DAc0431c4 Deploying contract... Error: Returned error: authentication needed: password or unlock at Object.ErrorResponse (/home/devel-sultana/cosmosProject/ethermint-deploy/node_modules/web3-core-helpers/src/errors.js:29:16) at /home/devel-sultana/cosmosProject/ethermint-deploy/node_modules/web3-core-requestmanager/src/index.js:140:36

Add metamask compatible key

The Cosmos-SDK hardcodes the level of entropy for generating new keys which results in a mnemonic phrase of 24 words. Until this phrase length can be passed in a flag (open issue) you are unable to easily import the ethermint account into metamask. There is a workaround where you generate the mnemonic phrase somewhere else and then pass it as a recover flag.

Might be cool to demonstrate this by replacing the following line:

echo "testpass" | emintcli emintkeys add mykey

with this modified line that uses the default truffle mnemonic phrase:

(echo "1234567890"; echo "candy maple cake sugar pudding cream honey rich smooth crumble sweet treat") | emintcli keys add mykey --recover

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.