Funding an address at the genesis block

#1

Hello,

I have been trying to fund an address with stacks at the genesis block on my own testnet. The genesis block python module I wrote is:
GENESIS_BLOCK_STAGES = [

   {
       "history": {},
       "rows": [
           {
               "address": "mkCFnU35VmwKKyGrJiXvuWQZ2ukQK7AuGh",
               "type": "STACKS",
               "value": 9999999,
               "vesting": {},
               "vesting_total": 0
           }]
   }]
GENESIS_BLOCK = GENESIS_BLOCK_STAGES[-1]

The blockstack-core is launching, but when I curl http://localhost:16268/v1/accounts/STSMYMTHAW08HMCCW1Z7EGMZJHW86P3TPBYS3ZZT/balance it returns balance: 0.

#2

Hi @i95der,

Did you pass your genesis block module as an argument to blockstack-core? You need to start it like this:

blockstack-core --debug start --genesis_block /PATH/TO/YOUR/GENESIS_BLOCK.py`
#3

yes I did

#4

This is the command and the output:
BLOCKSTACK_TEST=1 blockstack-core start --genesis_block "mygenesis.py"

[2019-07-04 00:37:06,124] [DEBUG] [spv:104] (21213.140305235912448) Using mainnet
[2019-07-04 00:37:06,128] [WARNING] [config:145] (21213.140305235912448) (21213): in test environment
[2019-07-04 00:37:06,128] [WARNING] [config:166] (21213.140305235912448) NUM_CONFIRMATIONS = 0

[2019-07-04 00:37:06,346] [DEBUG] [blockstackd:2874] (21213.140305235912448) Stripped argv: /home/ece/Documents/EVERYTHING-BLOCKSTACK/testing-june/bin/blockstack-core start --genesis_block mygenesis.py
[2019-07-04 00:37:06,346] [DEBUG] [blockstackd:2725] (21213.140305235912448) Working dir: /home/ece/.blockstack-server
[2019-07-04 00:37:06,346] [DEBUG] [config:1885] (21213.140305235912448) Load config from ‘/home/ece/.blockstack-server/blockstack-server.ini’
[2019-07-04 00:37:06,347] [DEBUG] [config:1635] (21213.140305235912448) Using configuration-given Atlas hostname
[2019-07-04 00:37:06,348] [INFO] [config:1644] (21213.140305235912448) Atlas IP address is (localhost, 16264)
[2019-07-04 00:37:06,351] [DEBUG] [blockstackd:2733] (21213.140305235912448) config
{
“bitcoind”: {
“bitcoind_p2p_port”: 18444,
“bitcoind_passwd”: “blockstacksystem”,
“bitcoind_port”: 18332,
“bitcoind_regtest”: true,
“bitcoind_server”: “localhost”,
“bitcoind_spv_path”: “/home/ece/Documents/tmp/.virtualchain-spv-headers.dat”,
“bitcoind_user”: “blockstack”
},
“blockstack”: {
“announcers”: “judecn.id,muneeb.id,shea256.id”,
“atlas”: true,
“atlas_blacklist”: “”,
“atlas_hostname”: “localhost”,
“atlas_port”: 16264,
“atlas_seeds”: “”,
“atlasdb_path”: “/home/ece/Documents/tmp/atlas.db”,
“backup_frequency”: 1,
“backup_max_age”: 30,
“enabled”: true,
“rpc_port”: 16264,
“server_version”: “20.0.9.0”,
“subdomaindb_path”: “/home/ece/Documents/tmp/subdomains.db”,
“zonefiles”: “/home/ece/Documents/tmp/zonefiles”
},
“blockstack-api”: {
“api_host”: “localhost”,
“api_port”: 16268,
“enabled”: true,
“indexer_url”: “http://localhost:16264
}
}
[2019-07-04 00:37:06,361] [INFO] [blockstackd:3248] (21213.140305235912448) Using alternative genesis block mygenesis.py
[2019-07-04 00:37:06,361] [DEBUG] [blockstackd:2444] (21213.140305235912448) Load genesis block from mygenesis.py

genesis block
{
“history”: [],
“rows”: [
{
“address”: “mp6fNSi5cCgJXSeMLBBvyXp5zvER61sgJa”,
“type”: “STACKS”,
“value”: 100000000000,
“vesting”: {},
“vesting_total”: 0
}
]
}

[2019-07-04 00:37:06,362] [DEBUG] [blockstackd:2476] (21213.140305235912448) Genesis block has 1 stages
[2019-07-04 00:37:06,362] [DEBUG] [blockstackd:2478] (21213.140305235912448) Stage 1 has 1 row(s)
[2019-07-04 00:37:06,362] [DEBUG] [blockstackd:3301] (21213.140305235912448) No expected snapshots given
[2019-07-04 00:37:06,363] [INFO] [blockstackd:3312] (21213.140305235912448) Starting blockstackd server (working_dir = ‘/home/ece/.blockstack-server’) …
[2019-07-04 00:37:07,421] [DEBUG] [util:452] (21213.140305235912448) Still waiting on 21215
[2019-07-04 00:37:08,423] [DEBUG] [util:452] (21213.140305235912448) Still waiting on 21215
[2019-07-04 00:37:09,424] [DEBUG] [util:452] (21213.140305235912448) Still waiting on 21215
[2019-07-04 00:37:09,425] [DEBUG] [blockstackd:2666] (21213.140305235912448) Running in the background as PID 21215

#6

In the logfile /home/ece/Documents/tmp/blockstack-server.log, you don’t happen to see any lines that look like Grant 100000000000 to mp6fNSi5cCgJXSeMLBBvyXp5zvER61sgJa, do you?

#7

I cannot find the log file it’s weird, in the debug output I posted above it shows: /home/ece/.blockstack-server as the working dir. And the log file there belongs not to this instance of blockstack-core (it’s old and it’s to my blockstack-core on the mainnet).
I am working from my virtualenv where I have installed blockstack core and when I do which blockstack-core it gives me the path to the blockstack-core inside the venv. I cannot find it’s log file.

#8

Where should the blockstack log file be if the blockstack-core is installed in a virtual env?

#9

Virtualenv or no, it should always be in ~/.blockstack-server/blockstack-server.log unless you passed --working_dir to override it. Please let me know if it isn’t.

#10

Oh yes it’s there! just way down concatenated even with the mainnet logs.

I do not see a Grant statement in the log file.

#11

Output of blockstack-core to the console:
Using alternative genesis block mygenesis.py
[2019-07-08 19:21:17,543] [DEBUG] [blockstackd:2444] (11695.140469641250560) Load genesis block from mygenesis.py

genesis block
{
"history": [], 
"rows": [
    {
        "address": "mwEDXZc9wtkCJbbe7HQKLmNUCSW4TnxNE3", 
        "type": "STACKS", 
        "value": 100000000000, 
        "vesting": {}, 
        "vesting_total": 0
    }
]
}

[2019-07-08 19:21:17,544] [DEBUG] [blockstackd:2476] (11695.140469641250560) Genesis block has 1 stages
[2019-07-08 19:21:17,544] [DEBUG] [blockstackd:2478] (11695.140469641250560) Stage 1 has 1 row(s)
[2019-07-08 19:21:17,544] [DEBUG] [blockstackd:3301] (11695.140469641250560) No expected snapshots given
[2019-07-08 19:21:17,545] [INFO] [blockstackd:3312] (11695.140469641250560) Starting blockstackd server

Beginning of blockstack-server.log:

[2019-07-08 19:21:19,829] [DEBUG] [namedb:91] (11695.140469641250560) Connect to database '/home/ece/Documents/tmp/blockstack-server.db'
[2019-07-08 19:21:19,832] [DEBUG] [indexer:314] (11695.140469641250560) Setup chain state in /home/ece/Documents/tmp[2019-07-08 19:21:19,863] [DEBUG] [indexer:370] (11695.140469641250560) CHAINSTATE: INSERT INTO snapshots (block_id,consensus_hash,ops_hash,timestamp) VALUES ( 373597, '17ac43c1d8549c3181b200f1bf97eb7d', None, 1562602879); ''
[2019-07-08 19:21:19,880] [DEBUG] [indexer:370] (11695.140469641250560) CHAINSTATE: INSERT INTO snapshots (block_id,consensus_hash,ops_hash,timestamp) VALUES ( 373598, '17ac43c1d8549c3181b200f1bf97eb7d', None, 1562602879); ''
[2019-07-08 19:21:19,889] [DEBUG] [indexer:370] (11695.140469641250560) CHAINSTATE: INSERT INTO snapshots (block_id,consensus_hash,ops_hash,timestamp) VALUES ( 373599, '17ac43c1d8549c3181b200f1bf97eb7d', None, 1562602879); ''
[2019-07-08 19:21:19,899] [DEBUG] [indexer:370] (11695.140469641250560) CHAINSTATE: INSERT INTO snapshots (block_id,consensus_hash,ops_hash,timestamp) VALUES ( 373600, '17ac43c1d8549c3181b200f1bf97eb7d', None, 1562602879); ''
[2019-07-08 19:21:19,909] [DEBUG] [namedb:91] (11695.140469641250560) Connect to database '/home/ece/Documents/tmp/blockstack-server.db'
[2019-07-08 19:21:19,912] [DEBUG] [atlas:1308] (11695.140469641250560) Initializing Atlas DB at /home/ece/Documents/tmp/atlas.db
[2019-07-08 19:21:19,940] [DEBUG] [atlas:1319] (11695.140469641250560) Queuing all zonefiles
[2019-07-08 19:21:19,940] [DEBUG] [atlas:988] (11695.140469641250560) Queued 0 zonefiles from 373601-373600
[2019-07-08 19:21:19,940] [DEBUG] [atlas:1322] (11695.140469641250560) Adding seed peers
[2019-07-08 19:21:19,941] [DEBUG] [atlas:1329] (11695.140469641250560) peer_table: []