SilentCicero / ethereumjs-accounts

A simple module for creating, managing and using Ethereum accounts in browser.
MIT License
150 stars 58 forks source link

"account is locked" error #11

Open JMLX42 opened 8 years ago

JMLX42 commented 8 years ago

Hello,

I'm trying to interact with an ethereum node on a private chain/network through RPC. I do not understand the purpose of this library: I can create accounts, but AFAIK they cannot be used since they need to be "unlocked".

If I do this;

var greeterInstance = greeterContract.new(
    _greeting,
    {
        from : accountObject.address,
        data : greeter.contracts.greeter.bin,
        gas : 300000
    },
    (error, contract) => { // ...

I get the following error:

Account does not exist or account balance too low

I have the exact same error when I use the provided manager.html example.

So I tried sending some ether from my coinbase first :

web3.eth.sendTransaction(
    {from:web3.eth.coinbase, to:accountObject.address, value:web3.toWei(0.05, "ether")},
    (error, result) => {
        console.log(error, result);
    }
);

But error is always 0 and result is always the 0 hash so I'm guessing the transaction failed.

If I do the same operation with the provided manager.html example, I get the following message:

The transaction went through succesfully, hash: 0x0000000000000000000000000000000000000000000000000000000000000000

When the server is running geth, I don't get any specific message. Not even about the transaction. When the server is running 'testrpc`, I get an "invalid address" error in the client javascript console and on the server:

127.0.0.1 - - [28/Jan/2016 23:06:27] "POST / HTTP/1.1" 200 -
eth_getTransactionReceipt

What am I doing wrong?

Some docs about how to make 1st transaction to an account created with ethereumjs-account would be nice.

Thank you for your help.

Regards,

JMLX42 commented 8 years ago

Actually mining of that private chain solves the sendTransaction problem and I get a valid hash as a result.

But it is still not working: when I try to call one of the methods of the contract, I get an Error: account is locked error.

this.ballotInstance.vote.sendTransaction(proposal, {from: accountObject.address}, (err, result) => {
            console.log(err, result);

            this.ballotInstance.winningProposal.call((err, result) => {
                console.log('wining:', err, result);
            });
        });