There is nothing like parity console
.
How to open the JavaScript console on Parity?
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityEither 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 Applications and open the Parity/Web3 Console:
~/.local/share/io.parity.ethereum
does not seem to exist on my case. I guess because I tried it on mac. Also Inside geth
it says 'api' is not defined.
@5chdn
~/Library/Application Support/io.parity.ethereum/
folder, jsonrpc.ipc
does not show up. Could it be/Users/avatar/Library/Application Support/io.parity.ethereum/ipc/parity-chain.ipc
? @5chdn.
[~]$ sudo geth attach /Users/alper/Library/Application\ Support/io.parity.ethereum/ipc/parity-chain.ipc
gives an error as = Fatal: Unable to attach to remote geth: dial unix /Users/alper/Library/Application Support/io.parity.ethereum/ipc/parity-chain.ipc: connect: connection refused
@5chdn
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.HttpProvider("http://localhost:8545"));
After this point, you'll be able to use the web3 API from with this environment, e.g.:
> web3.eth.blockNumber
743397
api.parity.addReservedPeer('enode://0000..0007@<IP>:<Port#>')
under node? Since I was not able to run it, parity could not connect to my private network and web.eth.blockNumber
returns 0. @eth
api.parity
isn't part of web3
. Maybe ask a separate question and someone can answer.
In addition to @eth's response; if you like to have Parity's api calls; just install parity's api package instead of web3.
$ npm install @parity/api
$ node
On node console :
>// import the actual Api class
>const Api = require("@parity/api");
>// do the setup
>const provider = new Api.Provider.Http('http://localhost:8545');
>const api = new Api(provider);
// use api.parity.addReservedPeer
api.parity.addReservedPeer("enode://d64d5f74b1715c525dc88e87a52eca1574c09593ed29401d205ecfef9fbfe52fa308f966bab3a5966da1bb74212fecdb328cddceb572c38b536c597166784347@203080240034.static.ctinets.com:35423").then((data)=> {console.log(data)})