Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nucleo
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blockchain
nucleo
Commits
c92436a6
Commit
c92436a6
authored
6 years ago
by
Robert Martin-Legene
Browse files
Options
Downloads
Patches
Plain Diff
Simplified genesis creation to allow just a single node. Additional nodes are to be proposed.
parent
71100ee8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/libbfa.sh
+30
-33
30 additions, 33 deletions
bin/libbfa.sh
with
30 additions
and
33 deletions
bin/libbfa.sh
+
30
−
33
View file @
c92436a6
...
...
@@ -200,53 +200,50 @@ function prereq
test
$err
-eq
0
}
function
repeat
{
printf
--
"
$2
%0.s"
$(
seq
1
$1
)
}
function
gen_genesis
{
local
genesis
=
"
${
BFAHOME
}
/src/genesis.json"
test
-e
"
${
genesis
}
"
&&
return
SECONDS
=
$(
date
+%s
)
bfaconfig account
nodes
=
$account
#echo "** If you want extra nodes added, add them to nodes.remote.txt and run $0 again."
test
-r
"nodes.remote.txt"
&&
nodes
=
"
${
nodes
}
$(
cat
nodes.remote.txt
)
"
allocs
=
sealers
=
for
node
in
${
nodes
}
do
test
"
${
node
:0:2
}
"
=
"0x"
&&
node
=
${
node
:2
}
allocs
=
"
${
allocs
}
"
$(
printf
', "%s": { "balance": "%s" }'
\
$node
\
0x200000000000000000000000000000000000000000000000000000000000000
)
sealers
=
"
${
sealers
}${
node
}
"
done
# Get rid of leading comma-space
allocs
=
"
${
allocs
:2
}
"
local
zero4
=
"0000"
local
zero8
=
"
${
zero4
}${
zero4
}
"
local
zero16
=
"
${
zero8
}${
zero8
}
"
local
zero20
=
"
${
zero16
}${
zero4
}
"
local
zero32
=
"
${
zero16
}${
zero16
}
"
local
zero40
=
"
${
zero20
}${
zero20
}
"
local
zero60
=
"
${
zero40
}${
zero20
}
"
local
zero64
=
"
${
zero32
}${
zero32
}
"
local
zero128
=
"
${
zero64
}${
zero64
}
"
local
zero130
=
"
${
zero128
}
00"
local
nodes
=
$account
local
timestamp
=
$(
printf
'0x%08x'
$(
date
+%s
)
)
local
vanity_Blockchain
=
"426c6f636b636861696e"
local
vanity_Federal
=
"4665646572616c"
local
vanity_Argentina
=
"417267656e74696e61"
local
vanity_NIC
=
"4e4943"
local
vanity
=
"
${
vanity_Blockchain
}
20
${
vanity_Federal
}
20
${
vanity_Argentina
}
20
${
vanity_NIC
}
"
## Make sure vanity is exactly 64 characters
vanity
=
"
${
vanity
}${
zero64
}
"
vanity
=
"
${
vanity
:0:64
}
"
echo
-n
"
$vanity
"
|
grep
-Evq
'[^0-9a-fA-F]'
cat
<<-
EOCONF
>
${
genesis
}
{
"config": {
"chainId":
${
BFANETWORKID
}
,
"homesteadBlock": 0, "eip150Block": 0, "eip155Block": 0, "eip158Block": 0, "byzantiumBlock": 4,
"eip150Hash": "0x
0000000000000000000000000000000000000000000000000000000000000000
",
"eip150Hash": "0x
${
zero64
}
",
"clique": { "period": 15, "epoch": 30000 }
},
"nonce": "0x0000000000000000",
"timestamp": "
$(
printf
'0x%08x'
$SECONDS
)
",
"extraData": "0x426c6f636b636861696e204665646572616c20417267656e74696e61204e4943
${
sealers
}
$(
repeat 130 0
)
",
"gasLimit": "0xffeeddcc", "difficulty": "0x1", "number": "0x0", "gasUsed": "0x0",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"alloc": {
$allocs
}
"timestamp": "
${
timestamp
}
",
"extraData": "0x
${
vanity
}${
account
}${
zero130
}
",
"gasUsed": "0x0", "gasLimit": "0xffeeddcc", "difficulty": "0x1",
"number": "0x0",
"mixHash": "0x
${
zero64
}
",
"coinbase": "0x
${
zero40
}
",
"parentHash": "0x
${
zero64
}
",
"alloc": { "
${
account
}
": { "balance": "0x200
${
zero60
}
" } }
}
EOCONF
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment