Hot answers tagged

1

Change this: var testContract = contract(customerJson); To this: var testContract = contract({abi: customerJs.abi, unlinked_binary: ByteCode});


1

This question is not related to ethereum at all. Try using PM2 for your nodejs, there is auto starting option for nodejs applications.


1

In a block multiple uncles can be included. This method returns only one uncle. web3.eth.getUncle(blockHashOrBlockNumber, uncleIndex [, callback]) uncleIndex is a number starting from 0 which represents which uncle will be returned. If for example a block has 2 uncles, the first uncle has uncleIndex=0 while the second uncle has uncleIndex=1.


1

I have created and compiled a contract according to the one that you've posted in a comment. I have deployed it to Ropsten, and then verified it on Etherscan. As you can see on Etherscan, its byte-code contains the sequence 704f1b94, which is the function-selector of function registerUser(string). And as you can see on Etherscan, the byte-code of your ...


1

It seems you are using your contract from the backend. In that case you cannot use MetaMask because it runs in the browser. You have these options: Execute the transactions that make changes from the frontend. The UI has to connect to MetaMask and use it as provider for @truffle/contract. Use your own wallet in the backend and configure truffle to use it ...


1

Using below code you can deploy your contract using truffle-contract. const contract = require('truffle-contract'); const DeployJson = fs.readFileSync("E:/Deploy/build/contracts/Deploy.json"); const DeployContract = contract(DeployJson); DeployContract.setNetwork('network_id'); // Unlock the account from which you want to deploy the contract await web3.eth....


1

There's no deploy method in the API provided by require('truffle-contract'). Given truffleContract = require('truffle-contract'), you need to do something like this: const myContract = truffleContract({abi: ..., unlinked_binary: ...}); const block = await web3.eth.getBlock('latest'); myContract.setProvider(web3.currentProvider); myContract.defaults({from: ...


1

I am able to connect to your contract. Try this. I got your abi from etherscan. const express = require('express') const Web3 = require('web3') const web3 = new Web3(new Web3.providers.HttpProvider('https://ropsten.infura.io/')); const abi = [{"constant":false,"inputs":[{"name":"CopyMatch","type":"address"}],"name":"proxy_ActiveStrategy","outputs":[{"name":"...


1

Assuming that you have already compiled the contract, and that its abi and bytecode are in files <ContractName>.abi and <ContractName>.bin respectively, you can use this script (web3 v1.2.1): const fs = require("fs"); const Web3 = require("web3"); const NODE_ADDRESS = "..."; const PRIVATE_KEY = "..."; const CONTRACT_NAME = "..."; const ...


1

I know it's too late to answer this question. But I hope it could help others. You can not list transactions directly using web3 and JSON-RPC. In order to have a list of translations involving an address you need to scan Whole(or a part of) blocks of ethereum blockchain to find them. You could guess! It's pretty time intensive! To solve this problem you ...


Only top voted, non community-wiki answers of a minimum length are eligible