Can't deploy smart contract application to Heroku

Asked
Active3 hr before
Viewed126 times

6 Answers

smartcontractapplicationherokudeploy
90%

Stack Overflow Public questions & answers ,Thanks for contributing an answer to Stack Overflow!,My application is built with Truffle and React, and I am getting an error when I try to deploy to Heroku. In my local machine all works perfectly, but when I try to deploy:, Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers

So basically when heroku tries to build your project it run in to an error.

 /tmp/build_e68c9473 / node_modules / fs - extra / lib / mkdirs / make - dir.js: 85
 }
 catch {
    ^
    SyntaxError: Unexpected token {
load more v
88%

Deploy the smart contract to the local blockchain., Deploy the smart contract to the local blockchain. npm run contract-deploy ,Now you can deploy the smart contract using a single command:,To start the RPC server run the command

npm install - g ganache - cli
load more v
72%

So, when would it make sense to consider using blockchain for our applications, rather than a standard database or record?,And we’re almost done! We have built our API with Node.js, and also set up and built our smart contract.,Retrieval, with any authenticated user being able to access the stored data on our platform and use it.,With a commitment to quality content for the design community.

require('dotenv').config();
const express = require('express')
const app = express()
const routes = require('./routes')
const Web3 = require('web3');
const mongodb = require('mongodb').MongoClient
const contract = require('truffle-contract');
app.use(express.json())

mongodb.connect(process.env.DB, {
   useUnifiedTopology: true
}, (err, client) => {
   const db = client.db('Cluster0')
   //home
   routes(app, db)
   app.listen(process.env.PORT || 8082, () => {
      console.log('listening on port 8082');
   })
})
load more v
65%

We’ll start with a script that creates a drag-and-drop image interface around the Inception model. Create a brand new directory, and copy-paste the code below into a python file that we’ll call app.py:,We need to make sure that we designate all of the Python libraries that we will need as dependencies. So create a requirements.txt file with the dependencies in the same directory as app.py. In my case, that’s:,That last command will open up your default browser and bring you to the app. You’ll notice the web address is the automatically generated instance name plus the Heroku domain.,In order to deploy our app correctly on Heroku, we need to make sure it’s served on the right URL & port. The commands below do that, so put them inside a file called setup.sh in the same directory as your app.

Now, we’re going to create a file called Procfile (that’s it, there’s no extension for this file!) whose job it is to tell Heroku what commands to run to start the Gradio app. There are only two commands: to run the bash script we created in the previous step, and then to launch our app. So our Heroku Procfile looks like this:

web: source setup.sh && python app.py
load more v
75%

This guide will cover all you need to know to get you started using your contracts, including:,Unlike most software, smart contracts don’t run on your computer or somebody’s server: they live on the Ethereum network itself. This means that interacting with them is a bit different from more traditional applications.,We will send a transaction to call the store function with a numeric value:,Box's other function is called retrieve, and it returns the integer value stored in the contract. This is a query of blockchain state, so we don’t need to send a transaction:

$ npm install--save - dev ganache - cli
load more v
40%

More about smart contract security,Compile your smart contract as per usual and go to the run tab.,Click deploy like before, providing any constructor arguments your smart contract might have.,We’ll look at how to deploy your smart contract to an Ethereum test network, which functions almost the exact same as the Mainnet, and how to connect your front end to it. For this part, we will be using Heroku and the Ropsten testnet.

npm install - g truffle
load more v

Other "smart-contract" queries related to "Can't deploy smart contract application to Heroku"