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
4 votes
2 answers
1k 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 ...
gorgi93's user avatar
  • 141
3 votes
2 answers
312 views

How to invoke a contract function in the future (under 10 blocks)

This is not a duplicate question, as the alarm contract only allows function calls to be made in the future, over a period of at least 10+ blocks... The current thinking is to just use the alarm ...
Jay Bee's user avatar
  • 131
18 votes
6 answers
23k views

How can I get the data of the latest 10 blocks via web3.js?

How can I get latest 10 block data by using web3.js like most block explorer does?
Satoshi Nakanishi's user avatar
3 votes
1 answer
541 views

Node.js, Geth & Events

I've been tracking a case where my Node.Js server just stop receiving events, basically for each contract, when I do a contact.allEvents({ fromBlock: startblock }, (error, data) => { ... }); It ...
Xavier Yvez's user avatar
7 votes
3 answers
5k views

Is there any API for sending and receiving Ethers?

Is there any API for send and receive Ethers? If not, i am trying to use web3.js in my own server; What are the technical implications? Major security concerns? Can I use the same API for creating ...
niksmac's user avatar
  • 9,663
6 votes
1 answer
1k views

Can you input decimals number in smart contract?

I'm having an issue where send 0.1 or 1.1 is saved as 0 and 1 in my contract's storage. Does anyone knows how to properly pass decimals ?
jayD's user avatar
  • 2,462
2 votes
1 answer
221 views

Option to give passphrase via web interface

I am trying to run the sample web3.js code from here https://github.com/ethereum/web3.js/blob/master/example/event_inc.html I am running the geth node on testnet. However, when I try to create the ...
pd176's user avatar
  • 439
47 votes
6 answers
42k views

How do I parse the transaction receipt log with web3.js?

The event parser in web3 provides a nice parsing functionality for events, and I use it for logging all events to a file, but it's very difficult to use for looking at individual events for a ...
Paul S's user avatar
  • 4,271
7 votes
3 answers
1k views

What is the difference between "eth.accounts" and "web3.eth.accounts"?

The instructions for creating a new account on the Geth console state: Tip: If you are using Geth then you can just use eth instead of web3.eth command. Meaning accounts can be referenced by ...
Richard Horrocks's user avatar
22 votes
2 answers
5k views

What are effective techniques to encrypt/decrypt data stored in a smart contract?

Rather than sending and storing plain text in a smart contract, the use case objective is to encrypt first and then subsequently access the data and decrypt at the point of use. What is the most ...
Alan Wunsche's user avatar
  • 1,655
7 votes
1 answer
2k views

What is the best way to send multiple transactions without running out of gas for seeding?

I'm having an issue where sending a single transaction work but sending multiple doesn't. I'm attempting to Seed my contract with data using using web3.js and it works fine. mycontractinstance....
jayD's user avatar
  • 2,462
9 votes
1 answer
4k views

How do I access member variables of a contract from web3.eth?

