alastria / test-environment

Set of tools for the generation of test environments, benchmarking, integration, ...
Apache License 2.0
7 stars 16 forks source link

How to get ether to my accounts? #11

Closed xaviermaltas closed 4 years ago

xaviermaltas commented 5 years ago

Hi,

I've been using the testnet project, to create my own Ethereum private network together a Truffle distributed application that I've developed. It's a votation application. The votes are done through a WebApp and for being this able I need some ether.

How can I get ether for my accounts?

I have tried to unlock validators accounts, doing a geth attach to the .ipc file of them but they do not have account. Also I have tried to change the genesis block and modify the alloc parameter to give some ether to some accounts, but I have no result.

Does somebody have any idea to solve it?

Thank you.

netmanito commented 5 years ago

Hello @xaviermaltas, you don't need to have ether to work with this testnet. As a permissioned network, there's no gas fee when you make transactions. You should be able to deploy your smartcontracts and interact with them without the need of ether. Kind Regards.

xaviermaltas commented 5 years ago

Hi @netmanito, I know that the deploy and the interaction with the smart contract should be able without any fee. In fact, the deploy do not have fees, but when I try to interact via web app with Metamask, appear a Gas Amount that I have to pay.

Screenshot from 2019-07-02 15-09-35

As it is able to see, the final cost is 0 ETH.

Then I bring up a web app using: npm start

Here the web app and Metamask connected to the General1 node: Screenshot from 2019-07-02 15-14-33

Screenshot from 2019-07-02 15-16-30

In this image it's able to see that it's required to pay a fee.

I have also tried to set the Gas Price to 0 and do not appear any error, but when I press "Confirm" I get that the transaction failed with this message error:

Uncaught (in promise) Error: Error: Error: [ethjs-rpc] rpc error with payload {"id":3206657218464,"jsonrpc":"2.0","params":["0xf88b04808507a96049599423ed61cfd8da3b84ff5d0d31f285b0c07051d87b80a436c8c5ee0000000000000000000000000000000000000000000000000000000000000001850470c01b12a0ee9d0064e2db34f001317104b38cef92478cf8fe854fe5a1c2314b92fc07c25fa00534497947d53bbbf7f43f92a7ca87720a0d43b3a648ebf4673af91e816c59dd"],"method":"eth_sendRawTransaction"} Error: invalid sender at Object.InvalidResponse (main.js:110990) at main.js:114413 at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1 at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1 at o (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1) at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1 at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1 at u (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1) at a (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1) at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1

What do I must change to solve it?

Thank you.

netmanito commented 5 years ago

Hi @xaviermaltas, If I'm not wrong, this testnet is based on old alastria network (arrakis) that doesn't include EIP-155 compliance. please see issue 366. I think, in order to use metamask, you should download genesis.json from current testnet2 branch and initialize a test network with this genesis in order to have EIP-155 available. You'll have to init every node for the new genesis. geth --datadir /home/ubuntu/alastria/validator1 init /home/ubuntu/alastria-node/data/genesis.json Hope this helps. Regards

xaviermaltas commented 5 years ago

Hello @netmanito , I have tried the things that you proposed one week ago, but I've failed again. I have changed the genesis.json with the following code:

{
  "alloc": {
    "0x58b8527743f89389b754c63489262fdfc9ba9db6": {
      "balance": "1000000000000000000000000000"
    },
    "0x74d4C56d8dcbC10A567341bFac6DA0A8F04DC41d": {
      "balance": "1000000000000000000000000000"
    }
  },
  "coinbase": "0x0000000000000000000000000000000000000000",
  "config": {
    "chainId": 83584648538,
    "byzantiumBlock": 1,
    "homesteadBlock": 2,
    "eip150Block": 3,
    "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "eip155Block": 3,
    "eip158Block": 4,
    "istanbul": {
      "epoch": 30000,
      "policy": 0
    },
    "isQuorum": true
  },
  "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000f85ad594b87dc349944cc47474775dde627a8a171fc94532b8410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0",
  "gasLimit": "0x2FEFD800",
  "difficulty": "0x1",
  "mixHash": "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365",
  "nonce": "0x0",
  "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "timestamp": "0x00"
}

I have also tried to initialize the new configuration adding a code line at start_node.sh and start_faulty_node.sh , but I get the following error: Fatal: Failed to read genesis file: open /home/xavier/Desktop/test-environment/infrastructure/testnet/data/alastria-node/data/genesis.json: no such file or directory

This is the code that I have added: geth --datadir "${PWD}"/identities/"$NODE_NAME" init "${PWD}"/data/alastria-node/data/genesis.json

Here an image to show the context where I have done the changes : Screenshot from 2019-07-10 15-12-18

Could you help me please?

Thank u. :)

netmanito commented 5 years ago

Hi @xaviermaltas, I'm not sure if the staff in test-environment/infrastructure/testnet currently works. I'll tell you how I did it.

From this repo, use threenodes section to deploy your testnet. Once your threenodes testnet is working, cakeshop is not strictly necessary for this action, you can try to hardfork the genesis.

Update then to constantinople. Modify your genesis.json from ~/alastria-node/data/genesis.json adding the following line: Put the block number where you want the hardfork to be done. ex: 491091

    "constantinopleBlock": 491091,

Modify the follwing genesis.json line to 0

  "eip158Block": 0,

Now genesis.json should be ok.

You can start to fork your nodes.

  1. Stop nodes.
  2. run geth --datadir /home/ubuntu/alastria/$node init /home/ubuntu/alastria-node/data/genesis.json for each $node folder you want to migrate, ex: validator1, validator2, general1, etc.
  3. start node.
  4. all nodes must have same geth version.
  5. wait until block number fork and test.

Hope this helps. Regards

javaguirre commented 4 years ago

Hi! Thank you for the contribution, I'm gonna close this issue due to inactivity, but don't hesitate to open it again in case you want to go further. :-)