Giter Site home page Giter Site logo

helpeth's Introduction

helpeth

NPM Package Gitter

Help (with) Ethereum. Purists' commandline tool for key and transaction management.

It uses ethereumjs-wallet and ethereumjs-tx.

Installation

Install it as a global package: npm install -g helpeth

It uses secp256k1 for the cryptography. Make sure to have either OpenSSL or GMP installed.

How to use

See the help output with helpeth --help:

Usage: helpeth [command]

Commands:
  signMessage <message>                     Sign a message
  verifySig <hash> <sig>                    Verify signature
  verifySigParams <hash> <r> <s> <v>        Verify signature parameters
  createTx <nonce> <to> <value> <data>      Sign a transaction
  <gasLimit> <gasPrice>
  assembleTx <nonce> <to> <value> <data>    Assemble a transaction from its
  <gasLimit> <gasPrice> <v> <r> <s>         components
  parseTx <tx>                              Parse raw transaction
  keyGenerate [format] [icapdirect]         Generate new key
  keyConvert                                Convert a key to V3 keystore format
  keyDetails                                Print key details
  bip32Details <path>                       Print key details for a given path
  addressDetails <address>                  Print details about an address
  unitConvert <value> <from> <to>           Convert between Ethereum units

Options:
  -p, --private      Private key as a hex string                        [string]
  --password         Password for the private key                       [string]
  --password-prompt  Prompt for the private key password               [boolean]
  -k, --keyfile      Encoded key file                                   [string]
  --show-private     Show private key details                          [boolean]
  --mnemonic         Mnemonic for HD key derivation                     [string]
  --version          Show version number                               [boolean]
  --help             Show help                                         [boolean]

Examples

Generate a new key

$ helpeth keyGenerate
Address: 0xe0defb92145fef3c3a945637705fafd3aa74a241
Address (checksum): 0xe0DefB92145FeF3c3a945637705fAfd3AA74a241
ICAP: XE82 Q9ML VOQY V5TD N4MF MK9U KKHS JU9N 9S1
Public key: 0x93e39cde5cdb3932e204cdd43b89578ad58d7489c31cbc30e61d167f67e3c8e76b9b2249377fa84f73b11c68f2f7a62f205f430f3a4370fd5dab6e3139d84977
Private key: 0xba1488fd638adc2e9f62fc70d41ff0ffc0e8d32ef6744d801987bc3ecb6a0953

Generate a new key and save as V3 keystore file

$ helpeth --password 'Use --password-prompt instead for security' keyGenerate v3
Address: 0x15f2f3e0f2d74ea7b185fc12f24cb4f402cc96d0
Address (checksum): 0x15F2f3e0F2D74eA7B185fC12F24cB4F402cC96D0
ICAP: XE53 2KAS Y050 UIFI VB1J 2636 IKXC 4QIP SK0
Public key: 0xf2a3a694026ed4abb16e18f0421a6e667803399dad2eae2ca8c3f95934fcb46e9440183fd278181deb501d2f0766d0f676d0cac84da3632590e2978cb6883bc4
Key saved as UTC--2016-03-17T19-06-57.064Z--15f2f3e0f2d74ea7b185fc12f24cb4f402cc96d0

Print details of an existing keyfile

$ helpeth --password 'Use --password-prompt instead for security' --keyfile UTC--2016-03-17T19-06-57.064Z--15f2f3e0f2d74ea7b185fc12f24cb4f402cc96d0 --show-private keyDetails
Address: 0x15f2f3e0f2d74ea7b185fc12f24cb4f402cc96d0
Address (checksum): 0x15F2f3e0F2D74eA7B185fC12F24cB4F402cC96D0
ICAP: XE53 2KAS Y050 UIFI VB1J 2636 IKXC 4QIP SK0
Public key: 0xf2a3a694026ed4abb16e18f0421a6e667803399dad2eae2ca8c3f95934fcb46e9440183fd278181deb501d2f0766d0f676d0cac84da3632590e2978cb6883bc4
Private key: 0x71a7f0e2ef1b7ff501b65a1650d48b8d5521fadc9539eec146d4faa6f5ca9aca

