0

I made changes on the ready blockchain network. I am using the following code to start the system python3 full_node.py --port=8001 --node=127.0.0.1:8000 --mine=1 but whenever I enter this code the wallet address changes every time I open and close the terminal. I added a place called wall in addition to the codes. The code was like this.

import argparse
    parser = argparse.ArgumentParser(description='Blockchain full node.')
    parser.add_argument('--node', type=str, help='Address of node to connect. If not will init fist node.')
    parser.add_argument('--port', required=True, type=int, help='Port on which run the node.')
    parser.add_argument('--mine', required=False, type=bool, help='Port on which run the node.')
    parser.add_argument('--diff', required=False, type=int, help='Difficulty')
    parser.add_argument('--wall', required=False, type=str, help='wallet address')

    args = parser.parse_args()
    _DB = DB()
    _DB.config['difficulty']
    _W = Wallet.create()
    _BC = Blockchain(_DB, _W)
    _API = API(_BC)
    logger.info(' ####### Server Address: %s ########' %_W.address)

    app.config['db'] = _DB
    app.config['wallet'] = args.wall
    app.config['bc'] = _BC
    app.config['api'] = _API
    app.config['port'] = args.port
    app.config['host'] = '127.0.0.1'
    app.config['nodes'] = set([args.node]) if args.node else set(['127.0.0.1:%s' % args.port])
    app.config['sync_running'] = False
    app.config['mine'] = args.mine

before i changed the code it was like this

import argparse
    parser = argparse.ArgumentParser(description='Blockchain full node.')
    parser.add_argument('--node', type=str, help='Address of node to connect. If not will init fist node.')
    parser.add_argument('--port', required=True, type=int, help='Port on which run the node.')
    parser.add_argument('--mine', required=False, type=bool, help='Port on which run the node.')
    parser.add_argument('--diff', required=False, type=int, help='Difficulty')

    args = parser.parse_args()
    _DB = DB()
    _DB.config['difficulty']
    _W = Wallet.create()
    _BC = Blockchain(_DB, _W)
    _API = API(_BC)
    logger.info(' ####### Sunucu Adresi: %s ########' %_W.address)

    app.config['db'] = _DB
    app.config['wallet'] = _W
    app.config['bc'] = _BC
    app.config['api'] = _API
    app.config['port'] = args.port  
    app.config['host'] = '127.0.0.1'
    app.config['nodes'] = set([args.node]) if args.node else set(['127.0.0.1:%s' % args.port])
    app.config['sync_running'] = False
    app.config['mine'] = args.mine

I want to be able to place a single wallet address in the code I want. sticking to only 1 wallet every time I start the terminal. The error is either in this code above or here.

@classmethod
    def create(cls):
        inst = cls(b'',b'')
        _pub, _priv = rsa.newkeys(512)
        inst._pub = Address(_pub)
        inst._priv = _priv
        return inst

thanks to everyone who helped in advance.

  • Post the traceback which shows where the error is. – tdelaney Jul 07 '21 at 22:47
  • Also, fix in indentation so that we can copy/paste to test without doing it ourselves. – tdelaney Jul 07 '21 at 22:49
  • indentation ??? – VUENİXX Jul 07 '21 at 23:07
  • @VUENİXX Why is everything except `import argparse` indented? Python requires consistent indentation. – Barmar Jul 07 '21 at 23:10
  • @Barmar this is just the part of the code that gives an error. I just bought it here because the code in the same file is a bit long. – VUENİXX Jul 08 '21 at 07:43
  • What does that have to do with posting incorrect indentation? Is this part of the code in a function, but you left out the `def` line? – Barmar Jul 08 '21 at 14:17
  • Anyway, the error has nothing to do with blockchain. It means that you have a string literal with a line break in it. The error traceback should point you to the problem line. – Barmar Jul 08 '21 at 14:21

0 Answers0