Coder Social home page Coder Social logo

gluwa / creditcoin-legacy-docker-compose-testnet Goto Github PK

View Code? Open in Web Editor NEW
3.0 6.0 5.0 182 KB

Everything you need to get started connecting to the Creditcoin Public Testnet environment

Home Page: https://creditcoin.org

License: GNU Lesser General Public License v3.0

blockchain creditcoin gluwa cryptocurrency credit p2p testnet cryptocurrencies docker-compose docker

creditcoin-legacy-docker-compose-testnet's Introduction

⚠️ The Sawtooth implementation of Creditcoin has been replaced by a Substate-based version. Please see https://medium.com/creditcoin-foundation and https://github.com/gluwa/creditcoin for more information.

Creditcoin Public Testnet

Introduction

Before Creditcoin launches on the livenet, we're giving you an opportunity to try it out on the Rinkeby Ethereum Test Network ("testnet"), which simulates Ethereum, or against your own Testnet Bitcoin node. This gives you a chance to get a better understanding of Creditcoin, and how it works, before real assets are involved.

Please note that ether, bitcoin and tokens on a testnet are easy to obtain, and do not carry any real-world value.

Preparation

Before you get started, there are a few things which you'll need to have:

1 Make sure you allow Docker to access the drive that the Creditcoin containers will be running on by opening Docker Desktop settings and checking the drive under the Shared Drives section. See https://docs.docker.com/docker-for-windows/#shared-drives for more information.
Screenshot of Shared Drives window in Docker Desktop

Configuration

Client Configuration

Client/clientConfig.json

