Gram is our official internal use testing Blockchain. The original dev abandoned the coin and the entire community. This caused the community to die as well, leading to not even a single node for an extended period of time. Nobody even had a functional wallet by the time CryptoCoderz got involved. We were forced to re-block the entire algorithm and start it from scratch. Currently we are using this Blockchain to test SHA-256 functionalities and other future projects. Due to the coin being our private test chain there is currently no Bitcointalk thread, nor a wallet.
No Wallet?
The reason as to why we haven’t made a new wallet for gram available to the public is because we do not want this project to gain monetary value. CryptoCoderz took something dead and replaced it with a test to both preserve and utilize this Blockchain. Due to the state in which we found Gram we believe it will do better as a test rather than a functional technology.
Why SHA-256
the reason we chose Gram in particular to be our inside testing Blockchain is because of the algorithm SHA-256. We do not believe that SHA-256 is secure enough to be a functional Blockchain for what CryptoCoderz has planned however it is a great test to help us develop Implementation of several types of algorithms into one universal system. CryptoCoderz views this as a long term goal and will be working on perfecting this function over the course of an undisclosed amount of time.
Algorithm
The SHA (Secure Hash Algorithm) is one of a number of cryptographic hash functions. A cryptographic hash is like a signature for a text or a data file. SHA-256 algorithm generates an almost-unique, fixed size 256-bit (32-byte) hash. Hash is a one way function – it cannot be decrypted back.
template
inline uint256 Hash(const T1 pbegin, const T1 pend)
{
static unsigned char pblank[1];
uint256 hash1;
SHA256((pbegin == pend ? pblank : (unsigned char*)&pbegin;[0]), (pend - pbegin) * sizeof(pbegin[0]), (unsigned char*)&hash1;);
uint256 hash2;
SHA256((unsigned char*)&hash1;, sizeof(hash1), (unsigned char*)&hash2;);
return hash2;
}
class CHashWriter
{
private:
SHA256_CTX ctx;
public:
int nType;
int nVersion;
void Init() {
SHA256_Init(&ctx;);
}
CHashWriter(int nTypeIn, int nVersionIn) : nType(nTypeIn), nVersion(nVersionIn) {
Init();
}
CHashWriter& write(const char *pch, size_t size) {
SHA256_Update(&ctx;, pch, size);
return (*this);
}
// invalidates the object
uint256 GetHash() {
uint256 hash1;
SHA256_Final((unsigned char*)&hash1;, &ctx;);
uint256 hash2;
SHA256((unsigned char*)&hash1;, sizeof(hash1), (unsigned char*)&hash2;);
return hash2;
}
template
CHashWriter& operator<<(const T& obj) {
// Serialize to this stream
::Serialize(*this, obj, nType, nVersion);
return (*this);
}
};
template
inline uint256 Hash(const T1 p1begin, const T1 p1end,
const T2 p2begin, const T2 p2end)
{
static unsigned char pblank[1];
uint256 hash1;
SHA256_CTX ctx;
SHA256_Init(&ctx;);
SHA256_Update(&ctx;, (p1begin == p1end ? pblank : (unsigned char*)&p1begin;[0]), (p1end - p1begin) * sizeof(p1begin[0]));
SHA256_Update(&ctx;, (p2begin == p2end ? pblank : (unsigned char*)&p2begin;[0]), (p2end - p2begin) * sizeof(p2begin[0]));
SHA256_Final((unsigned char*)&hash1;, &ctx;);
uint256 hash2;
SHA256((unsigned char*)&hash1;, sizeof(hash1), (unsigned char*)&hash2;);
return hash2;
}
template
inline uint256 Hash(const T1 p1begin, const T1 p1end,
const T2 p2begin, const T2 p2end,
const T3 p3begin, const T3 p3end)
{
static unsigned char pblank[1];
uint256 hash1;
SHA256_CTX ctx;
SHA256_Init(&ctx;);
SHA256_Update(&ctx;, (p1begin == p1end ? pblank : (unsigned char*)&p1begin;[0]), (p1end - p1begin) * sizeof(p1begin[0]));
SHA256_Update(&ctx;, (p2begin == p2end ? pblank : (unsigned char*)&p2begin;[0]), (p2end - p2begin) * sizeof(p2begin[0]));
SHA256_Update(&ctx;, (p3begin == p3end ? pblank : (unsigned char*)&p3begin;[0]), (p3end - p3begin) * sizeof(p3begin[0]));
SHA256_Final((unsigned char*)&hash1;, &ctx;);
uint256 hash2;
SHA256((unsigned char*)&hash1;, sizeof(hash1), (unsigned char*)&hash2;);
return hash2;
}
template
uint256 SerializeHash(const T& obj, int nType=SER_GETHASH, int nVersion=PROTOCOL_VERSION)
{
CHashWriter ss(nType, nVersion);
ss << obj;
return ss.GetHash();
}
template
inline uint160 Hash160(const T1 pbegin, const T1 pend)
{
static unsigned char pblank[1];
uint256 hash1;
SHA256((pbegin == pend ? pblank : (unsigned char*)&pbegin;[0]), (pend - pbegin) * sizeof(pbegin[0]), (unsigned char*)&hash1;);
uint160 hash2;
RIPEMD160((unsigned char*)&hash1;, sizeof(hash1), (unsigned char*)&hash2;);
return hash2;
}
inline uint160 Hash160(const std::vector& vch)
{
return Hash160(vch.begin(), vch.end());
}
unsigned int MurmurHash3(unsigned int nHashSeed, const std::vector& vDataToHash);