Questions tagged [javascript]

JavaScript is a dynamic, weakly-typed language used for client-side as well as server-side scripting.

Filter by
Sorted by
Tagged with
2
votes
1answer
256 views

In javascript, what does the line var meta = MetaCoin.deployed(); mean and what does it return?

I am following the official Truffle docs to create a Dapp and am reviewing the code. I am repeatedly seeing the line var meta = MetaCoin.deployed(); What is the deployed function? What does it ...
3
votes
2answers
187 views

Recursive struct triggers Uncaught JavaScript exception in browser-solidity

I am trying to implement a recursive data structure. The following code does not compile in browser-solidity: pragma solidity ^0.4.4; contract TestContract { struct Item { uint someUint; ...
6
votes
2answers
1k views

Can I pass arguments to a .js script on Geth?

I'm starting to get a handle of Geth, especially the scripts, following this and this. I have scripts that create contracts and call functions, but I don't know how to pass arguments to a script. ...
2
votes
1answer
729 views

How do I find a list of the Golem Network Token (GNT) TokenTrader contracts?

The Golem Network Token (GNT) TokenTrader contracts enables the trustless and decentralised sale of GNTs for ethers (ETH). A seller deploys one of these TokenTrader contracts using the ...
3
votes
1answer
2k views

string and Error: new BigNumber() not a number

I am trying to generate a hash of a file and send it to a contract. But I am getting an error Error: new BigNumber() not a number: a8fac6cf98e6f5e9a76ae1f8064e505b(…) Here's my contract code: ...
5
votes
1answer
108 views

Getting event history takes a really long time or doesn't work at all

I'm having trouble getting a history of events. I'm unsure if I am misunderstanding how events work, if I'm coding wrong, or if it has anything to do with the recent Ethereum attacks slowing down the ...
1
vote
2answers
3k views

How to check Balance of a specific account (MetaCoin)

I'm fairly new to programing and solidity, still on the learning curve of things here.... So right now I'm trying to check for the balance in Wei of the account I submit into the text field (Account). ...
4
votes
1answer
700 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?
3
votes
1answer
417 views

Making a contract in the geth console

I have the following code in a script name contract.js ( foo, pwd and id are replaced by their value in my actual script) var web3=require('web3'); personal.unlockAccount('id', "pwd") var aContract = ...
5
votes
1answer
810 views

How to generate an Ethereum “brain wallet” in Javascript?

Namely, enter string -> get private key?
2
votes
1answer
441 views

Ether.Camp web3 js interact with contract - what am I doing wrong?

I have a working contract that I made in ether.camp with solidity, it functions as desired through the IDE contract interface and now I am trying to tie it into an html GUI with web3. To this end I ...
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 ...
1
vote
0answers
51 views

How do you generate a EOA address with javascript? [duplicate]

With web3 you can use web3.personal.newAccount to generate a new EOA. MyEtherWallet seems not to rely on its Geth node to generate such addresses. How would you generate EOA purely client side?
3
votes
2answers
1k views

how to solve solidity asynchronous Problem

How to deal with asynchronous operation because of the delay blockchain ? How does the blockchain perform under high concurrency? how to deal with the mutually exclusive variable?
1
vote
0answers
266 views

geth js commands to handle my Wallet contract

I have created a Wallet contract using the Mist. Now I am trying to handle it using geth console javascript commands. By handling I mean sending ether to an account. Can someone help me with the js ...
4
votes
1answer
4k views

How to use miner.start(2) from javascript

Refering to "Common useful JavaScript snippets for geth" Got Following example to run miner from javascript: Mine only when there are transactions! var mining_threads = 1 function ...
7
votes
1answer
1k views

Event result parameters and arguments in console

I read about using events from this source http://solidity.readthedocs.io/en/latest/contracts.html#events I used a simple multiply contract: contract test1{ uint a; event event_res(string msg,...
2
votes
2answers
216 views

What can I use to allow users to send transactions through a website?

I am trying to build a website that will allow multiple users to send Ethereum transactions without having to install a node. My server is running a node, which is configured to accept requests from ...
1
vote
0answers
100 views

Multithreading in web3.js [duplicate]

Is it possible to run concurrent tasks using web3.js and an Ethereum client? For example, say we have the following code to iterate through a number of blocks: var startBlockNumber = 0; var ...
5
votes
1answer
881 views

Transaction w/ invalid nonce

Web3.js throws an error "Transaction w/ invalid nonce." when I try to call contract methods from JavaScript console. The same methods from the same contracts work fine from Mist, or, what is strange ...
6
votes
2answers
2k views

Execute contract function with raw transaction

I am trying to build a light interface which can broadcast a raw transaction and execute an Ethereum contract's function. While I am able to build a simple transaction there is little guidance on how ...
4
votes
2answers
734 views

How to compute SHA-3 of an array of numbers in Javascript?

The documentation says that sha3 calculates the hash of the tightly packed arguments. Numbers seem to be converted to ASCII chars. Consider using sha3(values) in Solidity with the type int8[3] values,...
7
votes
1answer
4k 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
350 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 ...
4
votes
1answer
917 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); } ...
5
votes
1answer
2k views

Listing transactions in a private blockchain?

