2

Preconditions

I'm running a private network with Geth, having custom smart contracts deployed by Truffle and a simple frontend which using Metamask as a provider to connect the network.

Versions

  • Geth: 1.8.12-stable
  • Truffle: v4.1.13 (core: 4.1.13)
  • Solidity: v0.4.24 (solc-js)

Genesis Block

{
    "config": {
        "chainId": 331788,
        "homesteadBlock": 0,
        "eip155Block": 331788,
        "eip158Block": 0
    },
    "nonce": "0x0000000000000000",
    "timestamp": "0x00",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "extraData": "0x00",
    "gasLimit": "10000100000",
    "difficulty": "20",
    "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "coinbase": "0x0d33f764b19d03df4daa283859577378a01c5cad",
    "alloc": {
        "0x0d33f764b19d03df4daa283859577378a01c5cad": { "balance": "1000000" }
    }
}

Initing the private network

geth --identity "node" --rpc --rpcport "8545" --rpccorsdomain "*" --datadir=/ethereum/data --ethash.dagdir=/ethereum/ethash --port "30303" --nodiscover --rpcapi "db,eth,net,admin,web3,debug" --networkid 331788 init /ethereum/genesis.json
geth --identity "node" --rpc --rpcaddr="0.0.0.0" --rpcport "8545" --rpccorsdomain "*" --datadir=/ethereum/data --ethash.dagdir=/ethereum/ethash --port "30303" --nodiscover --verbosity=9 --rpcapi "admin,db,eth,net,web3,miner,personal,debug" --networkid 331788

Preparation

Once the private network is up, I connect to it via geth attach and then run the following:

personal.unlockAccount(web3.eth.coinbase, "123123", 150000);
miner.setGasPrice(1); miner.setEtherbase(personal.listAccounts[0]); miner.start(5);

So I unlock my coinbase account and start 5 miners with gas price value 1. After some time, I'm able to deploy my contracts which I do next. So they take the first three nonce values for my coinbase account. When contract is deploying txpool.inspect shows me the following:

pending: {
  0x0D33f764b19d03DF4DAa283859577378a01C5Cad: {
    2: "contract creation: 0 wei + 10010000 gas × 32 wei"
  }
},
queued: {}

Contracts are deployed okay.

Sending transactions

On the frontend, I have the following code to send transaction to my custom contract using truffle-contract abstraction:

sampleNameContract().use(function (instance) {
        return instance.addRecord(recordId, address, recordId, address, { gas: "0x10000", from: address })
    }).then(function (value) {
        console.log(`Tx: ${value}`)
    })

Executing this snippet, Metamask asks me to approve transaction and I do it. As a result, I have the following info in txpool.inspect:

pending: {
      0x0D33f764b19d03DF4DAa283859577378a01C5Cad: {
        3: "0x440C9c5DBC21cedcAfF1a98ac7A48b5c6930cd0c: 0 wei + 10010000 gas × 32000000000 wei"
      }
    },
    queued: {}

This transaction is never mined and applied and leaves in the tx pool as a pending one forever.

Issue

The transaction I send to my custom contract from the frontend is never mined and applied. Can you please help me figure this out?

bumped to the homepage by Community 2 days ago

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

0

Try to execute a transaction using address 0x0d33f764b19d03df4daa283859577378a01c5cad for which you had already preallocated some ethers. It might be possible that transaction cost is comparatively high and need more time to mine sufficient ethers to execute a transaction.

  • Hi asvisosila, Currently, my account has 55130.000 ETH. How can I get my current transaction cost on that private network? – Roman Glushko Aug 7 '18 at 6:14
  • Are you able to deploy your contract on ganache? I recommend you to use ganache for development and testing of DAPP. Ganache pre-allocates 100 ethers in 10 accounts(default is 10) initially so that you can quickly test your application. – Soham Lawar Aug 7 '18 at 9:39
  • asvisosila, No, I'm running geth node where I'm able to deploy contracts without errors using Truffle. However, I have to try using something else to get it worked since I could not mange to fix that so far :( – Roman Glushko Aug 7 '18 at 11:07

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.