Ejecuté lo siguiente:
➜ voting_truffle truffle migrate
Compiling ./contracts/Migrations.sol...
Compiling ./contracts/Voting.sol...
Compilation warnings encountered:
/Users/glaksmono/Documents/Blockchain Projects/voting_truffle/contracts/Migrations.sol:11:3: Warning: No visibility specified. Defaulting to "public".
function Migrations() {
^
Spanning multiple lines.
,/Users/glaksmono/Documents/Blockchain Projects/voting_truffle/contracts/Migrations.sol:15:3: Warning: No visibility specified. Defaulting to "public".
function setCompleted(uint completed) restricted {
^
Spanning multiple lines.
,/Users/glaksmono/Documents/Blockchain Projects/voting_truffle/contracts/Migrations.sol:19:3: Warning: No visibility specified. Defaulting to "public".
function upgrade(address new_address) restricted {
^
Spanning multiple lines.
Writing artifacts to ./build/contracts
Using network 'development'.
Running migration: 1_initial_migration.js
Deploying Migrations...
... undefined
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: authentication needed: password or unlock
at Object.InvalidResponse (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:43303:16)
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:331156:36
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:175492:11
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:314196:9
at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:315621:13)
at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:70159:18)
at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:70449:12)
at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:70604:12)
at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:70564:24)
at emitNone (events.js:111:20)
➜ voting_truffle
Tengo 2 archivos de migración: 1. migrations/1_initial_migration.js
2.migrations/2_deploy_contracts.js
El contenido de migrations/2_deploy_contracts.js
es el siguiente:
var Voting = artifacts.require("./Voting.sol");
module.exports = function(deployer) {
deployer.deploy(Voting, ['Rama', 'Nick', 'Jose'], {gas: 6700000});
};
/* As you can see above, the deployer expects the first argument to be the name of the contract followed by constructor arguments. In our case, there is only one argument which is an array of
candidates. The third argument is a hash where we specify the gas required to deploy our code. The gas amount varies depending on the size of your contract.
*/
Aquí está el estado de mi sincronización de blockchain de geth attach
:
> eth.syncing
{
currentBlock: 2179367,
highestBlock: 2179534,
knownStates: 5799770,
pulledStates: 5764000,
startingBlock: 0
}
>
He estado tratando de resolver esto durante días, y estoy atascado. ¿Algunas ideas?
Estoy tratando de seguir este tutorial y estoy atascado en la sección de migración.
Esta línea es tu problema -Error: authentication needed: password or unlock
Debe abrir la consola geth y escribir personal.unlockAccount("address", "password", 0)
para implementar los contratos para ropsten.
Lo dice en el tutorial en la sección 4 aquí:
mahesh@projectblockchain:~/voting$ truffle console
truffle(default)> web3.personal.newAccount('verystrongpassword')
'0x95a94979d86d9c32d1d2ab5ace2dcc8d1b446fa1'
truffle(default)> web3.eth.getBalance('0x95a94979d86d9c32d1d2ab5ace2dcc8d1b446fa1')
{ [String: '0'] s: 1, e: 0, c: [ 0 ] }
truffle(default)> web3.personal.unlockAccount('0x95a94979d86d9c32d1d2ab5ace2dcc8d1b446fa1', 'verystrongpassword', 15000)
// Replace 'verystrongpassword' with a good strong password.
// The account is locked by default, make sure to unlock it before using the account for deploying and interacting with the blockchain.
Tiene 1500, puse 0 como tercera variable. Eso indica la cantidad de tiempo que desea desbloquear la cuenta. Si pones 0 se desbloquea para toda la sesión.
0xgoku
truffle console
? No parece funcionar conmigo: gist.github.com/glaksmono/a260ca02cd741ad5d1e9f107c663e4ccMichael O´Rourke
INFO [08-06|08:06:14] IPC endpoint opened: <path>
. Una vez que obtenga esa ruta, escribageth attach ipc:<path>
. Eso debería abrir la consola. En esa consola escribepersonal.unlockAccount('0x60a9e63750adfafc77bd0ba692a20e4dbe330c24', 'pass', 0
.0xgoku
truffle migration
? No creo que puedas escribir eso en el archivogeth console
.Michael O´Rourke
truffle migrate --network ropsten
en la carpeta del proyecto como lo haría normalmente. Deberías tener 3 pestañas abiertas. Uno ejecutando geth, uno ejecutando geth console y otro para migrar los contratos0xgoku
truffle.js
: gist.github.com/glaksmono/f97543cf6da57fa4234f3445df977836 y ahora recibo este error: gist.github.com/glaksmono/e7dbbff3a31faae27f0eaefe587ac0e4Michael O´Rourke
0xgoku
0xgoku
truffle.js
: gist.github.com/glaksmono/40434ca612d9c9237676e82c561d0971 ¿ideas? También puedo ver algo cambiado en mi cuenta: ropsten.etherscan.io/address/…Michael O´Rourke
0xgoku
Michael O´Rourke
0xgoku
Michael O´Rourke
$ truffle console truffle(development)> web3.eth.getBlock("pending").gasLimit
Cambie la cantidad de gas en su archivo truffle.js a lo que obtiene.0xgoku
Michael O´Rourke
0xgoku
Michael O´Rourke
testrpc
oganache-cli
dependiendo de cuál tengas instalado. Si no tienes ninguno descargaganache-cli
0xgoku
testrpc
- no estoy realmente seguro de que no funcione enropsten
Michael O´Rourke
0xgoku