0

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 WalletUtils and 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 coinbase to 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.

4
  • I am not sure about this, but could you just set the gas price to 0? Then a transaction would cost nothing. Since its a private chain, i guess you control the mining process and can accept such transactions – jjj Apr 30 at 15:58
  • I've already done it. I set miner.gasprice 0 and txpool.pricelimit 0 deploying with geth the blockchain but I'm still receiveng the error eth_sendRawTransaction err="intrinsic gas too low" or from Android Studio java.lang.RuntimeException: intrinsic gas too low. What more should I do to be able to send transactions with 0 gasPrice from any wallet? Thanks! – Mauro MCO Apr 30 at 16:28
  • maybe this helps: ethereum.stackexchange.com/questions/20875/… – jjj Apr 30 at 17:00
  • Once a network has been created the only ways to mint its coin is by mining blocks, the standard clients don't allow creating ether. So either allocate a large chunk at genesis and use that address to distribute, or modify geth to allow minting more ether. – Ismael May 3 at 1:03
0

You can abstract the crediting function by running a separate end point

which listens to the request raised by the new account creators by passing their public key to your separate end point, from where you can credit them with the desired eth, and by having your master account password safe by abstracting.

There are also other ways, by altering the consensus, but this might be easy to implement.

2
  • So what you're saying is that I could implement a new web service accessed by new end point, where passing the newly created account PubKey as argument, from the Dapp, it would communicate with the Blockchain as one of its master accounts and will give the desired Ether to this Publick Key? – Mauro MCO May 2 at 10:55
  • yes, it would provide a better level of security, than using the master acc details in dapp directly – Vikash May 3 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.