Encountered an error while attempting to update latest block - blockchain

I'm new to blockchain and i was just trying to deploy a simple smart contract to ropsten test net. I've used the smart contract code from https://github.com/t4sk/solidity-multi-sig-wallet. Also i'm using the account provided by truffle develop
My truffle-config.js:
networks: {
development: {
host: "127.0.0.1", // Localhost (default: none)
port: 8545, // Standard Ethereum port (default: none)
network_id: "*", // Any network (default: none)
},
ropsten: {
provider: () => new HDWalletProvider(mnemonic, `https://ropsten.infura.io/v3/${infuraKey}`),
network_id: 3, // Ropsten's id
gas: 5500000, // Ropsten has a lower block limit than mainnet
confirmations: 2, // # of confs to wait between deployments. (default: 0)
timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50)
skipDryRun: true // Skip dry run before migrations? (default: false for public nets )
},
mocha: {
timeout: 100000
},
compilers: {
solc: {
version: "0.5.1", // Fetch exact version from solc-bin (default: truffle's version)
// docker: true, // Use "0.5.1" you've installed locally with docker (default: false)
// settings: { // See the solidity docs for advice about optimization and evmVersion
optimizer: {
enabled: false,
runs: 200
},
// evmVersion: "byzantium"
// }
}
},
Im using solidity: 0.5.1
But when i try to deploy it using truffle migrate --network ropsten im getting the following two errors
1.
This version of µWS is not compatible with your Node.js build:
Error: Cannot find module './uws_win32_x64_72.node'
Falling back to a NodeJS implementation; performance may be degraded.
1_initial_migration.js
======================
Deploying 'Migrations'
----------------------
> transaction hash: 0x673a9a02662595075c6f3aa4dc904d24203cb8e460a3e20a630869c5155cb78c
> Blocks: 2 Seconds: 53
> contract address: 0xde674E126884c8F7Ddd94B5013065596b81fEd6d
> block number: 12075322
> block timestamp: 1647065140
> account: 0xC10352218af6Ccbb574Fd0912adcc9Ac59C22950
> balance: 1.830076836873988898
> gas used: 175087 (0x2abef)
> gas price: 2.500000028 gwei
> value sent: 0 ETH
> total cost: 0.000437717504902436 ETH
Pausing for 2 confirmations...
-------------------------------
C:\Users\coolg\Desktop\hd_wallet\node_modules\request\request.js:848
var e = new Error('ETIMEDOUT')
^
Error: PollingBlockTracker - encountered an error while attempting to update latest block:
Error: ETIMEDOUT
at Timeout.<anonymous> (C:\Users\coolg\Desktop\hd_wallet\node_modules\request\request.js:848:19)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
at PollingBlockTracker._performSync (C:\Users\coolg\Desktop\hd_wallet\node_modules\eth-block-tracker\src\polling.js:51:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Also a transaction for the above smart contract address 0xde674E126884c8F7Ddd94B5013065596b81fEd6d is created on ropsten network.
Edit 1:
I've replaced the provider link with wss://ropsten.infura.io/v3/${infuraKey}` and the 2nd issue gets resolved but now it shows another error
1_initial_migration.js
======================
Deploying 'Migrations'
----------------------
> transaction hash: 0xb72aef24e5fc16395f1dc221965c4e2036b4d72babbe829f244f958d302baee5
> Blocks: 7 Seconds: 228
> contract address: 0xb81478b107D5B08B0F9ce8d0E404701a3D2292a0
> block number: 12076445
> block timestamp: 1647090364
> account: 0xC10352218af6Ccbb574Fd0912adcc9Ac59C22950
> balance: 1.828763684345799891
> gas used: 175087 (0x2abef)
> gas price: 2.500000007 gwei
> value sent: 0 ETH
> total cost: 0.000437717501225609 ETH
Pausing for 2 confirmations...
-------------------------------
> confirmation number: 3 (block: 12076452)
⠦ Saving migration to chain.
Exiting: Review successful transactions manually by checking the transaction hashes above on Etherscan.
Error: Transaction was not mined within 750 seconds, please make sure your transaction was properly sent. Be aware that it might still be mined!
It says the transaction might still be mined, so how will i know when my transaction gets mined? Also in the meantime can i call the fuctions/events of my smart contract that is deployed on the ropsten_eth https://ropsten.etherscan.io/address/0xb81478b107d5b08b0f9ce8d0e404701a3d2292a0

The problem here by mistake may be the address you are trying to reach. I searched for what the problem might be and found two threads where people have already described the problem and sort of found a solution. Most likely one of these options should help to solve the problem.
The first solution is here. The idea is to replace https with wss. There should be something like this:
testnet: {
provider: () => new HDWalletProvider(mnemonic, `wss://ropsten.infura.io/v3/${infuraKey}`),
...
}
Then I searched some more and found something like this. The author of the post says that the problem could be due to DNS or slow internet and suggests adding two parameters to the config:
testnet: {
...,
networkCheckTimeout: 10000,
timeoutBlocks: 200
}

Related

AWS MemoryDB not connecting after recreating it

I have installed aws memory db via terraform. and connected it with .net like the way below.
services.AddStackExchangeRedisCache(option =>
{
option.ConfigurationOptions = new ConfigurationOptions()
{
EndPoints =
{
{ redisConfig.Endpoint, redisConfig.Port } // Cluster endpoint
},
User = redisConfig.User,
Password = redisConfig.Pass,
Ssl = redisConfig.SSL,
AbortOnConnectFail = redisConfig.AbortConnect,
ConnectTimeout = 60000
};
//option.Configuration = $"{redisConfig.Host}:{redisConfig.Port},password={redisConfig.Pass},ssl={redisConfig.SSL},abortConnect={redisConfig.AbortConnect}";
});
but after deleting and recreating it my memorydb suddenly stopped connecting it and throw a connection error. Error is down below
StackExchange.Redis.RedisConnectionException: No connection is active/available to service this operation: HMGET emv-test#gmail.com; UnableToConnect on clustercfg.xxxxx.xxxxx.memorydb.eu-central-1.amazonaws.com:6379/Interactive, Initializing/NotStarted, last: NONE, origin: BeginConnectAsync, outstanding: 0, last-read: 0s ago, last-write: 0s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 0s ago, v: 2.2.50.36290, mc: 1/1/0, mgr: 10 of 10 available, clientName: DESKTOP-V0GJHRO, IOCP: (Busy=2,Free=998,Min=8,Max=1000), WORKER: (Busy=5,Free=32762,Min=8,Max=32767), v: 2.2.50.36290
---> StackExchange.Redis.RedisConnectionException: UnableToConnect on clustercfg.newredis.78ank7.memorydb.eu-central-1.amazonaws.com:6379/Interactive, Initializing/NotStarted, last: NONE, origin: BeginConnectAsync, outstanding: 0, last-read: 0s ago, last-write: 0s ago, keep-alive: 60s, state: Connecting, mgr: 10 of 10 available, last-heartbeat: never, global: 0s ago, v: 2.2.50.36290
--- End of inner exception stack trace ---
at StackExchange.Redis.ConnectionMultiplexer.ThrowFailed[T](TaskCompletionSource`1 source, Exception unthrownException) in /_/src/StackExchange.Redis/ConnectionMultiplexer.cs:line 2799
It was working but all of a sudden it stopped working. I need help

Why do I get `sealing paused while waiting for transactions` error when mining in Ethereum private network?

I launched a private network by using geth --datadir data/node1 --http --dev --http.corsdomain "*" --http.api web3,eth,debug,personal,net,miner --allow-insecure-unlock --mine command.
I am able to attach to it geth attach http://localhost:8545
but the balance of the default account is only 1.15 ether:
eth.getBalance(eth.accounts[0]) 1.15792089237316195423570985008687907853269984665640564039457582226449518702905e+77
I'd like to give it more ethers so I run:
miner.start()
null
And I can see there is a warn in the node log:
INFO [11-28|20:29:38.512] Transaction pool price threshold updated price=1
INFO [11-28|20:29:38.512] Commit new mining work number=4 sealhash=73b6e7..5d8b72 uncles=0 txs=0 gas=0 fees=0 elapsed="174.436µs"
WARN [11-28|20:29:38.512] Block sealing failed err="sealing paused while waiting for transactions"
I wonder what the issue could be?
Perhaps you have not previously given permission for the miner to sign the genesis block.
POA uses the Clique API to manage the seal list.
> clique.proposals
{}
> clique.propose("0xc077f8420d5b6c125897d9c5e21293ff6f77855c", true)
true
> clique.proposals
{
0xc077f8420d5b6c125897d9c5e21293ff6f77855c: true
}
> clique.getSnapshot()
{
hash: "0xfbfe67cd638d21f528036130cc703be8f8fdccb934d871f3f8c2eccda1ed4bf5",
number: 11,
recents: {
10: "0xc077f8420d5b6c125897d9c5e21293ff6f77855c",
11: "0x726794b16f6c5b0be0b78d7713a876ed3da8be1a"
},
signers: {
0x726794b16f6c5b0be0b78d7713a876ed3da8be1a: {},
0xc077f8420d5b6c125897d9c5e21293ff6f77855c: {}
},
tally: {},
votes: []
}`enter code here`
enter code here
You can see more details in this manual: https://yenhuang.gitbooks.io/blockchain/content/interact-with-private-chain-on-android/build-the-private-chain.html
You can also top up your balance using:
eth.sendTransaction({from:eth.coinbase, to:eth.accounts[1], value: web3.toWei(0.05, "ether")})
but the balance of the default account is only 1.15 ether:
eth.getBalance(eth.accounts[0])
1.15792089237316195423570985008687907853269984665640564039457582226449518702905e+77
I didn’t pay attention to it right away. But this is not 1.15 ETH, this is a huge number of ETH that will not end and you can transfer it from coinbase to other created accounts on your private network in dev mode.

Error: Deployment Failed while using Matic Test Network

I am getting started with Application development on Matic. And I am following the instruction as provided on the docs https://docs.matic.network/docs/develop/getting-started
But I faced problem while using truffle. After I run the command
truffle migrate --network matic
The error as follow:
Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.
Starting migrations...
======================
> Network name: 'matic'
> Network id: 80001
> Block gas limit: 20000000 (0x1312d00)
1_initial_migration.js
======================
Deploying 'Migrations'
----------------------
Error: *** Deployment Failed ***
"Migrations" -- insufficient funds for gas * price + value.
at /usr/local/lib/node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:365:1
at process._tickCallback (internal/process/next_tick.js:68:7)
Truffle v5.1.55 (core: 5.1.55)
Node v10.19.0
The configuration file of truffle as follow:
const HDWalletProvider = require('truffle-hdwallet-provider');
const fs = require('fs');
const mnemonic = fs.readFileSync(".secret").toString().trim();
module.exports = {
networks: {
development: {
host: "127.0.0.1", // Localhost (default: none)
port: 8545, // Standard Ethereum port (default: none)
network_id: "*", // Any network (default: none)
},
matic: {
provider: () => new HDWalletProvider(mnemonic, `https://rpc-mumbai.matic.today`),
network_id: 80001,
confirmations: 2,
timeoutBlocks: 200,
skipDryRun: true
},
},
// Set default mocha options here, use special reporters etc.
mocha: {
// timeout: 100000
},
// Configure your compilers
compilers: {
solc: {
}
}
}
It worked fine for the develop network using
truffle develop
Can someone tell me how to overcome error while using Matic Test Network?
Make sure you have enough MATIC for the transaction, you can get some from here and transfer them to the account[0]. I had issues deploying with truffle as all my tokens were at account[1] rather than account[0]
in my case it was ETH, ensuring i had tokens in the first account did the trick

