Ich möchte ein neues Konto über IPC erstellen, also habe ich mit dem folgenden Befehl eine private Kette gestartet
geth --networkid=5 --datadir DataDir --ipcapi "db,eth,net,web3,personal" --ipcpath "/Users/smartSense/.ethereum/geth.ipc"
--rpc -rpcapi "eth,web3" --rpcaddr=localhost --rpcport=8545 --rpccorsdomain "*" console 2>geth.log
Jetzt versuche ich, ein neues Konto mit web3 api Ref zu erstellen. Verbindung: Verbindung
var options = {
host: '/Users/smartSense/.ethereum/geth.ipc',
ipc:true,
personal: true,
admin: false,
debug: false
};
var web3Extended = web3_extended.create(options);
web3Extended.personal.newAccount("password",function(error,result){
if (!error)
res.send(result);
else
res.send("error"+error);
});
aber ich habe folgenden Fehler:
errorError: Invalid JSON RPC response: "Error: connect ECONNREFUSED 127.0.0.1:80\n at Object.exports._errnoException (util.js:1022:11)
\n at exports._exceptionWithHostPort (util.js:1045:20)\n at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1090:14)"
über RPC habe ich erfolgreich erstellt, aber über IPC habe ich einen Fehler bekommen, also hat jemand eine Idee dazu?
Erfordern web3_ipc
statt web3_extended
.
const web3_extended = require('web3_ipc');
Stellen Sie außerdem sicher, dass Ihr geth.ipc-Speicherort richtig ist. Meine (Mac OS X) war auf ~/Library/Ethereum/geth.ipc.
Aniket
var web3 = new Web3(new Web3.providers.IpcProvider('/Users/myuser/Library/Ethereum/geth.ipc', net));