Coder Social home page Coder Social logo

libraries's Introduction

CoinSpark libraries 1.0 README - coinspark.org


ABOUT
-----
The CoinSpark libraries help you integrate support for the CoinSpark protocol into
your wallet, or any other tool or service.

The libraries are available in 5 languages:

* C/C++
* Java
* Javascript
* PHP
* Python (not yet available - scheduled October 2014)

The libraries for each language are functionally identical, and use as similar
calling conventions as possible, given the constraints imposed by each language. 

For more information and code examples: http://coinspark.org/developers/


HOW TO TEST
-----------
The libraries include extensive tests to verify that it behaves identically for
all inputs, for all languages. We encourage you to run these tests for yourself
by following the steps below. Explicit command line instructions are provided
for Unix-based systems.

* Download all the library files to your computer.

* In your Terminal, navigate to the directory containing those files

* Compile the C library tests:

gcc -o c/coinspark-test c/*.c -lm

* Run the executable:

c/coinspark-test

* Keep pressing return to accept all default options displayed.

* If no error is shown, the library has passed all internal C tests.

* Navigate to the directory containing the test files

cd CoinSpark-Tests-*

* For each '...-Input.txt' file, run the PHP test on that input:

php ../php/coinspark-test.php Address-Input.txt > Address-Output-PHP.txt
php ../php/coinspark-test.php AssetRef-Input.txt > AssetRef-Output-PHP.txt
php ../php/coinspark-test.php Script-Input.txt > Script-Output-PHP.txt
php ../php/coinspark-test.php Hash-Input.txt > Hash-Output-PHP.txt
php ../php/coinspark-test.php Genesis-Input.txt > Genesis-Output-PHP.txt
php ../php/coinspark-test.php Transfer-Input.txt > Transfer-Output-PHP.txt

* Now check the corresponding PHP and C output files for differences

diff Address-Output-C.txt Address-Output-PHP.txt
diff AssetRef-Output-C.txt AssetRef-Output-PHP.txt
diff Script-Output-C.txt Script-Output-PHP.txt
diff Hash-Output-C.txt Hash-Output-PHP.txt
diff Genesis-Output-C.txt Genesis-Output-PHP.txt
diff Transfer-Output-C.txt Transfer-Output-PHP.txt

* If no differences were reported, the library has passed the C-PHP consistency test.

* Feel free to look inside the input and output files to see what is going on.

* Python tests run similarly to PHP. First, create Python outputs:

python ../python/coinspark-test.py Address-Input.txt > Address-Output-Python.txt
python ../python/coinspark-test.py AssetRef-Input.txt > AssetRef-Output-Python.txt
python ../python/coinspark-test.py Script-Input.txt > Script-Output-Python.txt
python ../python/coinspark-test.py Hash-Input.txt > Hash-Output-Python.txt
python ../python/coinspark-test.py Genesis-Input.txt > Genesis-Output-Python.txt
python ../python/coinspark-test.py Transfer-Input.txt > Transfer-Output-Python.txt

* Now check the corresponding Python and C output files for differencess

diff Address-Output-C.txt Address-Output-Python.txt
diff AssetRef-Output-C.txt AssetRef-Output-Python.txt
diff Script-Output-C.txt Script-Output-Python.txt
diff Hash-Output-C.txt Hash-Output-Python.txt
diff Genesis-Output-C.txt Genesis-Output-Python.txt
diff Transfer-Output-C.txt Transfer-Output-Python.txt

* If no differences were reported, the library has passed the C-Python consistency test.

* Java tests begin by compiling the Java classes:

javac ../java/org/coinspark/protocol/*.java

* Now run the CoinSparkTest class and keep pressing return to accept all the default options:

java -classpath ../java/ org.coinspark.protocol.CoinSparkTest

* Now check the corresponding Java and C output files for differencess

diff Address-Output-C.txt Address-Output-Java.txt
diff AssetRef-Output-C.txt AssetRef-Output-Java.txt
diff Script-Output-C.txt Script-Output-Java.txt
diff Hash-Output-C.txt Hash-Output-Java.txt
diff Genesis-Output-C.txt Genesis-Output-Java.txt
diff Transfer-Output-C.txt Transfer-Output-Java.txt

* If no differences were reported, the library has passed the C-Java consistency test.

* Remove compiled classes

rm ../java/org/coinspark/protocol/*.class

* For the Javascript tests, you will need to open javascript/coinspark-test.html
in your web browser. Then for each '...-Input.txt' file generated by C, paste
the contents of that file into the left-hand field of the web page, then click
the arrow button at the top. Once Javascript has finished executing, the content
in the right-hand side of the page can be compared against the appropriate
'...-Output-C.txt' file, and should be identical.



LICENSE (MIT)
-------------

Copyright (c) 2014 Coin Sciences Ltd

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

libraries's People

Contributors

gidgreen avatar

Watchers

 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.