Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

228
Vistas
TypeError: Cannot read properties of undefined (reading ':Voting')

I am getting this type error when i try to run this file in localhost

TypeError: Cannot read properties of undefined (reading ':Voting')
at C:\Users\Evote\index.js:93:53
    at Layer.handle [as handle_request] (C:\Users\Evote\node_modules\express\lib\router\layer.js:95:5)
    at next (C:\Users\Evote\node_modules\express\lib\router\route.js:137:13)
    at Route.dispatch (C:\Users\Evote\node_modules\express\lib\router\route.js:112:3)
    at Layer.handle [as handle_request] (C:\Users\Evote\node_modules\express\lib\router\layer.js:95:5)
    at C:\Users\Evote\node_modules\express\lib\router\index.js:281:22
    at Function.process_params (C:\Users\Evote\node_modules\express\lib\router\index.js:335:12)
    at next (C:\Users\Evote\node_modules\express\lib\router\index.js:275:10)
    at SendStream.error (C:\Users\Evote\node_modules\serve-static\index.js:121:7)
    at SendStream.emit (node:events:390:28)
    at SendStream.error (C:\Users\Evote\node_modules\send\index.js:270:17)
    at SendStream.onStatError (C:\Users\Evote\node_modules\send\index.js:421:12)
    at next (C:\Users\Evote\node_modules\send\index.js:736:16)
    at onstat (C:\Users\Evote\node_modules\send\index.js:725:14)
    at FSReqCallback.oncomplete (node:fs:198:21)

This is my code

app.get('/info', function(req, res){
    var cookie_pass = req.cookies['auth'];
    var cookie_otp = req.cookies['show'];
    if (cookie_pass == null || cookie_pass == '' || cookie_otp == null || cookie_otp == '') {
        res.redirect('/app');
    } else {
        web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
         code = fs.readFileSync('Voting.sol').toString()
        
         compiledCode = solc.compile(code)
         abiDefinition = JSON.parse(compiledCode.contracts[':Voting'].interface)
         VotingContract = web3.eth.contract(abiDefinition)
         byteCode = compiledCode.contracts[':Voting'].bytecode
         deployedContract = VotingContract.new(['Sanat','Aniket','Mandar','Akshay'],{data: byteCode, from: web3.eth.accounts[0], gas: 4700000})
contractInstance = VotingContract.at(deployedContract.address)

        res.sendFile(path.join(__dirname, 'ui', 'clist.html'));
    }
    
});

The error is in the line

abiDefinition=JSON.parse(compiledCode.contracts[':Voting'].interface)

I was trying to build an evoting system based on the ethereum network and when i run the code it is showing as type error

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda