Registry / blockchain / smartc-signum-compiler

smartc-signum-compiler

JSON →
library2.3.0jsnpmunverified

SmartC is a C compiler for writing smart contracts on the Signum blockchain, written in TypeScript/JavaScript. Current stable version is 2.3.0. It enables developers to compile C code into Signum virtual machine bytecode, offering an alternative to lower-level languages for contract development. Key differentiators: full C support, in-browser compilation, both Node.js and browser distributions. Release cadence: stable under @latest, development under @next.

npm install smartc-signum-compiler
INSTALL
IMPORT
SIG · SMARTC-SIGNUM-COMP
S
smartc-signum-compiler
blockchainjavascriptv2.3.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SmartC
import { SmartC } from 'smartc-signum-compiler'
import SmartC from 'smartc-signum-compiler'
Named export, not default. TypeScript types included.
SmartC
const { SmartC } = require('smartc-signum-compiler')
const SmartC = require('smartc-signum-compiler')
CommonJS destructuring required. Direct require returns an object with SmartC property.
globalThis.SmartC
<!-- via script tag: window.SmartC -- global -->
Browser bundle sets SmartC as a global. Accessible via window.SmartC or globalThis.SmartC.

Compiles a simple C smart contract and outputs assembly and machine code. Demonstrates usage of the SmartC class.

import { SmartC } from 'smartc-signum-compiler'; try { const compiler = new SmartC({ language: 'C', sourceCode: '#pragma maxAuxVars 1\nlong a, b, c; a=b/~c;' }); compiler.compile(); const assemblyText = compiler.getAssemblyCode(); const machineObject = compiler.getMachineCode(); console.log('Assembly:', assemblyText); console.log('Machine code:', machineObject); } catch (e) { console.error('Compilation error:', e.message); }
Debug
Known issues
gotchaSmartC constructor requires both 'language' and 'sourceCode' options. Missing either will cause a runtime error.
fix
Always pass an object with both properties.
affects: >=2.0.0
gotchaCalling compile() multiple times on the same instance may produce unexpected results. Instance state is mutable.
fix
Create a new SmartC instance for each compilation.
affects: >=2.0.0
gotchaThe browser build sets SmartC as a global; ensure no other script overwrites it or conflicts.
fix
Use module imports when possible to avoid global conflicts.
affects: >=2.0.0
Errors
Common errors & fixes
TypeError: SmartC is not a constructor
In CommonJS, require returns an object; you must destructure.
fix
const { SmartC } = require('smartc-signum-compiler');
Cannot find module 'smartc-signum-compiler'
Package not installed or import path incorrect.
fix
Run npm install smartc-signum-compiler
Compilation error: Expected ';' at line 1
C syntax error in source code.
fix
Review your C code for missing semicolons or other syntax issues.
Upgrade
Version history
2.3.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
25 hits · last 30 days
node
18
Amazon
1
Bingbot
1
OpenAI (training)
1
Resources
smartc-signum-compiler — npm install smartc-signum-compiler · libregistry