GXChain smart contract compiler is based on nodejs, provides a compile service for smart contract ide
Install node v6 if it's not exist in your environment
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash
. ~/.nvm/nvm.sh
nvm install 6
nvm alias default 6
nvm use 6
git clone [email protected]:gxchain/gxcc.git
cd gxcc
npm install
gxcc serves on port 3000 as default
npm start
npm run build
pm2 stop gxx-server
pm2 start dist/index.js --name gxx-server
curl -X POST \
http://localhost:3000/upload \
-H 'cache-control: no-cache' \
-H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
-F [email protected]
bundle struct
.
├── app.json
├── hello.cpp
└── hello.hpp
app.json
{
"main":"hello.cpp"
}
hello.hpp
#include <gxblib/gxb.hpp>
hello.cpp
#include <gxblib/gxb.hpp>
using namespace gxblib;
using namespace graphene;
class hello : public graphene::contract {
public:
using contract::contract;
/// @abi action
void hi(account_name user) {
print("Hello, ", user);
}
/// @abi action
void bye(account_name user) {
for (int i =0; i < 2; ++i) {
print("Bye, ", user);
}
}
};
GXB_ABI(hello, (hi)(bye))