Problems about 53 bits deploying contracts with Truffle

I am trying to deploy a Smart Contract with truffle 5.1.19 as follows:
pragma solidity 0.5.16;
contract Simple {
string public message;
function Hello(string memory _initialMessage) public {
message = _initialMessage;
}
function setMessage(string memory _newMessage) public {
message = _newMessage;
}
}
When I run a truffle deploy --network mired I have the next error:
Error: Number can only safely store up to 53 bits
at assert (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/bn.js/lib/bn.js:6:1)
at BN.toNumber (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/bn.js/lib/bn.js:506:1)
at Object.hexToNumber (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3-utils/src/utils.js:234:1)
at Method.outputBlockFormatter (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3-core-helpers/src/formatters.js:236:1)
at Method.web3.eth.getBlock.method.outputFormatter (/usr/local/lib/node_modules/truffle/build/webpack:/packages/interface-adapter/dist/shim/overloads/ethereum.js:37:1)
at Method.formatOutput (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3-core-method/src/index.js:163:1)
at sendTxCallback (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3-core-method/src/index.js:473:1)
at /usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3-core-requestmanager/src/index.js:147:1
at /usr/local/lib/node_modules/truffle/build/webpack:/packages/provider/wrapper.js:112:1
at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3-providers-http/src/index.js:96:1)
at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:1)
at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/xhr2-cookies/dist/xml-http-request.js:208:1)
at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/xhr2-cookies/dist/xml-http-request.js:318:1)
at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/xhr2-cookies/dist/xml-http-request.js:289:47)
at IncomingMessage.emit (events.js:203:15)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
Truffle v5.1.19 (core: 5.1.19)
Node v10.19.0
My truffle-config for my network is the next one:
mired: {
host: "10.xxx.xxx.xxx",
port: 8080, // Custom port
network_id: "*", // Custom network
gas: 0, // Gas sent with each transaction (default: ~6700000)
gasPrice: 0x0, // 20 gwei (in wei) (default: 100 gwei)
from: "0x8...............", // Account to send txs from (default: accounts[0])
// websockets: true // Enable EventEmitter interface for web3 (default: false)
},
Doing a downgrade of my truffle to the 4.1.15 version this error dissapears but I don't understand why with an actual version, this error appears. Thanks in advance
If you are working with quorum like it is my case. On truffle-config.js, you have to write type:"quorum" and it solves the problem.