Sign a message

$ helpeth --password 'Use --password-prompt instead for security' --keyfile UTC--2016-03-17T19-06-57.064Z--15f2f3e0f2d74ea7b185fc12f24cb4f402cc96d0 signMessage 'Hello World'
Input message: Hello World
Message hash (Keccak): 0x592fa743889fc7f92ac2a37bb1f5ba1daf2a5c84741ca0e0061d243a2e6707ba
The signature: 0x167760997a69e225c0668e6761cd20cac70f3a6ace29fe2d287c3003daf6972b10d158a47e8f064cf982a3defdf236247c41249dbfb0fb81f0d126c26a94971d01

Sign a transaction

$ helpeth --password 'Use --password-prompt instead for security' --keyfile UTC--2016-03-17T19-06-57.064Z--15f2f3e0f2d74ea7b185fc12f24cb4f402cc96d0 createTx 0x1 0xe0defb92145fef3c3a945637705fafd3aa74a241 "1 eth" 0x0 21000 "20 Gwei"
Nonce: 0x1
To: 0xe0defb92145fef3c3a945637705fafd3aa74a241
Value: 0xde0b6b3a7640000
Data: 0x0
Gas limit: 0x5208
Gas price: 0x4a817c800
The signed transaction: 0xf86c018504a817c80082520894e0defb92145fef3c3a945637705fafd3aa74a241880de0b6b3a7640000001ba01893f2731799dc436da31e092f75bece7bfbdb4942b60b106d61ec06f143aed2a075548818010ccd7fd3e3dd6172f072d4dec19c8956c735bdd34b4aea809ff6be

Parse a transaction

$ ./helpeth parseTx 0xf86c018504a817c80082520894e0defb92145fef3c3a945637705fafd3aa74a241880de0b6b3a7640000001ba01893f2731799dc436da31e092f75bece7bfbdb4942b60b106d61ec06f143aed2a075548818010ccd7fd3e3dd6172f072d4dec19c8956c735bdd34b4aea809ff6be
Signed by: 0x15f2f3e0f2d74ea7b185fc12f24cb4f402cc96d0
Nonce: 0x01
To: 0xe0defb92145fef3c3a945637705fafd3aa74a241
Value: 1000000000000000000 (1 ETH)
Data: 0x00
Gas limit: 21000
Gas price: 20000000000 (20 Gwei)

License

MIT License

Copyright (C) 2016 Alex Beregszaszi

helpeth's People

Contributors

axic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

helpeth's Issues

Does not install on osx out of the box

I seem to be running into a python issue when attempting to install this globally

$ npm install -g helpeth
        
> [email protected] preinstall /usr/local/lib/node_modules/helpeth/node_modules/scrypt
> node node-scrypt-preinstall.js                                                     
                                                 
/usr/local/bin/helpeth -> /usr/local/lib/node_modules/helpeth/helpeth
                                                                       
> [email protected] install /usr/local/lib/node_modules/helpeth/node_modules/keccak
> npm run rebuild || echo "Keccak bindings compilation fail. Pure JS implementation w
ill be used." 
                                                                              
                                                          
> [email protected] rebuild /usr/local/lib/node_modules/helpeth/node_modules/keccak
> node-gyp rebuild                                                              
                                                                                     
gyp ERR! configure error
gyp ERR! stack Error: Command failed: /usr/local/opt/python/libexec/bin/python -c imp
ort sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:294:12)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:978:16)
gyp ERR! stack     at Socket.stream.socket.on (internal/child_process.js:395:11)
gyp ERR! stack     at Socket.emit (events.js:189:13)
gyp ERR! stack     at Pipe._handle.close (net.js:613:12)
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/usr/local/Cellar/node/11.4.0/bin/node" "/usr/local/lib/node_module
s/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/helpeth/node_modules/keccak
gyp ERR! node -v v11.4.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] rebuild: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] rebuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging
output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/harrymoreno/.npm/_logs/2018-12-18T22_47_46_030Z-debug.log
Keccak bindings compilation fail. Pure JS implementation will be used.