{
  "signer": "<256_bit_key_secp256k1_ECDSA>",
  "creditcoinRestApiURL": "",
  "bitcoin": {
    "secret": "<bitcoin_private_key>",
    "rpc": "<bitcoin_rpc_node_url>",
    "credential": "<rpc_username:rpc_password>",
    "confirmationsCount": "1",
    "fee": "10000"
  },
  "ethereum": {
    "creditcoinContract": "<creditcoinContract>",
    "creditcoinContractAbi": "<creditcoinContractAbi>",
    "rpc": "<ethereum_node_url>",
    "confirmationsCount": "1",
    "secret": "<ethereum_private_key_no_0x>",
    "gasPriceInGwei":  "<set_to_override_gas_price>"
  },
  "ethless" : {
    "rpc": "<ethereum_node_url>"
  },
  "erc20": {
    "rpc": "<ethereum_node_url>"
  }
}
  • signer: Your 256 bit SECP256K1 ECDSA key
  • creditcoinRestApiURL: Leave blank
  • bitcoin - This section can be left blank if you do not intend to loan/fundraise Bitcoin
    • secret: Your bitcoin private key
    • rpc: Your bitcoin RPC node
    • credential: Your RPC credentials
    • confirmationsCount: This can be set to 1 for testnet purposes
    • fee: Bitcoin transaction fee (e.g. 10000)
  • ethereum - Must be completed with the values below for Public Testnet. Contract must be lowercase
    • creditcoinContract: 0x46356077cd7a793e4b7acf289c7c79dd783f4794
    • creditcoinContractAbi:
    [{'constant':false,'inputs':[{'name':'tokens','type':'uint256'},{'name':'sighash','type':'string'}],'name':'burn','outputs':[{'name':'success','type':'bool'}],'payable':false,'stateMutability':'nonpayable','type':'function'},{'constant':false,'inputs':[{'name':'tokens','type':'uint256'},{'name':'sighash','type':'string'}],'name':'exchange','outputs':[{'name':'success','type':'bool'}],'payable':false,'stateMutability':'nonpayable','type':'function'},{'anonymous':false,'inputs':[{'indexed':false,'name':'burner','type':'address'},{'indexed':false,'name':'amount','type':'uint256'},{'indexed':false,'name':'sighash','type':'string'}],'name':'Exchanged','type':'event'},{'anonymous':false,'inputs':[{'indexed':false,'name':'amount','type':'uint256'}],'name':'strLen','type':'event'},{'constant':true,'inputs':[{'name':'tokenOwner','type':'address'}],'name':'balanceOf','outputs':[{'name':'balance','type':'uint256'}],'payable':false,'stateMutability':'view','type':'function'}]
    
    • rpc: The Rinkeby Infura RPC testnet node (e.g. https://rinkeby.infura.io/xxxxxxxxxxxx) or your own personal testnet node (e.g. http://localhost:8545) that you set up during the Preparation step
    • confirmationsCount: This can be set to 1 for testnet purposes
    • secret: Your ethereum private key without the 0x prefix
    • gasPriceInGwei: Can be left blank unless you know what you're doing
  • ethless
  • erc20

Node and Gateway Configuration

Server/gatewayConfig.json

{
    "bindIP": "0.0.0.0",
    "bitcoin": {
        "rpc": "<bitcoin_rpc_node_url>",
        "credential": "<rpc_username:rpc_password>",
        "confirmationsCount": "1"
    },
    "ethereum": {
        "creditcoinContract": "<creditcoinContract>",
        "creditcoinContractAbi": "<creditcoinContractAbi>",
        "rpc": "<ethereum_node_url>",
        "confirmationsCount": "1"
    },
    "ethless" : {
        "rpc": "<ethereum_node_url>"
    },
    "erc20": {
        "rpc": "<ethereum_node_url>"
    }
}
  • bindIP: 0.0.0.0
  • bitcoin - This section can be left blank if you do not intend to loan/fundraise Bitcoin
    • rpc: Your bitcoin RPC node
    • credential: Your RPC credentials
    • confirmationsCount: 1
  • ethereum - Must be completed with the values below for Public Testnet. Contract must be lowercase
    • creditcoinContract: 0x46356077cd7a793e4b7acf289c7c79dd783f4794
    • creditcoinContractAbi:
    [{'constant':false,'inputs':[{'name':'tokens','type':'uint256'},{'name':'sighash','type':'string'}],'name':'burn','outputs':[{'name':'success','type':'bool'}],'payable':false,'stateMutability':'nonpayable','type':'function'},{'constant':false,'inputs':[{'name':'tokens','type':'uint256'},{'name':'sighash','type':'string'}],'name':'exchange','outputs':[{'name':'success','type':'bool'}],'payable':false,'stateMutability':'nonpayable','type':'function'},{'anonymous':false,'inputs':[{'indexed':false,'name':'burner','type':'address'},{'indexed':false,'name':'amount','type':'uint256'},{'indexed':false,'name':'sighash','type':'string'}],'name':'Exchanged','type':'event'},{'anonymous':false,'inputs':[{'indexed':false,'name':'amount','type':'uint256'}],'name':'strLen','type':'event'},{'constant':true,'inputs':[{'name':'tokenOwner','type':'address'}],'name':'balanceOf','outputs':[{'name':'balance','type':'uint256'}],'payable':false,'stateMutability':'view','type':'function'}]
    
    • rpc: The Rinkeby Infura RPC testnet node (e.g. https://rinkeby.infura.io/xxxxxxxxxxxx) or your own personal testnet node (e.g. http://localhost:8545) that you set up during the Preparation step
    • confirmationsCount: 1
  • ethless
  • erc20

Server/docker-compose.yaml

  • Replace "[insert.your.ip]" on line 55 with your external IP1
    --endpoint tcp://[insert.your.ip]:8800 \

1 Google 'My IP' to get this:
Image showing IP on Google Search results page

Connecting to the Creditcoin Public Testnet

Now that you've got Docker Desktop installed, and you've updated your Creditcoin configuration files, you're ready to start the Docker containers and get connected to the Creditcoin Public Testnet!

Run the Creditcoin Client

  1. Open a Command Prompt, Terminal or Bash window
  2. Browse to the folder containing the Client and Server folders (e.g. cd C:\Creditcoin)
  3. Type docker-compose -f Client/docker-compose.yaml up -d
  4. Access the Creditcoin Client bash using this command: docker exec -it creditcoin-client bash
  5. Get your sighash by typing ./ccclient sighash into the Creditcoin Client bash
    Example sighash returned by Creditcoin Client

Run the Creditcoin Node and Gateway

  1. Open a Command Prompt, Terminal or Bash window
  2. Browse to the folder containing the Client and Server folders (e.g. cd C:\Creditcoin)
  3. Type docker-compose -f Server/docker-compose.yaml up

Fund your account

Note: Before funding your account, you'll need some Ether in your Ethereum wallet. Go to https://faucet.rinkeby.io/ and follow the instructions to add Ether to your wallet using the Rinkeby Faucet.

In the Creditcoin Client window you opened above type the following commands, replacing 0xGLUWAisAWESOME11111111111111111111111111 with your Ethereum wallet address

  1. Use the Ethereum CollectCoins function to add ten Creditcoin (10000000000000000000 Credo) to your account:
    ./ccclient Ethereum CollectCoins 10000000000000000000
  2. Once you have some Credo, register your address with the testnet:
    ./ccclient creditcoin RegisterAddress ethereum 0xGLUWAisAWESOME11111111111111111111111111 rinkeby
  3. Now you can check the balance of your wallet:
    ./ccclient show Balance 0

Stop the Creditcoin Node and Gateway

  1. Open a Command Prompt, Terminal or Bash window
  2. Browse to the folder containing the Client and Server folders (e.g. cd C:\Creditcoin)
  3. Type docker-compose -f Server/docker-compose.yaml down

Stop the Creditcoin Client

  1. Open a Command Prompt, Terminal or Bash window
  2. Browse to the folder containing the Client and Server folders (e.g. cd C:\Creditcoin)
  3. Type docker-compose -f Client/docker-compose.yaml down

Troubleshooting

Recovering from an incorrectly formatted command

From time-to-time, the Creditcoin client may get ‘stuck’ on an improperly formatted command line. To recover from this run the command rm plugins/progress.txt, then retype the command correctly.

The purpose of progress.txt is to rerun an interrupted command. For example while waiting for sufficient confirmation on Ethereum network, a user can stop the Creditcoin Client, then later run the Creditcoin Client command (./ccclient) again without parameters. Here we're removing the invalid command to prevent it from automatically rerunning.

creditcoin-legacy-docker-compose-testnet's People

Contributors

colingluwa avatar wi-ry avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.