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

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
1answer
610 views

Managing multiple filters in geth?

In the interactive JavaScript console of geth, I have added some JS snippets(filters) through the loadScript() command and I need to remove/stop executing those filters. Is there any way to do this ...
3
votes
1answer
857 views

Is there a way to use the web3 “coder” module as a standalone?

I'm trying to use https://github.com/ethereum/web3.js/blob/master/lib/solidity/coder.js to easily encode/decode my data but i'm having a hardway figuring out how to use it. Is it available as a ...
1
vote
1answer
381 views

Deploying contract with web3 returning all zeros transaction hash

I am running the following code in web3 the backend is a node running parity --testnet -j -w --jsonrpc-interface all. My web3 code // data.contracts.TestContract is the results of // solc test-...
4
votes
1answer
111 views

Dapp: Ask mist to sign a transaction

As I see it dapps can only be used from webbrowsers (apart from the outdated secret open source release of the mist browser or whatever that was called). That leaves the question how to send ...
1
vote
2answers
376 views

Is web3 a true distributed app?

The web3.js is the most easiest and perhaps the standard way of dapp creation.And there are two providers possible as of now , HttpProvider and IPCProvider. The HttpProvider takes the address at which ...
1
vote
2answers
488 views

How to find number of nodes in ethereum using web3?

Is there a way to find the number of nodes in the ethereum network using the web3 javascript console? There is a command to find the number of peers, but couldn't find a query to get the total number ...
4
votes
1answer
412 views

getStorageAt: What if two transactions in the same block?

I use web3.getStorageAt to access historical information. I can specify a block to see the content of a variable in a given block. But one block can contain several transactions, each modifying this ...
7
votes
1answer
3k views

Executing custom JavaScript Snippets through Non-Interactive console (geth --exec)

I have a JavaScript snippet to get the latest transaction to/from an account. After starting the geth instance, I did this in the interactive JS console: jsFunction is a function in filename.js &...
4
votes
1answer
348 views

Contract code not executing from web3, works from Mist

I seem to be having a problem w/ contract code not executing when called from web3 (works when called from mist). The Eth goes to the contract, so I know it is making the call at least. I am calling ...
2
votes
1answer
275 views

Event log fetch issue

I have an event as below: event orderResult(string status, uint32 indexed orderId); Calling the event as below: orderResult(status, orderId); Using web3.js to get event data on callback as below (...
4
votes
1answer
909 views

Events doesn't fire executing transaction with web3 in testrpc

I'm executing the basic token contract found at https://ethereum.org/token: contract tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData); } ...
15
votes
1answer
2k views

How do I get the storage indices/keys?

I would like to explore the storage data of a contract. I have geth fully synched and I interact with it over RPC. There is the function "eth.getStorageAt(addr, index, block)" provided, but you need ...
8
votes
1answer
2k views

Private chain: Extracting the “data” from an account?

I have initiated and mined a transaction between two accounts. I also included a data field in this transaction. This is just random hex data. Here is the command: eth.sendTransaction({from:...
15
votes
3answers
7k views

Using web3 to sign a transaction without connecting to geth

Is it possible to use the web3.js library in a client's browser to let them generate an address and sign a transaction without them connecting to an ethereum node?
9
votes
1answer
1k views

How to check if a transaction is still in the blockchain?

Say we want to confirm that a value transaction tx has reached certain finality, which we define as waiting for 12 block confirmations. We do this to drop the probability of tx getting lost due a fork ...
4
votes
0answers
387 views

How to create my own wallet and own blockchain explorer?

I'm running my own private/permissioned ethereum blockchain via geth on Ubuntu. How can i interact with my blockchain to visualize accounts, blocks, transactions etc...? I've tried a lot of tutorials ...
3
votes
1answer
151 views

What is the best way to show contract data on a website

The data needed to be available through the website is a list of links (1000+), which may be updated (or not) at the rate of 100 links a day. And a list of usernames which starts from 0 and new users ...
4
votes
1answer
189 views

How do I output the full account on the node?

http://etherscan.io/accounts/a list of all normal account on the node. http://etherscan.io/accounts/c list of all contact account on the node. How did obtain this information? Where did that ...
4
votes
1answer
4k views

Get block address through web3.eth.getBlock(1)

I'm getting a list of the last few blocks like described here. Now I can't seem to get the address of each block or the associated contract, through web3.eth.getBlock. A lot gets returned, but no ...
3
votes
1answer
400 views

Retrieving tx.origin and msg.sender from blockchain data

In Solidity, origin and sender can be easily differentiated through tx.origin and msg.sender, respectively. Is it also possible to obtain both sender and origin of a specific transaction from the ...
1
vote
1answer
440 views

How to find transactions per minute

I am trying to find the number of transactions in the Ethereum network using web3. I couldn't find any web3 functions to get the same. I could see etherchain.org and some other network browsers have ...
3
votes
1answer
423 views

What module can be used for a client side wallet in a DApp?

If you want to create a DApp that is a stand alone single page application, there is the need to have access to Ether. There are serveral ways to do that: Metamask accesses your geth server Mist ...
10
votes
3answers
4k views

What does web3.eth.getStorageAt() return?

I want to know how this works: web3.eth.getStorageAt(addressHexString, position [, defaultBlock] [, callback]) What data we can store at any address and how? And what will this eth API return?
7
votes
2answers
4k views

Do I have to unlock my account in geth to call a web3.eth.sign() in JavaScript?

I have: A geth account Access to web3 API I want to: Invoke the function, web3.eth.sign(coinbase, sha) If I put this in a javascript file sign.js, and I call node.js, will it sign my message? Or ...
4
votes
2answers
4k views

Parse uint256 parameters to a function call from web3.js

I was trying to invoke some function which takes two uint256 numbers as inputs. Something likes this (solidity code) function doSomething(uint256 input1, uint256 input2) I have ...
4
votes
2answers
2k views

How to connect Dapp front end to geth node

The very basics of the connection from front end to the contracts and how they can be invoked from front end code would help me a lot. Please share the code and basic steps also. And I am not using ...
6
votes
1answer
2k views

with Web3.js, display sendTransaction data field from function call

From js, I typically call a function with something like this: theFunction=someAbi.at(0x1234...); theFunction.someMethod(param1, param2, param3, {"from": 0x111222..., "to": 0x1234..., "value":...
5
votes
2answers
4k views

Error: account is locked. Attempting to send ether from one account to another, Local Node on Private Blockchain

What is the correct process to unlock an account? I was able to do this successfully in the geth console(see this post for more details on what I've tried Why does account show 0 balance, after ...
2
votes
1answer
198 views

Error: common: unmarshalJSON failed: hash must be exactly 32 bytes(…)?

I have a simple meteor app that is running on a local node on a private chain. I am attempting to send some ether from one test account to another, and I get the following error, from inside the getR()...
2
votes
1answer
52 views

Deploying Network; Using Different PC for different user

I am using MIX IDE in Windows. I have created a new smart contract in Contract.sol, I have 4 Pages of html and there are 4 users. Each html page is controlled by each user. The pages are also ...
2
votes
0answers
26 views

Recovering Contract Address varies every time [duplicate]

I have a contract datafactorycontract that calls another contract dataproducercontract. For that, in datafactorycontract I have a mapping that stores the address of the dataproducercontract being its ...
1
vote
2answers
75 views

Mix: How do I reference user accounts in JS

In Mix I can JS reference contracts with contracts['name']. How do I reference the user accounts?
16
votes
2answers
2k views

How do I retrieve the Voted events from TheDAO?

This question was asked by @Pablo Yabo in the comment section of the question How can I view The DAO proposals including the current voting status?.
3
votes
1answer
342 views

filter for non-contract addresses?

If I set up a filter to receive changes, I only seem to receive transactions for addresses that are contract addresses. How to put a filter to receive transactions that are sent to an address that is ...
4
votes
1answer
1k views

Getting key from Solidity mapping by value

I want to store a key-value pair in a Smart Contract. For example: mapping(uint => address) public myMapping; And I would like to have public access to both: value by key key by value I can ...
3
votes
1answer
2k views

NodeJS+web3 - Reading from a contract works, how about writing to a contract? [duplicate]

In Mist you can call functions of contracts in two ways: On the left panel, to call functions that read from a contract (the result is immediate). On the right panel, to call functions that write ...
3
votes
0answers
26 views

Cant HTML portion in MixIDE

When I add web3.eth.defaultAccount = web3.eth.accounts[0] this code under <script> tag in html. I can't see my entire webpage in Mix IDE. Let me know how to resolve this
4
votes
1answer
574 views

Reading a uint from a mapping keeps returning a random address

I am new to Solidity. I am facing an issue in a simple operation of storing and retrieving data from mapping (uint=> address). I have defined a simple contract: contract test { mapping (uint =&...
4
votes
1answer
377 views

XOR bytes32 (from web3.sha3) in Javascript

How can I perform bitwise operations with a bytes32 object in Javascript? This might seem like a general Javascript question but since this is quite common practice to obfuscate input values in a ...
5
votes
1answer
1k views

How to make synchronous web3.js function calls?

I am using the web3.js library directly in HTML, not via Node.js to interact with my local geth node. The following code gives me an error (web3.min.js:2 Uncaught TypeError: e is not a function) when ...
4
votes
1answer
445 views

Error returning a uint256 value stored in array

contract Student { uint256 index=0; function Students(bytes32 name, uint256 adNo) returns (uint256 vid) { index++; Name[index]=name; AdmissionNo[index]=adNo; vid=index; } mapping(uint256 => bytes32)...
26
votes
2answers
3k views

Is it a good practice to log an event every time I throw in Solidity?

In Solidity (0.3.2) I am aware that there is no way to throw specific exceptions. (Everything is an invalid JUMP error.) It seems beneficial to have a way to log specific errors. Does it make sense to ...
4
votes
1answer
179 views

Fallback function gets called when setting contract variables from external node

I’m a beginner in the Ethereum world and I’ve got some problems dealing with a SimpleStorage contract on my private testnet (http://solidity.readthedocs.io/en/latest/introduction-to-smart-contracts....
7
votes
2answers
4k views

Interact with smartcontracct via web3.js: Uncaught TypeError: MyContract.at is not a function

I'm trying to interact with my smartcontract but get the error: Uncaught TypeError: MyContract.at is not a function My Code: var web3 = require('ethereum.js'); web3.setProvider(...
11
votes
1answer
5k views

Error: personal_unlockAccount method not implemented

Using web3 under nodejs I suddenly want to unlock my account before calling a DAO contract function: var Web3 = require('./node_modules/web3/lib/web3'); // dont override global variable if (typeof ...
8
votes
2answers
5k views

Get smartcontract token balance via JSON RPC

Via Geth commandline I can get my smartcontract token balance with: var mytest = eth.contract([{interface}]).at(contract address); mytest.balanceOf(eth.accounts[0]) >998 I want to present the ...
4
votes
1answer
993 views

Are events in a contract triggered after that particular transaction is mined?

Let's say I have an event notify() in a function called buy(). event notify(); buy(){ //... notify(); } Problem here is that my the notify watch handle is triggered only after that ...
8
votes
2answers
2k views

Call an arbitrary JSON-RPC method with web3

I want to use web3 to call evm_snapshot (only available on testrpc). This is not in web3's list of methods, but I don't want to have to make an actual http call.
2
votes
0answers
495 views

Retrieving contracts from contract address [closed]

I am trying the sample voting contract given in the Solidity docs https://solidity.readthedocs.io/en/latest/solidity-by-example.html. I managed to deploy the voting contract to the blockchain. ...
5
votes
2answers
3k views

bytes32 to uint conversion is incorrect

I instantiate the following contract with _number as 10. When I check the value of number, I get 72370055773322622139731865630429942408293740416025352524660990004945706024960. Is this a problem with ...