wavesplatform / Waves

⛓️ Reference Waves Blockchain Node (client) implementation on Scala
https://wavesplatform.com/
MIT License
1.17k stars 417 forks source link

How can I run my own network? #1816

Closed theahmadzadeh closed 5 years ago

theahmadzadeh commented 5 years ago

I wanna run my own blockchain network with waves node application for our companies internal use. I have studied the documentation provided in here and here. But I'm still facing a bit of problem; I am confused about what network configuration i should use in (e.g wavesplus-devnet.conf) for ports and bind address in network, matcher and rest api. also I don't know what to change in application.conf file in main/resources. Consider that I want to reduce key-block-interval to 10s and microblock-interval to 1s. I have noticed I should use genesis.it.conf and create a genesis block then put the output in conf file and run the devnet.conf file. How can other employees become a node in this network? afterwards how to use api to develope the rewarding app on this blockchain? will it be accessible through node's public ip address?

Sorry to ask so many questions! It's just so long since I'm trying to do this and I'm running out of time :|

theahmadzadeh commented 5 years ago

And what is api-key-hash in wavesplus-devnet.conf?

vv12131415 commented 5 years ago

api-key-hash is the hash that you can get from here https://docs.wavesplatform.com/en/development-and-api/waves-node-rest-api/utils.html#section-56df3285daad4ea8cfeadbedffca4252

KardanovIR commented 5 years ago

May be you can use this repo to run a private blockchain? I think it is as easiest way to run private chain https://github.com/wavesplatform/dev-toolkit

danielrangelsa commented 5 years ago

Hi, so.. many issues.. I will try to answer each item and ask you some questions. What is your OS? Have you installed these items? (Git [to clone the repository ], Java 8 [to run the application] and sbt [to generate a genesis]) In order to be able to help you, I need to know where you are wrong. And for that, I need you to show me the procedures you are executing.

First of all, you need to write a valid configuration file, according to its guidelines (10s for key-block-interval and 1s for microblock-interval)

I was able to create my own network after a long time of work (the documentation did not help me) and I can help you get where you need it. Answer my questions and I'll help you as soon as I can.

theahmadzadeh commented 5 years ago

Thank you all guys!
One more thing left is that our nodes don't work independently! What I mean is when I run a node on an other server it only keeps downloading(appending) blocks generated by our known-peers! What shall i do about it??

theahmadzadeh commented 5 years ago

Update: according to logs block mining doesn't happen because: "Not scheduling block mining because Balance 0 of 3FUW5wm3GDiMKB1n6ytaG8ZyPCpPPkuPhY4 is lower than required for generation" but in the swagger api I can see there is 70K coins in this address with 0 confirmations!

alexeykiselev commented 5 years ago

Please, check the /addresses/balance/details/{your-address} API, pay attention to effective or generating values of the response. There is a rule that the money moved to an account can be used for generation only after 1000 blocks passed since the transaction. So, I think, that you have to start the generation with one of the genesis accounts. And only after 1k of blocks you can start generate with the accounts you moved money to.

theahmadzadeh commented 5 years ago

Thanks @alexeykiselev Solved the main issue; but why the confirmations are still 0 ? I have 2 nodes so shouldn't it normally get at least 1 confirmation.

theahmadzadeh commented 5 years ago

[update] Here are the logs: [miner-pool-41] c.n.mining.MinerImpl - Adding 0 unconfirmed transaction(s) to new block

Could not append Block(38TskdrVRJ2vmTV1VmRD8zUT43aCxsmZa5ipSjB7hPParzs8SMiZMv1Kx3Kzwb1xaWsQfVqL8khMSUJ8SFNJaTek -> 5Ebfv6M..., txs=0, features=Set()): BlockAppendError(Block is not a child of the last block,Block(38TskdrVRJ2vmTV1VmRD8zUT43aCxsmZa5ipSjB7hPParzs8SMiZMv1Kx3Kzwb1xaWsQfVqL8khMSUJ8SFNJaTek -> 5Ebfv6M..., txs=0, features=Set()))

c.n.s.BlockchainUpdaterImpl - MicroBlock(4Neh3ee... -> 4vmTRpr..., txs=4) appended

theahmadzadeh commented 5 years ago

Is There possible for nodes to not be synced exactly?! My first node is on height 21432 While the second one is on 21435!

alexeykiselev commented 5 years ago

