Skip to content
Snippets Groups Projects
Commit 229f6667 authored by Robert Martin-Legene's avatar Robert Martin-Legene
Browse files

Merge branch 'master' into dev

parents 6371c488 b5299f19
No related branches found
No related tags found
No related merge requests found
......@@ -20,8 +20,8 @@ Esta guía debería funcionar en Debian o sus derivados. Testeado en *Debian* y
Van a aparecer varios **warnings** mientras se instala web3. Esto parece ser "normal". Ignorarlo no parece causar problemas.
4. Cambiá al usuario `bfa`
- como root: `su - bfa`
5. Crea una cuenta (solamente nodos selladores y nodos transaccionales necesitan una cuenta)
- como bfa: `admin.sh account`
5. <del>Crea una cuenta (solamente los 20-30 nodos selladores necesitan una cuenta)
- como bfa: `admin.sh account`</del>
6. Comenzá la sincronización. **Esto puede llevar un rato largo** (este script se ejecuta automáticamente cuando se reinicia el sistema).
- como bfa: `start.sh`
7. `localstate.pl` muestra el estado actual del nodo.
......
#!/usr/bin/node
// 20201019 Robert Martin-Legene
/*
Copyright 2020 de la Dirección General de Sistemas Informáticos – Secretaría Legal y Técnica - Nación - Argentina.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/
*/
const Web3 = require( 'web3' );
const fs = require( 'fs' );
var web3 = new Web3();
function usage(exitvalue)
{
console.log("Usage: "+process.argv[1]+" sign <keyfilename> [<password>]");
console.log(" or: "+process.argv[1]+" recover <signature>");
console.log(" or: "+process.argv[1]+" --help");
process.exit(exitvalue);
}
if ( process.argv.length < 3 )
usage( 1 );
if ( process.argv[2] == '--help' )
usage( 0 );
if ( process.argv[2] == 'recover' )
{
if ( process.argv.length != 4 )
usage( 1 );
recover( process.argv[3] );
}
else
if ( process.argv[2] == 'sign' )
{
if ( process.argv.length < 4 || process.argv.length > 5 )
usage( 1 );
sign( process.argv[3], process.argv[4] || '');
}
else
usage( 1 );
function sign( filename, password )
{
var filecontents;
try {
filecontents = fs.readFileSync( filename, 'utf8' );
} catch {
console.error( "Unable to read the file containing the key." );
usage(1);
}
var jsonacct;
try {
jsonacct = JSON.parse( filecontents );
} catch {
console.error( "Unable to parse the contents of the key file." );
usage(1);
}
var account;
try {
account = web3.eth.accounts.decrypt( jsonacct, password );
} catch {
console.error( "Unable to unlock the account with the password specified." );
usage(1);
}
var signed = web3.eth.accounts.sign( "", account.privateKey );
var signature = signed.signature;
console.log( "The signature of the message is\n" + signature );
}
function recover( signature )
{
var acctsigner = web3.eth.accounts.recover( "", signature );
console.log( "The message was signed by\n" + acctsigner );
}
......@@ -4,7 +4,6 @@
# See if PATH is set up incorrectly (look for another install of this binary).
set -x
mypath=$( realpath $0 )
myname=${mypath##*/}
for p in ${PATH//:/ }
......@@ -17,16 +16,12 @@ do
continue
fi
# we found another one, yay!
exec ${checkfile} "$@"
evmvers=$( grep '^chain-evm-version=' ${BFAHOME:-/home/bfa/bfa}/lib/versions | head -1 )
exec ${checkfile} ${evmvers/*=/--evm-version=} --combined-json abi,asm,ast,bin,bin-runtime,compact-format,devdoc,generated-sources,generated-sources-runtime,hashes,interface,metadata,opcodes,srcmap,srcmap-runtime,storage-layout,userdoc "$@"
exit 1
fi
done
# not found .. tell to install it.
set +x
exec >&2
echo "***********************************"
echo "solc no esta instalado."
echo "Para instalarlo, usa installsolc.sh"
echo "***********************************"
# not found
echo "solc: command not found." >&2
exit 1
geth_tag=v1.8.27
solidity_tag=v0.5.0
chain-evm-version=byzantium
This diff is collapsed.
// Robert Martin-Legene <robert@nic.ar>
// vim:syntax:filetype=javascript:ai:sm
pragma solidity ^0.5;
// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright 2020 de la Direccion General de Sistemas Informaticos - Secretaria Legal y Tecnica - Nacion - Argentina.
//
// This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/
pragma solidity >0.7.0;
// This contract is supposed to maintain a list of accounts authorized
// to control members of "the club" using a majority (n/1+1). We call
......@@ -27,7 +37,7 @@ contract Majority {
event voteCast( address voter, address victim, bool promotion );
event adminChange( address admin, bool promotion );
constructor( uint timeout ) public
constructor( uint timeout )
{
if ( timeout >= 3600 )
votetimeout = timeout;
......@@ -70,7 +80,7 @@ contract Majority {
while ( ++idx < max )
votes[idx-1] = votes[idx];
// "pop" the end of the list, making the list shorter.
votes.length--;
votes.pop();
}
function _remove_council_member( address exmember ) private
......@@ -92,7 +102,7 @@ contract Majority {
while ( ++idx < max )
council[idx-1] = council[idx];
// "pop" the end of the list, making the list shorter.
council.length--;
council.pop();
return;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment