SilentCicero / ethereumjs-accounts

A simple module for creating, managing and using Ethereum accounts in browser.
MIT License
150 stars 58 forks source link

npm install fails #15

Open SCBuergel opened 8 years ago

SCBuergel commented 8 years ago

This is the log output, any help would be appreciated:

$ sudo npm install ethereumjs-accounts

> secp256k1@0.0.15 install /home/someone/ethereum/node_modules/secp256k1
> node-gyp rebuild

make: Entering directory '/home/someone/ethereum/node_modules/secp256k1/build'
  CXX(target) Release/obj.target/secp256k1/secp256k1.o
cc1plus: warning: command line option ‘-std=c11’ is valid for C/ObjC but not for C++
In file included from ../secp256k1.cc:1:0:
../node_modules/nan/nan.h:324:27: error: redefinition of ‘template<class T> v8::Local<T> Nan::imp::NanEnsureHandleOrPersistent(const v8::Local<T>&)’
   NAN_INLINE v8::Local<T> NanEnsureHandleOrPersistent(const v8::Local<T> &val) {
                           ^
../node_modules/nan/nan.h:319:17: note: ‘template<class T> v8::Handle<T> Nan::imp::NanEnsureHandleOrPersistent(v8::Handle<T>&)’ previously declared here
   v8::Handle<T> NanEnsureHandleOrPersistent(const v8::Handle<T> &val) {
                 ^
../node_modules/nan/nan.h:344:27: error: redefinition of ‘template<class T> v8::Local<T> Nan::imp::NanEnsureLocal(v8::Handle<T>&)’
   NAN_INLINE v8::Local<T> NanEnsureLocal(const v8::Handle<T> &val) {
                           ^
../node_modules/nan/nan.h:334:27: note: ‘template<class T> v8::Local<T> Nan::imp::NanEnsureLocal(const v8::Local<T>&)’ previously declared here
   NAN_INLINE v8::Local<T> NanEnsureLocal(const v8::Local<T> &val) {
                           ^
../node_modules/nan/nan.h:757:13: error: ‘node::smalloc’ has not been declared
     , node::smalloc::FreeCallback callback
             ^
../node_modules/nan/nan.h:757:35: error: expected ‘,’ or ‘...’ before ‘callback’
     , node::smalloc::FreeCallback callback
                                   ^
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(char*, size_t, int)’:
../node_modules/nan/nan.h:761:50: error: ‘callback’ was not declared in this scope
         v8::Isolate::GetCurrent(), data, length, callback, hint);
                                                  ^
../node_modules/nan/nan.h:761:60: error: ‘hint’ was not declared in this scope
         v8::Isolate::GetCurrent(), data, length, callback, hint);
                                                            ^
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(const char*, uint32_t)’:
../node_modules/nan/nan.h:768:67: error: no matching function for call to ‘New(v8::Isolate*, const char*&, uint32_t&)’
     return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
                                                                   ^
In file included from ../node_modules/nan/nan.h:25:0,
                 from ../secp256k1.cc:1:
/home/someone/.node-gyp/4.2.6/include/node/node_buffer.h:31:40: note: candidate: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, v8::Local<v8::String>, node::encoding) <near match>
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                        ^
/home/someone/.node-gyp/4.2.6/include/node/node_buffer.h:31:40: note:   conversion of argument 3 would be ill-formed:
In file included from ../secp256k1.cc:1:0:
../node_modules/nan/nan.h:768:67: error: invalid conversion from ‘uint32_t {aka unsigned int}’ to ‘node::encoding’ [-fpermissive]
     return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
                                                                   ^
In file included from ../node_modules/nan/nan.h:25:0,
                 from ../secp256k1.cc:1:
/home/someone/.node-gyp/4.2.6/include/node/node_buffer.h:43:40: note: candidate: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, char*, size_t) <near match>
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                        ^
/home/someone/.node-gyp/4.2.6/include/node/node_buffer.h:43:40: note:   conversion of argument 2 would be ill-formed:
In file included from ../secp256k1.cc:1:0:
../node_modules/nan/nan.h:768:67: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
     return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
                                                                   ^
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(uint32_t)’:
../node_modules/nan/nan.h:772:29: error: could not convert ‘node::Buffer::New(v8::Isolate::GetCurrent(), ((size_t)size))’ from ‘v8::MaybeLocal<v8::Object>’ to ‘v8::Local<v8::Object>’
     return node::Buffer::New(v8::Isolate::GetCurrent(), size);
                             ^
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanBufferUse(char*, uint32_t)’:
../node_modules/nan/nan.h:779:12: error: ‘Use’ is not a member of ‘node::Buffer’
     return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size);
            ^
