我最近一直在尝试使用松露,并遵循以下教程:http://truffleframework.com/tutorials/pet-shop
每当我尝试设置事务时,我都会在下面遇到相同的错误
错误:错误:tx没有正确的nonce.account hasce of:14 tx hasce of:0
在网上查看并阅读了很多与此相关的文章,但到目前为止还没有找到可能导致此问题的原因.
根据我的理解,它似乎无法找到以前的事务来散列新的事务?
当我想测试字符串值是否正确时,会出现问题.数字被正确断言,并且在尝试编译时不会返回错误消息.但是,当我尝试断言一个字符串时,它返回以下错误消息:
Error: Member "equal" is not available in type(library Assert) outside of storage.
Assert.equal(token.symbol(), "$", "The symbol of the token should be $");
^----------^
Compiliation failed. See above.
Run Code Online (Sandbox Code Playgroud)
Token.sol
pragma solidity ^0.4.8;
contract Token {
/* The amount of tokens a person will get for 1 ETH */
uint256 public exchangeRate;
/* The name of the token */
string public name;
/* The address which controls the token */
address public owner;
/* The symbol of the token */
string …Run Code Online (Sandbox Code Playgroud) 我试着去整合web3js与Trezor在松露开发网络或使用设有通往Ropsten测试网络.
我们的想法是使用硬件钱包签署交易,然后使用web3js发送原始交易
我得到了我们没有平衡来进行交易,可能是因为web3js没有使用10个松露帐户中的一个并使用不在我的本地网络中的trezor地址.
在ropsten我有一些醚,我得到"无效地址"
有没有办法使用web3js将已签名的交易(使用trezor)发送到松露开发网络?我的意思是,有没有办法将trezor地址包含在松露网络中?
松露的情况在这里有更详细的解释,但问题可以概括为" 有没有办法将硬件钱包纳入松露开发网络? ":https://github.com/trufflesuite/truffle/issues/973
使用ropsten我已经设法发送一个事务并在回调中接收一个事务哈希,但如果我们查询该事务,我们得到该事务不存在..所以..这怎么可能?
我也尝试将合同部署到Ropsten,现在我在调用智能合约函数时得到"无效地址".也许签名功能错了?有人可以将Trezor交易登录与web3js集成吗?
你们看到我们遵循的签名和发送过程中有什么问题吗?也许R,V和S参数处理有问题..
另一个重要的事情是我使用https://github.com/ethereumjs/ethereumjs-tx来创建原始事务
web3js,truffle和trezzor中发布的问题可以提供更多信息:
亲切的问候
trezorLogin = async()=> {
let trezor= await this.getTrezor();
// site icon, optional. at least 48x48px
let hosticon = 'https://doc.satoshilabs.com/trezor-apps/_images/copay_logo.png';
// server-side generated and randomized challenges
let challenge_hidden = '';
let challenge_visual = '';
//use anonimous functions on callback otherwise returns cross origin errors …Run Code Online (Sandbox Code Playgroud) 我显然检查connect-privkey-to-provider了依赖项中是否存在模块。但是,它一直说模块'connect-privkey-to-provider'是无关的npm
并且找不到模块'connect-privkey-to-provider'
我的代码有什么问题?
PS C:\Users\1Sun\addition-game-starter> truffle deploy --network klaytn 错误:找不到模块“connect-privkey-to-provider” 在 Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15) at Function.Module._load (internal/modules/cjs/loader.js:508:25) 在 Module.require (internal/modules) /cjs/loader.js:637:17) 在对象的 require (internal/modules/cjs/helpers.js:22:18)。(C:\Users\1Sun\addition-game-starter\truffle.js:2:29) 在 Module._compile (internal/modules/cjs/loader.js:701:30) 在 Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10) at Module.load (internal/modules/cjs/loader.js:600:32) at tryModuleLoad (internal/modules/cjs/loader.js:539:12) ) at Function.Module._load (internal/modules/cjs/loader.js:531:3) at Module.require (internal/modules/cjs/loader.js:637:17) at require (internal/modules/cjs/ helpers.js:22: 18) 在 Function.Config.load (C:\Users\1Sun\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-config\index.js:254:1) 在 Function.Config。在 Object.run (C:\Users\1Sun\) 检测 (C:\Users\1Sun\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-config\index.js:243:1) AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-core\lib\commands\migrate.js:35:1) at Command.run (C:\Users\1Sun\AppData\Roaming\npm \node_modules\truffle\build\webpack:\packages\truffle-core\lib\command.js:101:1) 在 Object. (C:\Users\1Sun\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-core\cli.js:22:1) 在 1) 在 Function.Config.detect (C:\Users\1Sun\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-config\index.js:243:1) 在 Object.run ( C:\Users\1Sun\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-core\lib\commands\migrate.js:35:1) 在 Command.run (C:\Users\ …
我有一个合约的功能,它会在每次通话时发出事件.
我想在每个测试中发出一个正在传递的事件,这里有一些测试:
it("should emit Error event when sending 5 ether", function(done){
var insurance = CarInsurance.deployed();
insurance.send({from: accounts[0], value: web3.toWei(5, 'ether')}).then(done).catch(done);
});
it("should emit Error event when sending 5 ether", function(done){
var insurance = CarInsurance.deployed();
insurance.send({from: accounts[0], value: web3.toWei(5, 'ether')}).then(function(txHash){
assert.notEqual(txHash, null);
}).then(done).catch(done);
});
it("should emit Error event when sending 5 ether", function(done){
var insurance = CarInsurance.deployed();
insurance.send({from: accounts[0], value: web3.toWei(5, 'ether')}).then(function(done){
done();
}).catch(done);
});
Run Code Online (Sandbox Code Playgroud)
结果是:
1) should emit Error event when sending 5 ether
Events emitted during test:
---------------------------
Error(error: …Run Code Online (Sandbox Code Playgroud) 我通过npm以下方式安装了松露:
sudo npm install -g truffle
但是当我在控制台上运行松露列表时它就给了我
bash:truffle:命令未找到
我正在使用testrpc和松露来测试我的合同.
当我输入时truffle migrate,这会将我的合同部署到testrpc网络.
我的问题是,哪个帐户(来自testrpc帐户)已用于部署合同.
换句话说,谁的合同所有者?
先感谢您
错误:Truffle 当前使用 solc 0.5.16,但您的一个或多个合约指定 \xe2\x80\x9cpragma Solidity ^0.8.0\xe2\x80\x9d
\n这是错误的照片 - https://gyazo.com/2f5ea2f50cc1d4ef5eea2f21d0e04fe7
\n我的所有合约都使用 ^0.8.0 编译指示。我的 truffle-config 也使用与您在此处看到的相同的版本 -https://gyazo.com/1ec8b28ca48902c091004f8659cf678d
\n请帮忙。非常感谢。
\n我正在开发一个使用 Truffle 的区块链项目。当我运行 Truffle Console 命令时,我遇到了这个问题。
\n完整日志:
\n此版本的 \xc2\xb5WS 与您的 Node.js 版本不兼容:
\n错误:节点加载器:\n错误:找不到指定的模块。\nC:\\Users\\sudda\\AppData\\Roaming\\npm\\node_modules\\truffle\\node_modules\\ganache\\dist \\node/3jj9vE3p.node\n回退到 NodeJS 实现;性能可能会下降。
\n包.json
\n{\n "name": "nft-marketplace",\n "version": "0.1.0",\n "description": "An NFT Marketplace",\n "author": "clarionnorth@gmail.com",\n "dependencies": {\n "@metamask/detect-provider": "^1.2.0",\n "@openzeppelin/contracts": "^4.3.1",\n "babel-polyfill": "6.26.0",\n "babel-preset-env": "1.7.0",\n "babel-preset-es2015": "6.24.1",\n "babel-preset-stage-2": "6.24.1",\n "babel-preset-stage-3": "6.24.1",\n "babel-register": "6.26.0",\n "bootstrap": "4.3.1",\n "chai": "4.2.0",\n "chai-as-promised": "7.1.1",\n "chai-bignumber": "3.0.0",\n "mdb-react-ui-kit": "^1.3.0",\n "mdb-ui-kit": "^3.9.0",\n "react": "16.8.4",\n "react-bootstrap": "1.0.0-beta.5",\n "react-dom": "16.8.4",\n "react-scripts": "2.1.3",\n "truffle": "5.0.5",\n "web3": "1.0.0-beta.55"\n },\n "scripts": {\n "start": "react-scripts …Run Code Online (Sandbox Code Playgroud) 如何将其导入到 TypeScript 文件中(不使用 require)
正确的语法是什么?
这些都不起作用:
import contract from "@truffle/contract";
import Contract from "@truffle/contract";
import TruffleContract from "@truffle/contract";
import { contract } from "@truffle/contract";
import { Contract } from "@truffle/contract";
import { TruffleContract } from "@truffle/contract";
import * as contract from "@truffle/contract";
import * as Contract from "@truffle/contract";
import * as TruffleContract from "@truffle/contract";
import * as alias from "@truffle/contract";
Run Code Online (Sandbox Code Playgroud)