vechain/thor

Vchain connection error using connex

Closed this issue · 11 comments

Hi there,

Please notice that this is an issue tracker reserved for bug reports and feature requests.

For general questions please use the gitter channel.

OS Version:

Windows

Commit hash : (if develop)

Expected behavior

Connection should be made to create object

Actual behavior

process exited with code 1
Uncaught Error Error: 404 get blocks/0:

(undefined:48:27) at rejected (undefined:6:65) at processTicksAndRejections (undefined:96:5) --- async function --- at runMainESM (undefined:51:21)

Steps to reproduce the behavior

Could you post the code of initializing connex?

import { Framework } from '@vechain/connex-framework'
import { Driver, SimpleNet } from '@vechain/connex-driver'

import express from 'express';
var app = express();

app.get('/', function (req, res) {
res.send('Hello World!'); // This will serve your request to '/'.
});

app.listen(8669, function () {
console.log('Example app listening on port 8669!');
});

const net = new SimpleNet('http://localhost:8669/')
const driver = await Driver.connect(net)

// now we get the ready-to-use Connex instance object
const connex = new Framework(driver)

These are the dependancy installed

{
"name": "eracom",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"author": "Eracom",
"license": "ISC",
"description": "",
"dependencies": {
"@vechain/connex": "^2.0.10",
"@vechain/connex-driver": "^2.0.10",
"@vechain/connex-framework": "^2.0.10",
"express": "^4.18.1"
}
}

You need to start a thor instance for this kind of code. And the express server is not needed.

can you modify it or can you send some sample code?

Just use the sample code in the README.

import { Framework } from '@vechain/connex-framework'
import { Driver, SimpleNet } from '@vechain/connex-driver'

const net = new SimpleNet('http://localhost:8669/')
const driver = await Driver.connect(net)

// now we get the ready-to-use Connex instance object
const connex = new Framework(driver)

And start a thor instance.

Can you send me the code to start thor instance.

This code i already have tried. but im not familiar with thor instance

Read the document please, https://github.com/vechain/thor

Lots of thanks for the assistance. Finally i have connected.

hi i have one more question.
this connection is only working when "bin/thor --network main" is running in background on terminal.

any alternative pls suggest me.