For example: enum Stages { AcceptingBookings, StopAcceptingBookings, Finished } Stages public stage = Stages.AcceptingBookings; function rand ( uint256 param) atStage(Stages....
user2890278's user avatar
6 votes
3 answers
4k views

web3 methods not implemented

I'm running a geth node on the testnet and trying to run web3.js method from my node server code. Here's my code var Web3 = require("web3"); var web3 = new Web3(new Web3.providers.HttpProvider('http:...
pd176's user avatar
  • 439
4 votes
2 answers
2k views

Unlocking accounts for a back office app

I'm writing a "back office" app and need a way to unlock an account in an automated fashion. Yes, I know security of nodejs is questionable, but there are ways of solving this. blocking web3 from ...
Paul S's user avatar
  • 4,271
5 votes
1 answer
2k views

Making web3.js work from node server code

I'm running a geth node on the testnet and trying to run web3.js method from my node server code. var coinbase = web3.eth.coinbase; console.log(coinbase); However, I'm getting a provider not set or ...
pd176's user avatar
  • 439
3 votes
2 answers
807 views

How can I program my DApp to tell my user that their action/transaction has been confirmed?

Take an example of a voting DApp. A user clicks on a vote button, then behind the scenes the transaction containing the vote gets mined on the blockchain. The DApp then wants to alert('You have ...
eth's user avatar
  • 85k
38 votes
6 answers
8k views

How can a DApp detect a fork or chain reorganization using web3.js or additional libraries?

Take an example of a voting DApp. A user clicks on a vote button, then behind the scenes a transaction gets mined on the blockchain, and finally the DApp tells the user their vote has been recorded. ...
eth's user avatar
  • 85k
15 votes
5 answers
5k views

How do I know when I've run out of gas programmatically?

This keeps coming up on the gitter forums so I thought I'd ask and answer this question: How do you know when you've run out of gas?
Paul S's user avatar
  • 4,271
7 votes
1 answer
2k views

How can Hooked-Web3-Provider and Lightwallet work together?

Does anyone know some good working examples of the Eth-Lightwallet and the Hooked-Web3-Provider working together? I was trying to get https://github.com/ConsenSys/eth-lightwallet/blob/master/example/...
Alan Wunsche's user avatar
  • 1,655
14 votes
1 answer
2k views

Given a contract address, can I determine when the contract was deployed?

Ideally the solution would use web3, but other solutions are acceptable. Motivation: Event lookups can be passed fromBlock field. If I know the block a contract was created, I can more accurately do ...
Akhil F's user avatar
  • 1,898
19 votes
3 answers
5k views

Accessing past values of Smart Contract variables

I would like to know if is possible to inquiry variable values using older blocks. For example I have contract Simple { string32 message public; function Simple() { message = msg....
croll83's user avatar
  • 193
5 votes
1 answer
842 views

How to interact with the blinded auction contract from web3.js

My question is about the blind auction contract in the solidity examples. What is the right way to interact with the contract from web3.js? I tried this, but it does not give the right result. var ...
RexetBlell's user avatar
2 votes
1 answer
2k views

Uncaught Error: could not decode, json: cannot unmarshal array into Go value of type string(…)

I'm trying to use my already deployed contract using web3.js from my console but i'm having issues. I get my compiled contract from browser-solidity then do: var web3 = new Web3(new Web3.providers....
jayD's user avatar
  • 2,462
2 votes
2 answers
313 views

Is it possible to access Ethereum API via the browser?

How do you access the api's of ethereum via the browser? Say I wanted to make a one page app that updates every 1 minute with the block number. And where can I get a list of all the API variables?
Patoshi パトシ's user avatar
13 votes
2 answers
907 views

What is the way to make Ethereum available to users for free?

As the web is mostly free today (I mean the old web, the one < 3), most people won't agree in beeing asked for fuel to run sites, apps, even if the gain in terms of safety and trust are so much ...
Nicolas Massart's user avatar
21 votes
2 answers
3k views

What are best practices for serving a DApp over HTTPS, connecting to an Ethereum node using JSON RPC / web3.js, which by default uses HTTP?

Summary: we're serving an Ethereum DApp from a webserver through HTTPS. The DApp connects to an Ethereum node through JSON RPC using web3.js, which uses HTTP (not HTTPS). How to deal with this in a ...
AronVanAmmers's user avatar
2 votes
1 answer
785 views

How to use contracts deployed by embark on the server side of a meteor app?

I have created my example using embark meteor_demo and then changed my configuration on embark.yml to output the contract on the server folder instead of the client. From that point i started getting ...
kroe's user avatar
  • 216
4 votes
1 answer
538 views

Is it possible to check which RPC APIs are available?

Is it possible for a decentralized application to get details about the offered JSON-RPC APIs from the local ethereum node? I want to check the following specs in the following order using web3.js: ...
q9f's user avatar
  • 32.8k
21 votes
4 answers
13k views

Does Web3.js have the functionality to create new accounts and unlock an account for a period of time for a series of transactions?

I want to create new accounts through my Dapp web interface and unlock a specific account so that transactions can be processed. I didn't see it in the web3.js documentation so wonder if that's on the ...
Alan Wunsche's user avatar
  • 1,655
7 votes
2 answers
2k views

web3.sha3 dealing with hex in both geth and web3.js

in both geth and web3.js, when we call > web3.sha3("0x536f6d6520415343494920737472696e6720746f20626520686173686564") we get: requirement of using web3.fromAscii before sha3 is deprecated new ...
shiso's user avatar
  • 1,036
192 votes
2 answers
57k views

What is the difference between a transaction and a call?

What is the difference between a transaction and a call? In some interfaces, I can interact with contracts via calls or via transactions. What is the difference between the two, and can contracts also ...
mKoeppelmann's user avatar
  • 7,586
4 votes
1 answer
286 views

What is the web3 filter.watch() scope?

If I create a nested filter.watch filter_a.watch( filter_b.watch(); ); If I call filter_a.stopWatching(); does filter_b.watch() go out of scope for web3.js? Does geth keeps sending filter_b....
shiso's user avatar
  • 1,036
8 votes
2 answers
4k views

How to manipulate data in a Solidity smart contract?

I have a smart contract with some members which should get modified on certain events. For simplicity, let's imagine we have a greeter contract. If I call greeter.greet() in the JavaScript console, ...
q9f's user avatar
  • 32.8k
9 votes
2 answers
385 views

Why do I get serialization errors in calling events?

I have put some events in my contracts like this event TokenTransfer(address indexed sender,address indexed receiver,uint32 indexed num_tokens); event ExceptionEvent(uint16 indexed retcode,address ...
codestruggle's user avatar
2 votes
2 answers
3k views

Attaching an address for a contract to call another contract

I am writing code where I want to call other contracts within my current contract. Bank.sol contract Bank { address owner; mapping (address => uint) balances; function init() ...
codestruggle's user avatar
9 votes
2 answers
5k views

How to connect a web site to a geth node?

Before the DApp-browser Mist was available, this web3 library seems the way to go on building a bridge from contract to a frontend (web site). But, I cannot get the very basic examples to work. ...
q9f's user avatar
  • 32.8k
27 votes
2 answers
10k views

Why aren't Solidity sha3 hashes not matching what other sha3 libraries produce?

Solidity has a function named sha3 and I tested it with an empty string input. It is not matching what other sha3 libraries produce. I see contracts written by others using the same sha3 function ...
eth's user avatar
  • 85k
6 votes
6 answers
14k views

Are there any blockchain/transaction APIs for the Ethereum network?

In the Bitcoin world there are a number of APIs such as: blockchain.info blockr.io blockcypher.com etc. which allow a web application to access block and transaction data from the blockchain, as ...
Jeff Coleman's user avatar
9 votes
1 answer
11k views

What is the 0x I see around Ethereum? For example I see addresses that start with 0x

I see a number of things in Ethereum start with 0x, for example addresses. Other examples are in the Geth console, JSON-RPC, web3.js. What is the 0x and what is its purpose?
eth's user avatar
  • 85k
43 votes
3 answers
21k views

What are the limitations to estimateGas and when would its estimate be considerably wrong?

web3.eth.estimateGas and JSON-RPC estimateGas can be used to see how much gas should be specified for a transaction, before crafting the transaction. Since it is an estimate, are there any ...
eth's user avatar
  • 85k
10 votes
3 answers
1k views

Is there a tool that creates a basic HTML interface from an ABI?

I am looking for a tool that builds a basic interface for a contract so that I can use this generated HTML as a starting point to build the front end. I am aware that Mist, https://chriseth.github.io/...
mKoeppelmann's user avatar
  • 7,586

1
118 119 120 121
122