In a private blockchain, is it possible to list the transactions based on from and to parameters in a transaction. Is it possible to check the latest transaction from or to an address? Also, is it ...
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 ...
2
votes
2answers
817 views

Can I write API endpoints with Truffle?

Does anybody knows how to write an API inside a Truffle application?
4
votes
1answer
399 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 ...
3
votes
1answer
463 views

Solidity bytes32 to JS string?

There been a couple of questions on bytes32 to string in solidity itself. What's the best way to convert a solidity bytes32 return value to a string in JS?
8
votes
2answers
7k views

How do you get the balance of an account using truffle/ether-pudding?

Is there an ether-pudding way to get the balance of a contract/account, or should I just use web3.eth.getBalance(account)?
2
votes
1answer
2k views

How do you send ether using truffle/ether-pudding?

How do you do a sendTransaction to simply send ether from one account to another in ether-pudding? In web3 I would do this: web3.eth.sendTransaction({ from: a, to: b, value: 100 }) I would like the ...
3
votes
2answers
1k views

How do I pull a private key out of a keystore using eth-lightwallet “No seed set”

I am using eth-lightwallet on a NodeJS server. I am getting a stack trace when I try and get the private key from the keystore. It is flagging this line "keystore.generateNewAddress(pwDerivedKey);" I ...
2
votes
1answer
1k views

Integrating web3 and Django

I'm trying to integrate web3 into a website which uses Django. This snippet of code is not working <script type="text/javascript"> document.getElementById("Mining").innerText = "Test"; ...
4
votes
1answer
159 views

How to run test sample contract in the standard web browser?

I've got the Sample contract within Mix IDE which seems fine within embedded web browser. However when go to the same URL appearing in Mix embedded page using Chrome web-browser (e.g. http://...
4
votes
2answers
3k views

How do I print my account balances and TheDAO tokens from geth

Is there a convenient script to print out my account balances and TheDAO tokens from the go-ethereum client geth?
2
votes
1answer
609 views

Are there any alternatives for Meteor JS to build DApps?

Do you have to use Meteor for building Dapps? Are there any alternatives for Meteor JS to build DApps? Is it maybe even possible to build distributed applications for Ethereum without utilizing ...
4
votes
3answers
938 views

Iterating through an array in JS and simple promises (web3/pudding)

This might be more to do with my lack of understanding some JS basics however it's in ethereum/web3 context so here it goes. I have a public array posts in my contract and a global variable in JS of ...
0
votes
1answer
321 views

Uncaught Reference Javascript Error when submitting data via html to contract

I created a contract (Freight) using the "ratings" tutorial template. The Freight contract is meant to store values entered in the html page (input.html) and submitted. Just like the "ratings" ...
5
votes
2answers
654 views

Make data from smartcontracts / events only visible for certain address/users

I Have an use case where i need : 1- My data not to be visible to the public. 2- To be able to revoke my clients/users rights to view said data from my smart contract. As anyone done that before ? ...
3
votes
2answers
226 views

Where to find the private key for my contract in blockapps?

I am trying to use blockapps-js to invoke functions on my smart contract deployed in blockapps. Since I need the private key for it, I am looking at the app/users/admin/.json file. Problem is I cannot ...
9
votes
1answer
247 views

Why is web3 being proposed as a global variable in Mist? What's the reasoning?

I have heard that web3 is supposed to have global scope, something similar to document or window. What is the reasoning behind this architectural choice? Is this still an underlying assumption? In ...
25
votes
3answers
9k views

How does Solidity's sha3 / keccak256 hash uints?

This is not a question about the issue with Ethereum using a non-standard sha3. I have found the right JS hashing library, and am able to get matching hashes in JS and Solidity on byte strings. What I ...
8
votes
1answer
3k views

How to connect NodeJS to the Ethereum network?

I have Mist wallet running on Windows 8. I want to connect my NodeJS applcation to the Ethereum network. I have no idea where to start. Could you point me to the direction I should be looking at? Are ...
82
votes
11answers
31k views

Common useful JavaScript snippets for geth

In geth you can loadscript any .js file. I discovered this one on the wiki which I like a lot: function checkAllBalances() { var i =0; eth.accounts.forEach( function(e){ console.log(" eth....
7
votes
1answer
144 views

How to connect AugurProject's ethrpc to a local testnet

I have GETH running a test network, and now I'd like to get AugurProject's ETHRPC to connect. I can't find any documentation on ETHRPC.
2
votes
0answers
73 views

How do you generate an address identicon using javascript? [duplicate]

Given an address, how do you generate its identicon using javascript?
2
votes
1answer
509 views

Embark + IPFS storage error: Cannot find module 'fs'

I am using the Embark framework demo code and trying to include IPFS storage (not deployment) functionalities to the project. I get an error message when I try to execute the following code in the ...
11
votes
1answer
3k views

Can I unlock an account using JSON-RPC?

The only way I can work with ETH is through --rpc mode. Normally I would prefer to use the Python interface. But I found myself in a situation where the RPC is very limited. For example, I can't ...
35
votes
2answers
19k views

How does Lisk differ from Ethereum?

Lisk is going to be a full stack DApp development framework for building and distributing decentralized applications. It's currently in the crowdfunding stage but got also added to Microsofts ...

1 9 10 11 12 13