Fast summary: Need a faucet-like funcionality in my private blockchain to give Ether to the newly on-demand created wallets from Android Dapp.
I'm working in a project where I've deployed a totally private and customized blockchain, with a bunch of smart contracts to interact with and an Android Dapp to manage the communciation with both (SC and BC).
The problem comes with: When I firstly sign-up in my Dapp, a wallet account in the blockchain is created (with
loadCredentials), but to start interacting with the Smart Contracts I need (fake) Ether, so I'm looking for a solution where either kind of private faucet or any way to get Ether from the brand new created wallet is implemented. I tried without success the next approaches:
Set the mining
coinbaseto the Smart Contract with the goal of having a big supply of Ether in the contract, and a function into it called
giveMeEther()where 10 Eth is transferred to
msg.sender. I configured
--miner.gasPrice '0'to be able to call this function from Android without Ether but is not working:
java.lang.RuntimeException: Intrinsic gas too low(although from geth console I managed to send transactions with gasPrice 0 from main account) Problem: I still need a first amount of Ether to call this function or manage to send gasPrice 0 transactions from Android with the new wallet.
Create a master account (or a bunch of them) in the genesis block with (almost) infinite Ether and keep mining to get unlimitted Ether in this account(s), and from the Dapp, after log into one of this accounts (because I know its credentials), call
Transfer.sendFunds()with 10 Eth to the newly created wallet. Problem: I need to log-in in the code, with the plain-text password to a master account, and that's a big security bug (even though I obfuscated the code, it's still not a good practice). This solution works fine because a new wallet is created with 10 Ether succesfully, but now the problem is about security and about to give the credentials to this master accounts to anybody, that could log in and give all the amount of Ether available in those accounts to itself and get all the project crashed.
The solution of create X accounts initially in the genesis block with predefined Ether does not fit here because I'll need on demand accounts with ether and I'm not knowing how many accounts there will be.
I also thought in the solution of trying a testnet like Ropsten/Rinkeby instead my own private blockchain and call faucet, but I will lose the advantages of configuring from scratch my own blockchain, and if I'm not wrong, I'll have to pay to finally deploy my Smart Contracts to the main testnet.
So the ideal solution would be to implement an exact same funcionality as faucet but for my own blockchain.
I'll be so grateful with any help. Thanks.