Connecting cassandra-stress to AWS Keyspaces

I've provisions a Keyspace on AWS and in order to make sure it can achieve our desired performance I'm trying to run the cassandra-stress tool on it and compare it to other architectures we're experimenting with.
I managed to connect to it using the following cqlshrc:
[connection]
port = 9142
factory = cqlshlib.ssl.ssl_transport_factory
[ssl]
validate = true
certfile = /root/.cassandra/AmazonRootCA1.pem
And the following command (hoping that soon enough there will be Python3 support, the development was completed this February according to their Jira ticket):
cqlsh cassandra.eu-central-1.amazonaws.com 9142 -u "myuser-at-722222222222" -p "12/12ZmHmtD1klsDk9cgqt/XXXXXXXXxUz6Sy687z/U=" --ssl --cqlversion="3.4.4"
Surprisingly or not, when using the official AWS guides things tend to work.
So I went on and tried connecting the cassandra-stress tool (I have it inside a Docker container, I'd rather keep my OS Java free) to the same Keyspace.
First I converted the AWS AmazonRootCA1.pem into cassandra_truststore.jks using the following commands (explained here):
openssl x509 -outform der -in AmazonRootCA1.pem -out temp_file.der
keytool -import -alias cassandra -keystore cassandra_truststore.jks -file temp_file.der
Now when I'm trying to run the actual tool like this:
./cassandra-stress write -node cassandra.eu-central-1.amazonaws.com -port native=9142 thrift=9142 jmx=9142 -transport truststore=/root/.cassandra/cassandra_truststore.jks truststore-password=mypassword -mode native cql3 user="myuser-at-722222222222" password="12/12ZmHmtD1klsDk9cgqt/XXXXXXXXxUz6Sy687z/U="
I'm getting the following error:
******************** Stress Settings ********************
Command:
Type: write
Count: -1
No Warmup: false
Consistency Level: LOCAL_ONE
Target Uncertainty: 0.020
Minimum Uncertainty Measurements: 30
Maximum Uncertainty Measurements: 200
Key Size (bytes): 10
Counter Increment Distibution: add=fixed(1)
Rate:
Auto: true
Min Threads: 4
Max Threads: 1000
Population:
Sequence: 1..1000000
Order: ARBITRARY
Wrap: true
Insert:
Revisits: Uniform: min=1,max=1000000
Visits: Fixed: key=1
Row Population Ratio: Ratio: divisor=1.000000;delegate=Fixed: key=1
Batch Type: not batching
Columns:
Max Columns Per Key: 5
Column Names: [C0, C1, C2, C3, C4]
Comparator: AsciiType
Timestamp: null
Variable Column Count: false
Slice: false
Size Distribution: Fixed: key=34
Count Distribution: Fixed: key=5
Errors:
Ignore: false
Tries: 10
Log:
No Summary: false
No Settings: false
File: null
Interval Millis: 1000
Level: NORMAL
Mode:
API: JAVA_DRIVER_NATIVE
Connection Style: CQL_PREPARED
CQL Version: CQL3
Protocol Version: V4
Username: myuser-at-722222222222
Password: *suppressed*
Auth Provide Class: null
Max Pending Per Connection: 128
Connections Per Host: 8
Compression: NONE
Node:
Nodes: [cassandra.eu-central-1.amazonaws.com]
Is White List: false
Datacenter: null
Schema:
Keyspace: keyspace1
Replication Strategy: org.apache.cassandra.locator.SimpleStrategy
Replication Strategy Pptions: {replication_factor=1}
Table Compression: null
Table Compaction Strategy: null
Table Compaction Strategy Options: {}
Transport:
factory=org.apache.cassandra.thrift.TFramedTransportFactory; truststore=/root/.cassandra/cassandra_truststore.jks; truststore-password=mypassword; keystore=null; keystore-password=null; ssl-protocol=TLS; ssl-alg=SunX509; store-type=JKS; ssl-ciphers=TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA;
Port:
Native Port: 9142
Thrift Port: 9142
JMX Port: 9142
Send To Daemon:
*not set*
Graph:
File: null
Revision: unknown
Title: null
Operation: WRITE
TokenRange:
Wrap: false
Split Factor: 1
java.lang.RuntimeException: com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: cassandra.eu-central-1.amazonaws.com/3.127.48.183:9142 (com.datastax.driver.core.exceptions.TransportException: [cassandra.eu-central-1.amazonaws.com/3.127.48.183] Channel has been closed))
at org.apache.cassandra.stress.settings.StressSettings.getJavaDriverClient(StressSettings.java:220)
at org.apache.cassandra.stress.settings.SettingsSchema.createKeySpacesNative(SettingsSchema.java:79)
at org.apache.cassandra.stress.settings.SettingsSchema.createKeySpaces(SettingsSchema.java:69)
at org.apache.cassandra.stress.settings.StressSettings.maybeCreateKeyspaces(StressSettings.java:228)
at org.apache.cassandra.stress.StressAction.run(StressAction.java:57)
at org.apache.cassandra.stress.Stress.run(Stress.java:143)
at org.apache.cassandra.stress.Stress.main(Stress.java:62)
Caused by: com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: cassandra.eu-central-1.amazonaws.com/3.127.48.183:9142 (com.datastax.driver.core.exceptions.TransportException: [cassandra.eu-central-1.amazonaws.com/3.127.48.183] Channel has been closed))
at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:233)
at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:79)
at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1424)
at com.datastax.driver.core.Cluster.getMetadata(Cluster.java:403)
at org.apache.cassandra.stress.util.JavaDriverClient.connect(JavaDriverClient.java:160)
at org.apache.cassandra.stress.settings.StressSettings.getJavaDriverClient(StressSettings.java:211)
... 6 more
I've tried changing some parameters such as the jks password etc. (Just in case I was wrong) but I got a different error message so it's probably not the case.
Did I miss something?
Try using TLP Stress instead.
tlp-stress run RandomPartitionAccess -d 10m --host cassandra.us-east-1.amazonaws.com --port 9142 --username alice --password fLyWYFlTCD5J2gzGAZ –ssl --max-requests 4000 --dc us-east-2 --threads 10
https://thelastpickle.com/tlp-stress/