This is ok, the short forks are possible. The node that mined a block broadcasts it to all peers, so in the log you see the attempt to append that block to the fork that node builds at the time. The possibility of such forks a higher in case of equal balances on the mining nodes.

theahmadzadeh commented 5 years ago

It suddenly started over this morning!! Current height: 7543 How is this possible?? The transactions are gone for good!!

theahmadzadeh commented 5 years ago

My Transactions keep skipping from a block to another!

When I check for a transaction info by id it's height changes to most recent block on every refresh! What's the problem?

Karasiq commented 5 years ago

You block intervals are too short, nodes don't have enough time to sync https://github.com/wavesplatform/Waves/issues/1911

Vlad71 commented 5 years ago

Hi, so.. many issues.. I will try to answer each item and ask you some questions. What is your OS? Have you installed these items? (Git [to clone the repository ], Java 8 [to run the application] and sbt [to generate a genesis]) In order to be able to help you, I need to know where you are wrong. And for that, I need you to show me the procedures you are executing.

First of all, you need to write a valid configuration file, according to its guidelines (10s for key-block-interval and 1s for microblock-interval)

I was able to create my own network after a long time of work (the documentation did not help me) and I can help you get where you need it. Answer my questions and I'll help you as soon as I can.

Hello! Can you help me to create my private network? I don`t sure that my configuration file is correct, Can you share the valid configuration file for example? Thanks!

danielrangelsa commented 5 years ago
waves
{
  # data storage folder
  directory=/tmp/custom

  logging-level = DEBUG

  blockchain
  {
    type: CUSTOM
    custom
    {
      address-scheme-character: "L"
      # various parameters of network consensus
      functionality {
        feature-check-blocks-period = 30
        blocks-for-feature-activation = 25
        allow-temporary-negative-until: 0
        allow-invalid-payment-transactions-by-timestamp: 0
        require-sorted-transactions-after: 0
        generation-balance-depth-from-50-to-1000-after-height: 0
        minimal-generating-balance-after: 0
        allow-transactions-from-future-until: 0
        allow-unissued-assets-until: 0
        require-payment-unique-id-after: 0
        allow-invalid-reissue-in-same-block-until-timestamp: 0
        allow-multiple-lease-cancel-transaction-until-timestamp: 0
        reset-effective-balances-at-height: 1
        allow-leased-balance-transfer-until: 0
        block-version-3-after: 0
        pre-activated-features = {
          2 = 0
        }
        double-features-periods-after-height = 1000000000
      }
      genesis
      {
        average-block-delay: 60s
        initial-base-target: 153722867
        timestamp: 1500635421931
        block-timestamp: 1500635421931
        signature: "PUT-SIGNATURE-HERE"
        initial-balance: 10000000000000000
        transactions = [{recipient: "RECIPIENT-HASH-HERE", amount: 10000000000000}]
      }
    }
  }

  network
  {
    known-peers = [
      "PEER1-IP-OR-FQDN:6868"
      "PEER2-IP-OR-FQDN:6868"
    ]

    bind-address = "0.0.0.0"
    port = 6860
    known-peers = []
    node-name = "L custom node 1"
    declared-address = "YOU-NODE-IP-OR-FQDN:6860"
  }

  wallet
  {
    password = "WALLET-PASSWORD"
    seed = "SEED"
  }

  rest-api
  {
    enable = yes
    bind-address = "0.0.0.0"
    port = 6861
    api-key-hash = "API-KEY-REST"
  }

  miner
  {
    interval-after-last-block-then-generation-is-allowed = 999d
    quorum = 0
  }
}
danielrangelsa commented 5 years ago

You need generate a genesis block before..

Vlad71 commented 5 years ago

Thank you! But I caught the next problem and don`t know what do I need to tune in the config file. There is the problem: "Could not append Block(3AQJgjF98Yk6orktnb9qzEfqFX3UeyTAxfiU9saZXA2zNJs8UAcij5RV2y2SPUH6cFGPSyHwXpwawNSWMCbkLCPd -> 3ExffMY..., txs=0, features=Set()): BlockAppendError(Block is not a child of the last block,Block(3AQJgjF98Yk6orktnb9qzEfqFX3UeyTAxfiU9saZXA2zNJs8UAcij5RV2y2SPUH6cFGPSyHwXpwawNSWMCbkLCPd -> 3ExffMY..., txs=0, features=Set()))"

P.S. I am creating private network of Vostok platform, I think the one is closely similar to the Waves platform.