secp256k1.target.mk:125: recipe for target 'Release/obj.target/secp256k1/secp256k1.o' failed
make: *** [Release/obj.target/secp256k1/secp256k1.o] Error 1
make: Leaving directory '/home/someone/ethereum/node_modules/secp256k1/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 4.2.0-27-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/someone/ethereum/node_modules/secp256k1
gyp ERR! node -v v4.2.6
gyp ERR! node-gyp -v v3.2.1
gyp ERR! not ok 
/home/someone/ethereum
└── web3@0.15.1 

npm WARN enoent ENOENT: no such file or directory, open '/home/someone/ethereum/package.json'
npm WARN ethereum No description
npm WARN ethereum No repository field.
npm WARN ethereum No README data
npm WARN ethereum No license field.
npm ERR! Linux 4.2.0-27-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/local/bin/npm" "install" "ethereumjs-accounts"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.3
npm ERR! code ELIFECYCLE

npm ERR! secp256k1@0.0.15 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the secp256k1@0.0.15 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the secp256k1 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs secp256k1
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls secp256k1
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/someone/ethereum/npm-debug.log
alexykot commented 8 years ago

Same here, exactly same error.

alexykot commented 8 years ago

In fact the pull request https://github.com/SilentCicero/ethereumjs-accounts/pull/14 is fixing that. Not sure when that would be merged in though.

rolandkofler commented 8 years ago

Still doesn't work

tauqeerqau commented 7 years ago

hi, did you guys find any fix for this issue?

bilthon commented 7 years ago

same problem here

vbaranov commented 7 years ago

the same issue, any updates?

martriay commented 6 years ago

same issue

pau1m commented 6 years ago

same issue

SilentCicero commented 6 years ago

Once again, this library is depreciated. Please use ethereumjs account or ethjs or ethers js!

Sent from my iPhone

On Dec 18, 2017, at 6:45 AM, pau1m notifications@github.com wrote:

same issue

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

ltfschoen commented 6 years ago

Oh bugger, I'm getting the same error. I was hoping to use this library to generate an account since the latest Web3.js 1.0.0-beta.27 hasn't finished adding unlockAccount() https://github.com/ethereum/web3.js/issues/1264. I just tried using ethers.js but that didn't work for me either: https://github.com/ltfschoen/geth-node/compare/ethers-library?expand=1, it gave me error: Provided address "0x3141592653589793238462643383279502884197169399375105820974944592" is invalid, the capitalization checksum test failed, or its an indrect IBAN address which can't be converted.

SilentCicero commented 6 years ago

I would say then: use ethjs-account for generation, and ethereumjs-tx for signing. If you need a provider to intercept and sign transactions use ethjs-provider-signer.

Just don't use ethjs-signer (as it doesn't have replay protection eip155).

Sent from my iPhone

On Dec 30, 2017, at 7:07 AM, Luke Schoen notifications@github.com wrote:

Oh bugger, I'm getting the same error. I was hoping to use this library to generate an account since the latest Web3.js 1.0.0-beta.27 hasn't finished adding unlockAccount() ethereum/web3.js#1264. I just tried using ethers.js but that didn't work for me either: https://github.com/ltfschoen/geth-node/compare/ethers-library?expand=1

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

ltfschoen commented 6 years ago

@SilentCicero Thanks, you've created some awesome resources and I just quickly tried them out, but they don't appear to incorporate deployment of an actual smart contract to a network. I also encountered the error shown below:

I installed the dependencies:

npm install --save-dev ethjs-query
npm install --save-dev ethjs-account
npm install --save-dev ethereumjs-tx
npm install --save-dev ethjs-provider-signer

Then injected the dependencies into main.js and ran with node main.js:

const EthjsAccount = require('ethjs-account');
const EthjsProviderSigner = require('ethjs-provider-signer');
const EthjsQuery = require('ethjs-query');

const ethjsAccount = EthjsAccount.generate('892h@fs8sk^2h8s8shfs.jk39hsoi@hohsko');
const ethjsAccountAddress = EthjsAccount.getAddress(ethjsAccount.privateKey);
console.log(`ethjsAccount: `, ethjsAccount);
console.log(`ethjsAccountAddress: `, ethjsAccountAddress);

