Hot answers tagged

16

Either use the geth console attached to parity or use the Parity UI application Parity/Web3 Console. To attach Geth console to Parity, (on Linux) use: geth attach ~/.local/share/io.parity.ethereum/jsonrpc.ipc On MacOS use: geth attach ~/Library/Application Support/io.parity.ethereum/jsonrpc.ipc To access the Parity/Web3 Console, open the UI, go to ...


14

You are most likely looking for Events. Not only do they help with debugging, but they are useful in normal production code. Events are declared like functions, like so: event voteCast(address voter, uint votes, bool inFavor); Then somewhere (for example, in a vote counting function): function vote(bool inFavor) { var votes = shares[msg.sender]; /...


11

You can write a JavaScript script that controls geth's behavior related to mining. There is a simple script that mines only nonempty blocks on go-ethereum wiki. Another one is mine.js script from Embark Framework. This one is feature-rich and configurable for periodic mining, mining reward cap, number of mining threads and more (via glider). Scripts are ...


10

You can use web3.toAscii(hexString) as documented in Web3 JavaScript Ðapp API: > web3.toAscii("0x4d61726b65745061792e696f206973206465706c6f79696e6720536d61727420") "MarketPay.io is deploying Smart " You can also use web3.toUtf8(hexString): > web3.toUtf8("0x4d61726b65745061792e696f206973206465706c6f79696e6720536d61727420") "MarketPay.io is deploying ...


10

You need to run parity with the appropriate API enabled. The API is the personal API. For example: parity --chain ropsten --warp --rpcapi "eth,net,web3,personal,parity"


8

Print doesn't exist in Solidity. Use the logX statement as indicated in the manual instead.


8

Each geth exec start one interpreter. So if you define a function into the first, it is not available on the second... Please merge them into one exec: To sum up: geth --exec 'loadScript("/path/to/file/filename.js"); jsFunction(...)' attach This also worked: geth --exec "loadscript(\"/path/to/file/filename.js\");jsFunction(<params>)" attach ipc:/...


7

It is safer to use the Go Ethereum - Management APIs - personal_sendTransaction API to unlock your account AND send your transaction at the same time: personal_sendTransaction Validate the given passphrase and submit transaction. The transaction is the same argument as for eth_sendTransaction and contains the from address. If the passphrase can ...


6

You should test the Embark framework testnet. It's a specially configured blockchain that will , unlike the normal testnet , only mine when you need to mine.So if you send a transaction it will start by minning what needed for said transaction then proceed with the transaction. That's one solution: https://github.com/iurimatias/embark-framework embark ...


6

start geth console $ geth --fast console in console : var gnosisAuctionABI = [{"inputs":[{"type":"address","name":""}],"constant":true,"name":"bids","payable":false,"outputs":[{"type":"uint256","name":""}],"type":"function"},{"inputs":[{"type":"address","name":"receiver"}],"constant":false,"name":"bid","payable":true,"outputs":[{"type":"uint256","name":"...


6

Since web3.eth.getAccounts() returns a list of addresses you can access the first accounts's address easily just by e[0] in your example. So just try this: web3.eth.getAccounts().then(e => let firstAcc=e[0]; console.log(firstAcc)); Have a look at the official documentation of the getAccounts() web3js function here.


5

In March 2016, Gav Wood wrote: we don't yet have a javascript interface, however it should be possible to use eth console or geth console to connect to a running parity client i haven't tried that yet, though...


5

running parity --geth allows to use eth attach or geth attach to spawn a console.


5

Try geth --light console, available since v1.5.2, but listed under "Experimental Features". Syncs in minutes if not seconds. Update - The initial sync took 11 minutes. Subsequently, syncing 7 hours worth of blocks took 8 seconds. I'll document some light client stats below. Here are some stats (the current block is 2972534: Iota:geth user$ geth --light ...


5

> JSON.stringify(myContractCompiled.Array.info.abiDefinition) "[{\"constant\":true,\"inputs\":[],\"name\":\"test_callstack\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"ownerOnly\",\"outputs\":[],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\"...


5

Following on from your comments above that you are looking for a script that takes optional parameters, here is an example script with command line parameters that you can customise: #!/bin/bash # ------------------------------------------------------------------------------ # Check account balance # # Works on Linux and OS/X. May work on Windows with ...


5

According to geth --help, the --dev option puts you in "Developer mode: pre-configured private network with several debugging flags". You are running a private network of your own. FWIW I spent a few days trying to figure out from the docs how to get started and summarised my own newbie findings here - may help https://alanbuxton.wordpress.com/2017/07/19/...


4

You won't be able to access your account without the private key which is not the same as the password. Your private key is stored in the keystore directory within the Ethereum data directory (per default ~/.ethereum on Linux). It should look something like this: UTC--2015-09-21T16-54-52.729410400Z--05936944f0d93499f636a0dfa5e71399a0cc3fca i.e., a UTC ...


4

You need to open a console, like that: eth --frontier console The -b -i flags don't exist anymore. The docs really need to be updated. Edit: And please update your client to version 1.2.0 or later as soon as possible.


4

I created the development wrapper gethdev to help with this exact issue (automatically creating a private testnet, and starting/stopping the miner automatically when needed). To get started simply: npm install -g gethdev gethdev This will create a testnet, create your first account, and start geth running with the gethdev.js script (which handles starting ...


4

There's a history file in Geth's datadir that you can delete. The default datadir is: Mac: ~/Library/Ethereum Linux: ~/.ethereum Windows: %APPDATA%/Ethereum


4

Not yet possible as this issue here suggests. ethconsole depends on IPC, which will be available as of Civility (1.1).


4

What I'm doing now is using TestRPC as the Web3 provider to Browser Solidity as a Chrome extension. You can then develop and run DAPP front-ends and use the Chrome console to interact with web3.


4

You are doing it wrong way around. What you want to do is to have geth running as a daemon and then your JavaScript connects to Geth over web3.js / JSON-RPC protocol. (It's the same web3 object exposed that is available on geth prompt). You can run JavaScript scripts using node command. Below is one example. You can find examples in this tutorial blog post:...


4

web3.toBigNumber("20000000000000000000").minus(web3.toBigNumber("19999999999999999989"))


4

A Node.js CLI Console can be used per the Parity wiki: You can install node/NPM and use its console. Once you have node/NPM installed, you'll just need to install the latest web3 module: $ npm install web3 From then on you just need to run node and require the web3 module: $ node > Web3 = require("web3") > web3 = new Web3(new Web3.providers....


4

To open the Parity console, use geth. geth attach http://localhost:8545


4

The Method not found message is ambiguous / misleading. It basically says, something is wrong. Often the most obvious reasons are: Mistyped command (happens, unlikely if you use tab-completion). Unavailable APIs (i.e., you haven't enabled the personal JSONRPC API). The called method fails for some reason (i.e., there is no account available for unlocking).


4

Does anyone how, in the truffle console, I can interact with contracts deployed through other contracts? To see the list of contracts already deployed on the Truffle Develop network, this command works: truffle(develop)> networks [--clean] Network: develop (id: 4447) Migrations: 0xfb88de099e13c3ed21f80a7a1e49f8caecf10df6 MyNewContract: ...


3

You can try the name registrar contract that is used to associate your contract's address with a name. In case of a private testnet, you will need to deploy the registrar code on your network. In order to do that, you will first have to compile the code from their git repo, and deploy them on your network just as you would do for any other contract. For ...


Only top voted, non community-wiki answers of a minimum length are eligible