GreenChain


Energy-efficient blockchain v0.9.3

API keys

To create a blockchain, query its information or register transactions, you need an API key. Click here to create one for free. Then, you may use our REST API, our JS API or our Java client library to access your data.

Please, take note of this key. Your blockchains will become unnaccesible without it. Click here to hide the key.

REST API

Below, we list the methods offered by our REST API.

Create Blockchain

Creates a new blockchain, given an API key, a name, the public key of the root wallet (encoded in Base64 mode), the maximum number of transactions per block (default, 10), and the starting value of the blockchain.

The name of the new blockchain must be unique in the system. It must be a sequence of 4 to 32 letters and characters. The system will return a bad request response if the blockchain name has already been used or if it is not valid.

The start value is an integer number representing the amount that will be deposit in the root wallet as the first transaction of the blockchain. This is the sole transaction to fill the genesis block, that is, the first block of the chain.

You must generate a valid key-pair for the root wallet and keep the private key safe, as only it will allow transferring values from the root wallet.

POST
http://www.greenchain.org/create
{
	"apiKey": "...",
	"name": "...",
	"rootPublicKey": "...",
	"blockSize": 10,
	"startValue": 2000000
}

Send Funds

Transfers funds from one wallet to another, given the API key used to create the blockchain, the name of the blockchain, the current date represented as a timestamp, the sender's public key (Base-64 encoded), the recipient's public key (Base-64 encoded), a textual description of the transaction, a signature, and the transaction value.

The referenced blockchain must be created before the transference of funds takes place and it must have been created using the same API key presented in this transaction.

The timestamp represents the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC (coordinated universal time).

The signature is produced using the private key of the sender's wallet and must encode the string concatenating the timestamp, the Base-64 encoded sender's public key, the Base-64 encoded recipient's public key, and the value.

POST
http://www.greenchain.org/send
{
	"apiKey": "...",
	"name": "...",
	"timestamp": 1000,
	"senderPublicKey": "...",
	"recipientPublicKey": "...",
	"description": "...",
	"signature": "...",
	"value": 100
}

Get Wallet

Gets information about a wallet, given the API key for the blockchain, the name of the blockchain, and the public key for the wallet.

POST
http://www.greenchain.org/wallet
{
	"apiKey": "...",
	"name": "...",
	"publicKey": "..."
}

Get Block

Gets information about a block, given the API key for the blockchain, the name of the blockchain, and the hash of the block. If the hash is omitted, the last block of the blockchain is returned.

POST
http://www.greenchain.org/block
{
	"apiKey": "...",
	"name": "...",
	"hash": "..."
}

Get Transaction

Gets information about a transaction, given the API key for the blockchain, the name of the blockchain, and the identifier of the transaction. You may find transaction identifiers in the blocks registered in the blockchain.

POST
http://www.greenchain.org/transaction
{
	"apiKey": "...",
	"name": "...",
	"id": "..."
}

JavaScript API

Here you can download a small JavaScript library to access data from GreenChain. A simple use case is provided in the header comment. Currently, the library does not allow you to register transactions, but you can query your blocks, transactions, and wallets.


Java client library

Here you can download a Java library to access data from GreenChain. The blockchainClient class gives access to the services described above.