Questions tagged [web3js]

Javascript API and library for Ethereum To develop applications on Ethereum, you can use the web3 object provided by the web3.js library. Under the hood it communicates to a local node through RPC calls. web3.js works with any Ethereum node, which exposes an RPC layer. https://github.com/ethereum/wiki/wiki/JavaScript-API

Filter by
Sorted by
Tagged with
1
vote
0answers
296 views

Integrate website with ethereum [closed]

I want to build a trading website based on ethereum and Web3. What I should take care of while building such platform ?.how will my transactions update ethereum? Please advice. thanks in advance
3
votes
1answer
604 views

getTransactionCount always returns 1048576, no matter what address

No matter what random address I use, web3.eth.getTransactionCount always prints 1048576 web3.eth.getTransactionCount("0xb222a0f8f77dbbc3a0fc87f77717ddc59cf225d7") 1048576 Let say, I change a simple ...
3
votes
1answer
404 views

web3.personal.signAndSendTransaction as a Contract method?

As web3.personal.signAndSendTransaction method, Is there any such method available for Contract functions? for example: MyContract.storeName.signAndSendTransaction("name", {from:web3.eth.accounts[...
17
votes
3answers
14k views

What's the proper way to wait for a transaction to be mined and get the results? [duplicate]

I'm using react to write the frontend for my dApp, and doing this to (attempt to) update react's state via an asynchronous sendTransaction call: var thisJS = this web3.eth.sendTransaction({from: ...
4
votes
1answer
4k views

Can I send ethereum to a contract outside of its constructor?

How do I fund Solidity contracts with Ether? The example in the Solidity FAQ, http://solidity.readthedocs.io/en/develop/frequently-asked-questions.html#store-ether-in-a-contract, funds a contract via ...
1
vote
1answer
1k views

web3 sendTransaction returns tx but getTransaction retuns undefined when Geth is restarted

js code: const Web3 = require('web3'); const web3 = new Web3(); const {eth, personal} = web3; web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545')); personal.unlockAccount(eth....
3
votes
2answers
3k views

nodejs 3.10.9, installation web3, ReferenceError: web3 is not defined

I'm running: nodejs 3.10.9 geth 1.4.18-stable-c72f5459 I did the folowing steps: run geth --testnet --rpc installed web3 via npm install web3 -g. run node (console) when I am in the node-console ...
4
votes
1answer
980 views

How to use requirejs to import web3

I want to use web3 from loginmain.js file. My project hierarchy looks like: Project/ www/ login.html js/ login.js app/ loginmain.js lib/ jquery.js ...
6
votes
2answers
10k views

Send transaction using MetaMask injected web 3

Metamasks injected web3 gives an error when using web3.eth.sendTransaction() web3.eth.sendTransaction({from:web3.eth.accounts[0], to:'', data: // hash to interact with contraact, gas:85000}); What ...
4
votes
1answer
840 views

When a contract calls another contracts, can it return values?

When a contract calls another contract, are values returned ? I've seen things like: function foo() external returns (bool success) { if( ... ) throw; return true; } But have read that calls ...
2
votes
1answer
855 views

Access contract by address, without knowing implementation

I want to access and interact with a deployed contract. My restriction: Knowing the API (functions, fields), but not the implementation. I was looking at the Ethereum documentation "Accessing ...
5
votes
0answers
108 views

Why did sendRawTransaction lose some transactions although it returned those transactions' hash values? [closed]

In a short time within 1 min, 5 transactions were submitted using sendRawTransaction of web3 and the 5 hash values of these txs had been got. But, only 2 transactions could be found in the ethereum ...
2
votes
1answer
147 views

Strange Ethconsole Output for getbalance typo

I came across this when I made a typo checking my ETH balance from the ethconsole. I had incorrectly typed web3.eth.coinbase. I poked around and anything after web3.eth. that is a typo brought up a ...
1
vote
1answer
970 views

Connect to Ethereum Node using Nodejs

I have the following ethereum node running as : sudo geth --rpc --rpcaddr "127.0.0.1" --rpcport "8000" --rpccorsdomain "*" --datadir "/home/Ethereum/Data/node1" --port "30303" --maxpeers 2 --ipcapi "...
28
votes
6answers
57k views

Insufficient funds for gas * price + value

Sending Address has over 1 Eth in current Balance. Using the Geth console, I can send many transactions of any amount less than .033 eth.sendTransaction({to:'...
2
votes
1answer
1k views

Can I call contract function (balanceOf) based on block number?

I want to check the DAO balance address in the specify time(block number) Is it possible to specify the block number when calling a contract function in web3. var contract = web3.eth.contract(abi)....
1
vote
3answers
151 views

how difficult is it to link an address to an account?

Every wallet can generate as many addresses as I want in order to obfuscate the origin and destination of transactions. But each account has exactly one key-pair and it is trivial to get the public ...
4
votes
1answer
2k views

Error: The contract code couldn't be stored, please check your gas amount , when creating new contract [duplicate]

I am trying to create new contract but I get the error: Error: The contract code couldn't be stored, please check your gas amount. In the script, I have: var balance = web3.eth.getBalance(...
3
votes
1answer
723 views

Getting Invalid address or Invalid Params when deploying new contract on test network with Parity

I am trying to deploy new contract on the net and I get two errors depending how exactly how I do it. Since I can not get ABI compiling contract on Parity I use solc --abi to get it. Now depending if ...
21
votes
8answers
58k views

How to get transactions by account using web3 js?

I'm sure this question was asked before, but I did not find any result that helped my problem. How can I get the transactions (in and out) for a given account? I use nodejs and web3? With this line ...
6
votes
2answers
2k views

How to access all accounts across multiple nodes? JS/Web3.js/API

I'm running a private ethereum development network with 3 nodes connected to each other. Before asking my question, something about my setup. This is how I start those nodes: geth --networkid 2345 --...
3
votes
1answer
485 views

Can I use Ethereum's Whisper protocol to transfer files?

Here is an code example: shh.post({ "from": myIdentity, "topic": [ web3.fromAscii(appName) ], "payload": [ web3.fromAscii(myName), web3.fromAscii("What is your name?") ], "ttl": 100, "...
10
votes
1answer
14k views

How to get string from hex on Smart Contracts results [duplicate]

On a Smart Contract called "mem" there is a function called "get()" that returns a bytes32 that is supposed to be a string. How can I decode the string? The result is an hex value. I have tried ...
4
votes
1answer
782 views

How to get the transaction hash once it is mined?

In JavaScript (web3.js), how do I get the transaction-hash corresponding to a function executed in my smart contract?
1
vote
2answers
270 views

Automatically create an account for new customer

I would like to automatically create an account (EOA) in Ethereum for all the users of my platform as soon as they register. Is it possible? Thanks for your help
4
votes
2answers
2k views

How can I access the address of a contract created by another contract?

I am having problems in accessing the address of a new contract generated within another contract acting as Factory. My code: contract Object { string name; function Object(String _name) { ...
30
votes
4answers
48k views

How to call my contract's function using sendTransaction

This may be a very basic question, I don't know why but I am unable to find correct solution to how can I call my contract's method using sendTransaction. I have a transfer(address, uint256) function ...
3
votes
1answer
367 views

How to reduce eth.filter.watch delay?

I have a test contract that emits events. I'd like to create a web app that shows a list of all created events + new ones as they arrive. I'm using Meteor app connected to geth 1.4.10 through rpc. The ...
6
votes
1answer
615 views

How to get only latest logged event via Web3 API?

Is there a way to get only latest log for e.g myContractInstance.myEvent? Don't wanna rewind whole past. I know I can pass latest to a filter object, but that's not quite what I want. I'd like to get ...
5
votes
1answer
930 views

How to generate an Ethereum "brain wallet" in Javascript?

Namely, enter string -> get private key?
8
votes
1answer
660 views

Is there a recommended / secure way to unlock an account through Web3 interface / HTML page securely?

This question was asked on Reddit: Is there a secure/recommended solution to unlock an account and send a tx through the Web3 interface (from a Html page)? One of the alternatives that I have in mind ...
3
votes
1answer
357 views

What will be the format of data to execute a function from web

I have deployed a cryptocurrent on Private testNet from here. I have deployed two contracts, lets call them contract1 and contract2. Contract1 has less features than contract2 (like transferFrom() ...
3
votes
1answer
194 views

Web3 constant functions require password

I have two simple constant functions in a contract: function fun1 (address A) constant returns (uint) { return mappingAS[A].length; } function fun2 (address A, uint V) constant returns (string,...
3
votes
1answer
336 views

how does eth-lightwallet manage transaction nonces?

I am using eth-lightwallet 2.4.3. I found some of my transactions never got mined. Using txpool.status I noticed I was getting a number in queued. txpool.status { pending: 0, queued: 2 } I ...
6
votes
2answers
4k views

Web3.js and local HTML UI

So my Mix-ide install seems irrevocably crashed and given that there's no other IDE with integrated UI, I'm forced to face the inevitable learning of authoring HTML UI without much of a web dev ...
6
votes
1answer
4k views

Geth get deployed contract

I am new to the blockchain and up until now I have managed to deploy contracts and transfer ether through both geth console and node code... I am now trying to figure out how to get the contract that ...
3
votes
2answers
375 views

Contract function call in different way

To access any function of contract, we use : contractInstance.functionname.sendtransaction() or contractInstance.functionname.call() Is it possible to call it as : contractInstance[functionname]....
4
votes
2answers
109 views

Is there a simple way to make sense of Ethereum tx given ABI?

It seems that ABI is used by web3.js to only make sense of the function calls and storage values, are there any simple means to make sense of Ethereum tx given ABI? For example, given ABI, is there ...
4
votes
2answers
2k views

Solidity return string not hex?

Currently I'm using ether.camp to create a contract. At this stage it simply gets and stores some values. However when I try and get the values they are in bytes/hex even though the return type is ...
17
votes
1answer
8k views

Passing an array as a parameter from javascrpt (web3) to a Solidity function

I have the following Solidity function: function func(bytes32[2] data) external { bytes32 x; bytes32 y; x = data[0]; y = data[1]; } I'm trying to call it from ...
2
votes
1answer
488 views

monitoring deposit or withdraw using web3js

I know I can send ether to another account using web3.eth.sendTransactions. I also want to get confirmation when a transaction has been successfully broadcasted to the ethereum network, or when an ...
5
votes
2answers
4k views

Event Listener functionality of the Web3.py doesn't register changes

I am using the python implementation of the web3 library.(https://github.com/pipermerriam/web3.py) Calling and interacting with contracts works fine, but when it comes to the event listener ...
0
votes
2answers
964 views

A NodeJS app running on AWS instance + Web3 object

I have an NodeJS app running on AWS instance(the one you get for free). I want to get access to Web3 object in my server.js file. I don't think that installing and running full client like Geth on AWS ...
2
votes
1answer
191 views

Is it possible to use web3.js API methods to interact with Eris chains

Is it possible to use the Web3.js API methods to interact with Eris blockchain? If yes, what should I pass in as the argument for setting the web3 provider?
1
vote
2answers
1k views

Events called in constructor function

how to watch events in web3.js when the event is fired from inside the constructor functionof a contract? Eg: contract A{ event Invoked(string); function A(){ Invoked("constructor invoked!");...
3
votes
1answer
454 views

Is it possible to use events to implement server-like functionality?

In the documentation and suggested links and this question, it is mentioned that events are bound to methods and fire when a method is called (via a transaction). There is an example of a contract: ...
2
votes
1answer
954 views

Custom token display in case of geth testnet

From this, i found that To add a token to watch, go to the contracts page and then click "Watch Token". A pop-up will appear and you only need to paste the contract address. The token name, symbol and ...
4
votes
2answers
649 views

Solidity events callback in nodejs

I'm using ethereum to create a transaction system. My goal is to record every transaction when an event is fired and the client shall receive a response whether the transaction was successfully ...
5
votes
1answer
4k views

How to set msg.sender in web3

I'm making a subcurrency with solidity. I'm confused at implementing the transfer mechanism. Here's my code: function SubCoin(){ balances[msg.sender] = totalPoints; } function send(address to,...
0
votes
1answer
941 views

web3 alternative languages (aside from javascript)?

Are there any implementations of web3 that are not in Javascript but preferably a compiled language with full multithreading support?

1
100 101
102
103 104
107