const ethjsSignerProvider = new EthjsProviderSigner(GETH_IPC_PATH, {
  signTransaction: (rawTx, cb) => cb(null, EthjsSigner.sign(rawTx, ethjsAccount.privateKey)),
  accounts: (cb) => cb(null, [ethjsAccountAddress]),
});
const ethjsQueryProvider = new EthjsQuery(ethjsSignerProvider);
console.log(`ethjsSignerProvider: `, ethjsSignerProvider);
console.log(`ethjsQueryProvider: `, ethjsQueryProvider);

But the error was:

Error: [ethjs-account] invalid address value "0xc3ab8291f0c2029bb712159c2f4d768b55f59c978eab26dcf1e5fc5e7bd24294" not a valid hex string
    at Object.getAddress (/Users/Ls/code/blockchain/geth-node/node_modules/ethjs-account/lib/index.js:53:11)
    at Object.<anonymous> (/Users/Ls/code/blockchain/geth-node/scripts/main.js:21:42)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
    at Function.Module.runMain (module.js:665:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3

Here's a branch in my repo where I tried to incorporate it. I got that error, but the idea was to use that address and provide it to .send after .deploy, as shown https://github.com/ltfschoen/geth-node/compare/ethjs-libraries?expand=1

I've created individual files where I've experimented here: https://github.com/ltfschoen/geth-node/tree/master/scripts/experiments

SilentCicero commented 6 years ago

That is another tool yet to be incorporated ;) checkout SilentCicero/ethdeploy to be ethjs-deploy.

Sent from my iPhone

On Dec 30, 2017, at 3:54 PM, Luke Schoen notifications@github.com wrote:

@SilentCicero Thanks, you've created some awesome resources and I just quickly tried them out, but they don't appear to incorporate deployment of an actual smart contract to a network. I also encountered the error shown below:

I installed the dependencies:

npm install --save-dev ethjs-query npm install --save-dev ethjs-account npm install --save-dev ethereumjs-tx npm install --save-dev ethjs-provider-signer Then injected the dependencies into main.js and ran with node main.js:

const EthjsAccount = require('ethjs-account'); const EthjsProviderSigner = require('ethjs-provider-signer'); const EthjsQuery = require('ethjs-query');

const ethjsAccount = EthjsAccount.generate('892h@fs8sk^2h8s8shfs.jk39hsoi@hohsko'); const ethjsAccountAddress = EthjsAccount.getAddress(ethjsAccount.privateKey); console.log(ethjsAccount:, ethjsAccount); console.log(ethjsAccountAddress:, ethjsAccountAddress);

const ethjsSignerProvider = new EthjsProviderSigner(GETH_IPC_PATH, { signTransaction: (rawTx, cb) => cb(null, EthjsSigner.sign(rawTx, ethjsAccount.privateKey)), accounts: (cb) => cb(null, [ethjsAccountAddress]), }); const ethjsQueryProvider = new EthjsQuery(ethjsSignerProvider); console.log(ethjsSignerProvider:, ethjsSignerProvider); console.log(ethjsQueryProvider:, ethjsQueryProvider); But the error was:

Error: [ethjs-account] invalid address value "0xc3ab8291f0c2029bb712159c2f4d768b55f59c978eab26dcf1e5fc5e7bd24294" not a valid hex string at Object.getAddress (/Users/Ls/code/blockchain/geth-node/node_modules/ethjs-account/lib/index.js:53:11) at Object. (/Users/Ls/code/blockchain/geth-node/scripts/main.js:21:42) at Module._compile (module.js:624:30) at Object.Module._extensions..js (module.js:635:10) at Module.load (module.js:545:32) at tryModuleLoad (module.js:508:12) at Function.Module._load (module.js:500:3) at Function.Module.runMain (module.js:665:10) at startup (bootstrap_node.js:187:16) at bootstrap_node.js:608:3 — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

ltfschoen commented 6 years ago

I was mistaken about Web3.js 1.0.0-beta.27. unlockAccount does actually work. I didn't use Promises correctly in order to unlockAccount before running deploy to deploy the contract. Here's a commit where i got it to deploy https://github.com/ltfschoen/geth-node/commit/611723f044295b8cb05858d382c1b6377d1e1955