Code Monkey home page Code Monkey logo

trakelchain's Introduction

趣快出行

此项目为趣快出行区块链后台,用户下载、部署后可试用趣快出行后台。

系统要求

  1. 目前仅支持Linux
  2. Go语言环境

安装部署

  1. 执行以下命令下载trakelchain:
    git clone https://github.com/trakel-project/trakelchain.git

  2. 执行以下命令运行四个节点的Trakelchain:
    ./start.sh

  3. 如果想手动起四个节点并监控状态,打开四个终端窗口,分别运行:

./trakelchain -o 1 -l 8001 -t 8081 //run this on first node
./trakelchain -o 2 -l 8002 -t 8082 //run this on second node
./trakelchain -o 3 -l 8003 -t 8083 //run this on third node
./trakelchain -o 4 -l 8004 -t 8084 //run this on fourth node

接口说明

区块链接口

调用invoke接口调用智能合约函数,然后调用getTransactionReceipt获取返回值。
JSON-RPC调用方法说明:

调用合约

方法 参数 返回值
contract_invokeContract {from: <string> 合约调用者地址。to: <string> 合约地址。payload:<string> 方法名和方法参数经过编码后的input字节码。signature: <string> 交易签名timestamp: <number> 交易时间戳(单位ns)。} transactionHash: 交易的哈希值,32字节的十六进制字符串

说明:to合约地址需要在部署完合约以后,调用tx_getTransactionReceipt方法来获取。

Example:
Request
curl -X POST --data '{"jsonrpc":"2.0","method":" contract_invokeContract ","params": [{ "from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155", "to":"0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331", "payload": "0xcdcd77c000000000000000000000000000000000000000000000000000000000000000450000000000000000000000000000000000000000000000000000000000000001", "timestamp": 1477459062327000000, " signature ": "your signature" }],"id":71}'

Result
{ "id":71, "jsonrpc": "2.0", "result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331" }

获取函数调用返回值

方法 参数 返回值
tx_getTransactionReceipt transactionHash: 交易hash。 {postState: 交易状态。contractAddress: 合约地址。ret: 执行的结果。}

Example:
Request
curl -X POST --data '{"jsonrpc": "2.0", "method": "tx_getTransactionReceipt", "params": ["0xb60e8dd61c5d32be8058bb8eb970870f07233155"], "id": 71}'

Result
{"id":71,"jsonrpc": "2.0","result": {" postState ": ‘1’" contractAddress ": ‘0xe04d296d2460cfb8472af2c5fd05b5a214109c25688d3704aed5484f’" ret ": “0x606060405260e060020a60003504633ad14af381146030578063569c5f6d146056578063d09de08a14606d575b6002565b346002576000805460043563ffffffff8216016024350163ffffffff199091161790555b005b3460025760005463ffffffff166060908152602090f35b3460025760546000805463ffffffff19811663ffffffff90911660010117905556”}}

智能合约接口

请参见API.sol
合约地址:0x80c3fbdee14edd3cc1c3f8941f4d486d0b3552c5
注意:部分函数只有合约部署者才能调用,部署者信息:
地址:0x2cd84f9e3c182c5c543571ea00611c41009c7024
私钥:0x437cace9ccb62f0e3e5bd71d2793aa8ac4a0e9d42262028e4a4dc7797d060dff

trakelchain's People

Watchers

James Cloos avatar rayxie 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.