openware / peatio

Open-source crypto currency exchange software (https://openware.com)
https://www.openware.com
MIT License
1.05k stars 624 forks source link

Latest Version Blockchains Using 'address' not 'addresses'. Bitcoin, Digibyte, Bitnet, many more. #3057

Closed TripleZen closed 10 months ago

TripleZen commented 10 months ago

Current setup for lib/peatio/bitcoin/blockchain.rb uses the key addresses

node output

"vout": [
        {
          "value": 0.00688454,
          "n": 0,
          "scriptPubKey": {
            "asm": "0 c18ba766a54357241de042c55e05ed6aff70fe45",
            "hex": "0014c18ba766a54357241de042c55e05ed6aff70fe45",
            "reqSigs": 1,
            "type": "witness_v0_keyhash",
            "addresses": [
              "bc1qcx96we49gdtjg80qgtz4up0ddtlhplj9uplxvg"
            ]
          }
        },

blockchain.rb

        entry['scriptPubKey'].has_key?('addresses')

Newer blockchains forked from latest Bitcoin use address

node output

"vout": [
        {
          "value": 0.00010000,
          "n": 0,
          "scriptPubKey": {
            "asm": "0 d1e821dccc70a57a78c9b000899e62d92c71d304",
            "hex": "0014d1e821dccc70a57a78c9b000899e62d92c71d304",
            "address": "dgb1q685zrhxvwzjh57xfkqqgn8nzmyk8r5cy00ff93",
            "type": "witness_v0_keyhash"
          }
        },

Changing from addresses to address in blockchain.rb doesn't seem to work entry['scriptPubKey'].has_key?('addresses') to entry['scriptPubKey'].has_key?('address') and all corresponding addresses. Trying other configurations also seemed to fail.

Other exchanges run these blockchains so the problem has been solved previously I would assume.