The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [ethereumjs]

For questions regarding the installation or use of EthereumJS, a Javascript library that implements a number of Ethereum utility functions.

Filter by
Sorted by
Tagged with
26
votes
9answers
38k views

How to get private key from account address and password?

What I have 1. I am able to create new account with personal.newAccount() method of web3 api. 2. I am working on my private blockchain. 3. geth node start with following command:- geth --datadir ~/...
25
votes
6answers
22k views

web3.eth.contract is not a function when making contract

Whenever I try and make a contract, I get: web3.eth.contract is not a function I'm using this code: const path = require('path'); const fs = require('fs'); const solc = require('solc'); ...
18
votes
6answers
25k views

How to decode input data from a transaction?

I'm sending a transaction to an account with some data with the following command: eth.sendTransaction({from:eth.accounts[0],to:eth.accounts[1],value:web3.toWei(1,"ether"),data:web3.toHex("http://...
15
votes
1answer
2k views

Getting the wrong address back from ecrecover

When I sign a string using the following code I get back a different address to the one I signed with. The address returned is different for different strings. const util = require('ethereumjs-util') ...
14
votes
1answer
8k views

EthereumJS: How to get public key from private key

I am trying to create a private key and its corresponding public key using EthereumJS library. So far so good I've been able to create private keys using keythereum.create() method. Nevertheless I ...
9
votes
2answers
3k views

how to use ethereumjs-tx.js in a browser

I have been trying to use ethereumjs-tx in a browser. I have downloaded the browser builds from here https://github.com/ethereumjs/browser-builds/tree/master/dist This is my code snippet <head>...
9
votes
3answers
6k views

How to send transaction with ethereumjs-tx?

I installed and used ethereumjs-tx, as explained here. I ran the following commands: var Tx = require('ethereumjs-tx') var privateKey = new Buffer('xxxxxxxxx', 'hex') var rawTx = { nonce: '0x00', ...
8
votes
1answer
4k views

Getting an address from ethereumjs-utils ecrecover

I am trying to sign a string using web3.eth.sign() and then get the public key I signed with from the signature. To do this I am using ecrecover() from ethereumjs-utils, which returns a buffer. When I ...
8
votes
2answers
3k views

How can I connect to geth by IPC on nodejs?

This this the command line i have used to get geth running. geth ipc --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" --ipcpath "/root/.ethereum_experiment/geth.ipc" so from node js ...
7
votes
1answer
3k views

Web3 js 1.0 is throwing big number error while transfering tokens

When I tried to transfer more then 1000 tokens, it's throwing an error like as mentioned below (I'm using web3 js 1.0.0 34 beta version). Error: [number-to-bn] while converting number 1e+23 to BN....
6
votes
2answers
1k views

How can we retrieve the evolution of the state of an smart contract variable?

I have a simple smart contract with a variable color which stores a string. If I unterstand correctly, each transaction can change the state of this variable and is stored permanently into the ...
6
votes
3answers
1k views

I get error couldn't find module 'ethereumjs-wallet/hdkey'

I was running this code deploy.js const HDWalletProvider = require('truffle-hdwallet-provider'); const Web3 = require('web3'); const { interface, bytecode } = require('./compile'); const provider = ...
6
votes
1answer
1k views

Is there any lightweight JS library that generates Ethereum addresses from 256-bit private keys?

I have a 256-bit private key and I want to get its public address without having to install Geth (which is quite heavy) on the machine. Is there any small JS lib that does that?
6
votes
1answer
3k views

Sign message with Metamask and verify with ethereumjs-utils

Client side: web3.eth.sign(address, hash); // generates signature Server side: const ethutils = require('ethereumjs-util'); const extractAddress = function(signature, hash){ //signature and hash ...
6
votes
2answers
1k views

What are explicit steps to deploy dapp to mainnet?

There doesn't seem to be much documentation on how to transition your truffle DApp from working locally to being migrated to the mainnet. Below are some steps I generally would think are necessary: ...
6
votes
1answer
453 views

How to use Nodejs/Javascript and LevelUp to read Blocks from local geth database files (.ldb)?

Here's what I've been able to get going to far. I can open the blockchain database but I can't seem to create a valid blockchain object (nor call the blockchain.getBlock() function successfully). I'...
5
votes
2answers
17k views

