Quick Start
Create address
const crypto = require('crypto');
const axios = require('axios');
// testnet
var hostname = "https://testnetrest.metacoin.network:20923";
// mainnet
// hostname = "https://rest.metacoin.network:20923";
var public_key = "-----BEGIN PUBLIC KEY-----\nMIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQBBp5oHHFaATF1UIephJYgtW+u2+aT\nhZLxNgn5JZhgFXzvTUHlThZxb61eTXMMjyU/IloNznwtzRWuPq1oMDOMq9oBbT/t\nE4lgyPF5/QtzuhaaYRpr/ahZ4JSLyHOegkopXeic3UFUmkpb4mXuSGgu5mChuuUC\nktjfluGNtvXHOWYtqTU=\n-----END PUBLIC KEY-----";
// public_key = "MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQBBp5oHHFaATF1UIephJYgtW+u2+aThZLxNgn5JZhgFXzvTUHlThZxb61eTXMMjyU/IloNznwtzRWuPq1oMDOMq9oBbT/tE4lgyPF5/QtzuhaaYRpr/ahZ4JSLyHOegkopXeic3UFUmkpb4mXuSGgu5mChuuUCktjfluGNtvXHOWYtqTU=";
axios.post(hostname + '/address/bykey', {
'publickey': public_key
}, {
proxy: {
host: '127.0.0.1',
port: 8888
}
})
.then(function (response) {
if (response.status != 200) {
return Promise.reject("Metacoin server response error");
} else {
return Promise.resolve(response.data);
}
})
.then(function (mtc_address) {
// ["MT4FzIQCgRh0T1YD841OxjNd3dkfTJcEd41d17d3"]
console.log(mtc_address);
})
.catch(function (error) {
if (error.response.status == 404) {
console.log("Address not found");
} else {
console.log(error);
}
});Make your first request
To make your first request, send an token transfer
Query parameters
fromstring · Metacoin AddressRequired
Withdraw address
tostring · Metacoin AddressRequired
Deposit Address
tokenintegerRequired
Token ID, if 0 then Transfer Metacoin
amountstring · integerRequired
Transfer amount Metacoin or Token
checkkeystringRequired
Temporary key for signing - using only transfer, not recording
tagsstring · max: 64Optional
- Optional An arbitrary string that identifies a reason for payment or a account
- Up to 64 characters are stored, and characters after 64 characters are not stored.
memostring · max: 2048Optional
- It does not play any role. However, it is recorded in the Block and can be referenced to this value.
- Up to 2048 characters are stored, and characters after 2048 characters are not stored.
unlockdatestring · intOptional
- When transfer is allowed
- Transfer is possible after the designated time
signaturestring · base64Required
- ECDSA sign for concat from, to, token, amount, checkkey
- ex) ecdsa_sign(privatekey of from address, from +'|'+ to +'|'+ token +'|'+ amount+'|' + checkkey)
Responses
200
successful operation
*/*
400
insufficient balance
404
Address not found
post
/transferLast updated