> [email protected] install /usr/local/lib/node_modules/helpeth/node_modules/scrypt

perhaps an issue with the Keccak dependency?

python -V returns 3.7.1

add encryption options

it would be fun to add an option to encrypt and decrypt some text given a public key (possible derived from a tx) and a private key

Can't verify created sig

I try to use verifySig with such sytax:

helpeth verifySig 0x440ead7b9ade79ab9423b43c219be92d3f5a29d42c62466bb234f91f16378115 0xb980941815b6c4249b55893ac47542bb7e91ba099fd84e62c72ebecc2814697f6c847ef8df63b05e0e2af0296afebde15224b705a4
7f5cca19d8b8e204d2267000

I get them using:

$ helpeth --p '0x5448fbf2c396a769c11268d2da8c9bfea8c86eaf16f98849d35484084c34137a' signMessage '{ "name":"John", "age":30, "car":null }'                                                           
Input message: 0x7b20226e616d65223a224a6f686e222c2022616765223a33302c2022636172223a6e756c6c207d
Message hash (Keccak): 0x440ead7b9ade79ab9423b43c219be92d3f5a29d42c62466bb234f91f16378115
The signature: 0xb980941815b6c4249b55893ac47542bb7e91ba099fd84e62c72ebecc2814697f6c847ef8df63b05e0e2af0296afebde15224b705a47f5cca19d8b8e204d2267000

Am i wrong?
Privatekey is for test puposes only

Segmentation fault (core dumped)

Input: $ helpeth addressDetails 0x0000000000000000000000000000000055000000
or generic $ helpeth addressDetails [ADDRESS]
Output:

Address: 0x0000000000000000000000000000000055000000
Address (checksum): 0x0000000000000000000000000000000055000000
ICAP: XE11 0000 0000 0000 000N L1HJ 4
Segmentation fault (core dumped)

OS: Debian 11 in Linux Container on Chrome OS (Chromebook)
Installed via: npm

The expected output appears, but also the message "Segmentation fault (core dumped)". I installed it in the "default container" on my Chromebook.

key subcommands

It might be nice to break up the key commands so you could something like this

helpeth key --help
helpeth key generate
helpeth key convert 
helpeth key details 

globally installed helpeth interprets hex as number

╭─kumavis@xyzs-MBP  ~/dev/udapp ‹node-v4.2.3›  (master*) 
╰─$ helpeth parseTx 0xf86c018504a817c80082520894e0defb92145fef3c3a945637705fafd3aa74a241880de0b6b3a7640000001ba01893f2731799dc436da31e092f75bece7bfbdb4942b60b106d61ec06f143aed2a075548818010ccd7fd3e3dd6172f072d4dec19c8956c735bdd34b4aea809ff6be
/Users/kumavis/.nvm/versions/node/v4.2.3/lib/node_modules/helpeth/node_modules/ethereumjs-util/index.js:698
      throw new Error('invalid data')
      ^

Error: invalid data
    at Object.exports.defineProperties (/Users/kumavis/.nvm/versions/node/v4.2.3/lib/node_modules/helpeth/node_modules/ethereumjs-util/index.js:698:13)
    at FakeTransaction.module.exports (/Users/kumavis/.nvm/versions/node/v4.2.3/lib/node_modules/helpeth/node_modules/ethereumjs-tx/index.js:92:11)
    at new FakeTransaction (/Users/kumavis/.nvm/versions/node/v4.2.3/lib/node_modules/helpeth/node_modules/ethereumjs-tx/fake.js:40:26)
    at Object.<anonymous> (/Users/kumavis/.nvm/versions/node/v4.2.3/lib/node_modules/helpeth/helpeth:333:14)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:467:10)
    at startup (node.js:136:18)

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.