I have an ETH testnet set up using this docker-compose.yml file.
When I try to send 1 wei from the "buffer" account 0x411167FeFecAD12Da17F9063143706C39528aa28 to the test account 0x6d179e1d7715b6b2eedf82b16b90db3fd4cd64a3 using the following commands, I get the error ùnknown account`:
Buffer account
The buffer account is the account in which all mined ETH ends up. It is specified in the genesis.json file:
The buffer account exists on the testnet and when I run
curl -X POST http://localhost:8178 \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0", "method":"eth_getBalance", "params":["0x411167FeFecAD12Da17F9063143706C39528aa28","latest"], "id":1}'
I get the expected result: The buffer account has 0x200000000000000000000000000000000000000000000000000000000000000 ETH:
{"jsonrpc":"2.0","id":1,"result":"0x200000000000000000000000000000000000000000000000000000000000000"}
Test account
I created the test account myself using
geth account new --password address1pw.txt
It appears in the output of
geth account list
Question
What do I need to do in order to transfer 1 wei from the buffer account to the test account?
Update 1
Changing the request to
> eth.sendTransaction({from: '0c56352F05De44C9b5BA8bcF9BDEc7e654993339', to: '0x6D179e1d7715b6b2eeDF82b16B90db3fd4cd64A3', value: 1});
results in
Error: gas required exceeds allowance (8000000) or always failing transaction
at web3.js:6347:37(47)
at web3.js:5081:62(37)
at <eval>:1:20(10)
0c56352F05De44C9b5BA8bcF9BDEc7e654993339 is ETH_ADDRESS specified in the docker-compose.yml file.
Update 2
Changing the request to
eth.sendTransaction({from: '0c56352F05De44C9b5BA8bcF9BDEc7e654993339', to: '0x6D179e1d7715b6b2eeDF82b16B90db3fd4cd64A3', gas:8000000 , value: 1});
results in
Error: insufficient funds for gas * price + value
at web3.js:6347:37(47)
at web3.js:5081:62(37)
at <eval>:1:20(12)
Update 3
In the genesis.json file the account from which I try to send ETH appears in the alloc section:
"alloc": {
"411167FeFecAD12Da17F9063143706C39528aa28": {
"balance": "0x200000000000000000000000000000000000000000000000000000000000000"
}
},
Update 4:
Here is how the ETH is being initialized: The file entrypoint.sh is run where I find this:
echo $ETH_PASSWORD > /tmp/eth_pass
echo $ETH_PRIVATE_KEY > /tmp/eth_private_key
geth --datadir /data init ./.genesis.json
geth --datadir /data account import --password /tmp/eth_pass /tmp/eth_private_key || true
ETH_PASSWORD and ETH_PRIVATE_KEY come from the vriables in docker-compose.yml file:
geth:
image: ulamlabs/geth-poa-testnet:latest
environment:
- ETH_PASSWORD=QfdxTYxkwASj
- ETH_PRIVATE_KEY=0d0b4c455973c883bb0fa584f0078178aa90c571a8f1d40f28d2339f4e757dde
- ETH_ADDRESS=0c56352F05De44C9b5BA8bcF9BDEc7e654993339
ports:
- 8178:8178
- 8546:8546
volumes:
- ./genesis.json:/app/genesis.json
It seems that the buffer account (411167FeFecAD12Da17F9063143706C39528aa28) is not created when the container is created.
Update 5:
I ran following commands in the geth shell:
echo carsdrivefasterbecausetheyhavebrakes > buffer-pw.txt
echo 766df34218d5a715018d54789d6383798a1885088d525670802ed8cf152db5b4 > buffer-private-key.txt
geth account import --datadir /data --password buffer-pw.txt buffer-private-key.txt
echo a-turkey-is-a-chicken-designed-by-a-committee > exchange-pw.txt
echo b07aedf303f832664eb7a5295be737776cb1ad17a277ec287b3b3c7bac154e5e > exchange-private-key.txt
geth account import --datadir /data --password exchange-pw.txt exchange-private-key.txt
When I check the balance of the buffer account using
geth attach http://localhost:8178
eth.getBalance("0x411167FeFecAD12Da17F9063143706C39528aa28");
I get this output:
9.04625697166532776746648320380374280103671755200316906558262375061821325312e+74
Then I tried to send 1 wei from the buffer account to the exchange account again:
eth.sendTransaction({from: '0x411167FeFecAD12Da17F9063143706C39528aa28', to: '0x190FD61ED8fE0067f0f09EA992C1BF96209bab66', value: 1});
I get the error
Error: authentication needed: password or unlock
at web3.js:6347:37(47)
at web3.js:5081:62(37)
at <eval>:1:20(10)
I tried to unlock the account using the following commands, without success:
eth.unlockAccount('0x411167FeFecAD12Da17F9063143706C39528aa28', 'carsdrivefasterbecausetheyhavebrakes', 600).then(console.log('Account unlocked!'));web3.personal.unlockAccount('0x411167FeFecAD12Da17F9063143706C39528aa28', 'carsdrivefasterbecausetheyhavebrakes', 600).then(console.log('Account unlocked!'));
Update 6:
Modified the entrypoint.sh of the Docker image with geth so that test accounts are included and the personal API is enabled.
Then, modified docker-compose.yml file to use that changed geth image.
Now unlocking the buffer account and sending money from it seems to work.




0x6D179e1d7715b6b2eeDF82b16B90db3fd4cd64A3. One solutions is to import the key in geth for example using https://ethereum.stackexchange.com/questions/465/how-to-import-a-plain-private-key-into-geth-or-mist, or to use another wallet like metamask and connect to geth http endpoint. – Ismael Oct 05 '21 at 07:22genesis.jsonthe account411167FeFecAD12Da17F9063143706C39528aa28is given a lot of test ETH. I want to be able to send ETH from this account. I (wrongly) assumed that if this account appears ingenesis.jsonfile it will be automatically created. It isn't. What do I need to do in order to send test ETH from411167FeFecAD12Da17F9063143706C39528aa28? – Oct 05 '21 at 07:31411167FeFecAD12Da17F9063143706C39528aa28usinggeth account new? – Oct 05 '21 at 07:46geth account newwill create a new account. – Ismael Oct 05 '21 at 14:31--allow-insecure-unlock, see more options here https://geth.ethereum.org/docs/interface/command-line-options. – Ismael Oct 06 '21 at 02:53