summercash-wallet-server

command module
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2019 License: LGPL-3.0 Imports: 20 Imported by: 0

README

SummerCash Wallet Server

The golang react-summercash webserver and backend.

Installation

go install github.com/SummerCash/summercash-wallet-server

Usage

Starting the webserver:

summercash-wallet-server

or

go run main.go
Serving Content

To serve static content with summercash-wallet-server, simply copy all necessary content into a content/ folder in the summercash-wallet-server root (or specify via the --content-dir flag).

APIs

URI Name Description
https://localhost:443/api/accounts Accounts API An API for creating, managing, and fetching SummerCash account details.
https://localhost:443/api/transactions Transactions API An API for creating, signing, and publishing transactions on the SummerCash network.
Accounts
Creating a New Account With an Existing Address (pseudo-code)
request := {
    "address": "your_existing_address",
} // Replace value with your SummerCash address

http.Post("https://localhost:443/api/accounts/username", request) // Replace 'username' in '/username' with the desired username

Responds with:

{
    "name": "username",
    "password_hash": "387fud8739d7faef=",
    "address": "0x123456",
}
Creating a New Account
request := {} // Empty request so summercash-wallet-server generates a new address for us

http.Post("https://localhost:443/api/accounts/username", request) // Replace 'username' in '/username' with the desired username

Responds with:

{
    "name": "username",
    "password_hash": "387fud8739d7faef=",
    "address": "0x123456",
}
Updating an Account's Password
request := {
    "old_password": "old_password", // Replace with the account's current password
    "new_password": "new_password", // Replace with the desired new password
}

http.Put("https://localhost:443/api/accounts/username", request) // Replace 'username' in '/username' with the desired username

Responds with:

{
    "name": "username",
    "password_hash": "updated_hash",
    "address": "0x123456",
}
Fetching Account Details
request := {} // Empty request

http.Get("https://localhost:443/api/accounts/username", request) // Replace 'username' in '/username' with the desired username

Responds with:

{
    "name": "username",
    "password_hash": "387fud8739d7faef=",
    "address": "0x123456",
}
Transactions
Creating, Signing, and Publishing a New Transaction (pseudo-code)
request := {
    "username": "sender_username", // Replace with username of wallet to send from
    "password": "account_password", // Password of account to send from
    "recipient": "recipient_username_or_address", // Replace with recipient username or address
    "amount": 0, // Replace with amount to send w/tx
    "payload": "message_to_send_with_tx", // Replace w/transaction payload (e.g. contract call, message, etc...)
}

Responds with:

{
    "nonce": 0,
    "sender": "0x123456",
    "recipient": "0x654321",
    "amount": 0,
    "payload": "d78fds=",
    "signature": {
        "SerializedPublicKey": "DYfs87v997awe...",
        "V": "7bPJcyxV1VIQGWO/kavPpYUG66mP7n1qnn2fRnV6pBk=",
        "R": 012345678910,
        "S": 012345678910,
    },
    "time": "2019-04-04T22:22:03.084703Z",
    "contract": null,
    "is-init-contract": false,
    "genesis": false,
    "logs": null,
    "hash": "0x123456",
}

Documentation

Overview

Package main is the summercash-wallet-server entry point.

Directories

Path Synopsis
Package accounts defines account-related helper methods and types.
Package accounts defines account-related helper methods and types.
api
Package api defines the summercash-wallet-server API.
Package api defines the summercash-wallet-server API.
standardapi
Package standardapi defines the summercash-wallet-server API.
Package standardapi defines the summercash-wallet-server API.
Package common outlines common helper methods and types.
Package common outlines common helper methods and types.
Package faucet outlines the faucet interface and its associated helper methods.
Package faucet outlines the faucet interface and its associated helper methods.
Package transactions outlines helper methods for the SummerCash tx api.
Package transactions outlines helper methods for the SummerCash tx api.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL