基于token的投票系统笔记

问题一

truffle init 报错, truffle unbox webpack 安装报错
更新hosts文件
使用Google hosts 替换本地/etc/hosts文件
重启网络 sudo service network-manager restart

问题解决参考博客
错误使用git clone到当前文件夹,参考1参考2

run npm dev 出错,参考2方法,同时 npm install出错,使用cnpm install:
在这里插入图片描述
问题, 同源请求问题:
原因:可能是更改了hosts文件,重启了系统才恢复正常,
初始化正常,发送交易还是报同源错误

mao@ubuntu:~/Desktop/privateChain$ nohup geth --datadir . --networkid 15 --rpc --rpcaddr 127.0.0.1 --rpcport 8545 --rpcapi eth,personal,net,miner,txpool,db,web3 --allow-insecure-unlock --rpccorsdomain "*"  2>>output.log &
[2] 55273
mao@ubuntu:~/Desktop/privateChain$ geth attach http://localhost:8545
页面提交交易失败,matamask 显示 invalid sender

在这里插入图片描述原因:MetaMask配置私有网络时,没有设置chainId导致的,或者是chainId和以太坊节点的network不一致。

疑问:
  • matamask 的chainId 为 1337,居然和chainId,networkId 都是15的私有链连上,私有链账户发送以太币到matamask上,matamask也可以正确显示余额。???

猜你喜欢

转载自blog.csdn.net/mingrizhixin/article/details/113875148