What is uint256?

With regard to Solidity, What is UINT256? From the token example at https://ethereum.org/token : /* This creates an array with all balances */ mapping (address => uint256) public balanceOf; ...
5
votes
2answers
2k views

how to parse the Ethereum Blockchain and save the output to a file? geth console isn't node, right?

I'm trying to parse the Blockchain and extract to a txt file part of the transactions and Addresses to a specific contract (theDAO) for later analysis. I'd like to save the output to a file (.txt) in ...
5
votes
1answer
2k views

Is there a Javascript client for Ethereum, like Geth?

Ethereum's Github has ethereumjs-lib. It appears to be a collection of modules, but is it also a client like Geth? If so, how can one run this Javascript client?
5
votes
2answers
5k views

Create ether wallet account using node js and web3

Hello I want to create a ether wallet account using node js and web3. Can anyone please help me in this regard. Thanks in advance!
5
votes
2answers
2k views

Is it possible to send a smart contract to an address wallet?

As explained here, a smart contract is deployed on the blockchain via a transaction, with the following code: var primaryAddress = eth.accounts[0] var abi = [{ constant: false, inputs: { name: 'a', ...
5
votes
1answer
1k views

You must deploy and link the following libraries before you can deploy a new version of Contract

I made my custom library and try to using on my own project. Below is the 2_deploy_contracts.js module.exports = async(deployer, netowrk) => { await deployer.deploy(OptionStorage, ownerAddress); ...
5
votes
2answers
4k views

How would you integrate Ethereum smart contracts into an existing node/react project?

I have an existing node/graphql/mongodb/react/redux project that is in beta and I would like to integrate Ethereum smart contracts to be able to save transaction information into the block chain. Is ...
5
votes
1answer
952 views

Authentication using ethereum account

Trying to figure out a way to Authenticate users them having an ethereum account. New to ethereum and cryptography in general and my thought may not be adequate. In essence I am thinking to be able ...
5
votes
1answer
971 views

web3 API not returning instance of contract when used with eth-lightwallet and hookedweb3provider

I have managed to get a hooked web3 provider with eth-lightwallet creating a contract on a private geth node. I see the tx on the geth logs and see it get added to a block when mined. However I am ...
5
votes
1answer
651 views

web3.eth.sign not returning a valid signature - Or how else does this work?

EDIT: Problem Solved; working example of login below I use the sha3 of a message I want to sign with eth.sign m = web3.sha3("Please work.") I then runeth.sign(eth.coinbase, m) And it returns me: ...
4
votes
2answers
856 views

Transaction monitoring for deposits?

How do I monitor deposits for the account on ethereum? I saw some APIs that do this and I have tried to do the same on js web3 with filter but without any luck. What I would need is to get all the ...
4
votes
2answers
455 views

Difference between public private and consortium blockchain

I am new to blockchain therefore i am trying to understand difference between private public and consortium blockchain. I do understand public blockchain but i am unable to differentiate between ...
4
votes
1answer
983 views

loadScript() returns false error

I am using geth and writing a js script and I try to load it using loadScript command, but when I run this command, I get false : loadScript("C:\Users\Sandi\Desktop\Solidity\sol_js.js") false I ...
4
votes
1answer
250 views

Can I use EthereumJS testrpc with ethjsonrpc (python) to test my contract localy?

As far as I understand EthereumJS can simulate a client on a simulated blockchain and provide RPC interface (hope I'm using the right words). Does it mean I can interact with this client (and with my ...
4
votes
1answer
1k views

Etherbase, Coinbase and Uncle [duplicate]

what is the main difference between etherbase and coinbase? And what is the meaning of "uncle" in a transaction?
4
votes
1answer
1k views

How can I connect to ethereum with only a web browser to monitor a contract

AFAICT it requires a node such as geth to connect to ethereum to get or change contract state. I only need to get state, not change state, but I want to do it only from a web browser. I don't want ...
4
votes
1answer
428 views

Wrong address derived from the private key

I try to create and sign a transaction using ethereumjs-tx, as follows: (same code as in here, except the private key) var Transaction = require('ethereumjs-tx') var tx = new Transaction() tx.nonce = ...
4
votes
2answers
527 views

Sign transaction on ARM microcontroller

Is it possible to sign transaction on ARM Microcontroller and then somehow broadcast it? I have read about ethereumjs-tx, but how to implement it without any OS on board? UDPADE: I have found how to ...
4
votes
1answer
1k views

Will miners still make Ether after POS?

So, I am new to the entire crypto currency idea although, I am a software developer and I have been planning for years to create a CRM that is fully autonomous and exceptionally secure. Ether's code ...
4
votes
0answers
505 views

How can I retrieve transaction hashes using web3 batch requests?

When I send a transaction using Truffle's contract wrappers - or using plain web3 sendTransaction() - I get a tx hash back that I can use to confirm the tx has completed. While using batch requests (...
4
votes
1answer
197 views

How to use BTCRelay for my ICO to get funds in BTC?

I want my ICO get investment in BTC also ,When i browse over internet I came up with BTCRelay concept . I tried to read their docs but it make me confused .Anybody give me a simple way to use BTC ...
4
votes
0answers
224 views

how to get revert at the previous timestamp of evm in testrpc

I am testing my contracts so at some point i need to increase the timestamp of evm that i achieve through evm_timeIncrease but now i want to execute some functions on the basis of current timestamp ...
4
votes
0answers
277 views

Why are there discrepancies between client message signatures?

I have been investigating message signing using an Ethereum account, and have become somewhat bemused by the different signatures that I receive from different clients and different libraries. I have ...
4
votes
1answer
170 views

Testrpc transactions are failing. How do I perform a transaction when Mist cannot estimate gas?

I am attempting to perform transactions and create contracts using EthereumJS Testrpc. I set it up by running the following: Terminal 1: testrpc Terminal 2: mist --rpc localhost:8545 Running both ...
3
votes
3answers
2k views

How to verify MetaMask account holder is the real owner of the address?

I'm making a dapp that will make calls to a Node.js server. I expect the user to have MetaMask installed and I want to verify that he is the real owner of the current address on MetaMask (i.e. ...
3
votes
3answers
12k views

How can the web3 library be imported in a web application?

During the compilation of my JS code I used the statement Web3 = require('web3') for importing the web3 library. But since the require function doesn't work in a web application, I would like to know ...
3
votes
3answers
3k views

how to make batch transaction in ethereum?

Is it possible sending ether to multiple addresses in one go, better called batch sending? I want to make an API to transfer ether to 100 address at once so that I do not need to make 100 transactions....
3
votes
2answers
470 views

Collecting ERC20 balances from multiple addresses?

I'm building a dApp that involves creating unique accounts for individual users for ERC20 deposits [I keep the addresses and private keys in a centralized database], for popular ERC20 tokens like BNB, ...
3
votes
1answer
2k views

How to convert BN result into readable string or number in ethjs?

I'm receiving the result in BN format. How can I convert it into actual string or number? I'm using ethjs library to interact with Smart Contract. token.totalSupply().then((totalSupply) => { // ...
3
votes
1answer
240 views

Send eth from one account to another using transfer() function

I am trying to write a smart contract that will send eth from one account to another account : Contract Send { event Sent(address from, address to, uint amount ); function send(address _receiver,...
3
votes
1answer
1k views

Ethereumjs testrpc getting 400 Bad Request when navigating to localhost:8545

I've followed the instructions for installing ethereumjs testrpc (https://github.com/ethereumjs/testrpc) I have Node v.6.9.1 I'm on macOS so I have XCode Command Line Tools installed. Running npm ...
3
votes
2answers
969 views

Signing raw transaction AssertionError: The field v must have byte length of 1

I have followed every option present in net to do Raw transaction I have followed ethereumjs-tx let resData = {}; var Tx = require('ethereumjs-tx') var privateKey = new Buffer('...
3
votes
2answers
260 views

how to setup a ethereum private blockchain?

Does anyone know how to set up a private blockchain in ethereum network? is that possible to run a private ethereum node? I have seen forking of public blockchain like EOS into a private blockchain.i ...
3
votes
1answer
292 views

Evaluate the performance of a smart contract [closed]

What is the best way and tools to evaluate the performance of a smart contract. More specifically, I want to test my contract for large scale deployment by making a script that emulate real world ...