Skip to main content

blockchain-linker

한국어 | 영어

사용자 정보를 블록체인으로 안전하게 저장하고 관리할 수 있는 Python 패키지입니다. 간단한 인터페이스로 블록체인 구조를 이해하고, 데이터의 무결성을 직접 확인할 수 있습니다.

주요 특징

  • 사용자 정보 등 임의의 데이터를 블록체인에 저장
  • 블록체인 유효성 검증 기능 제공
  • 블록체인 저장 및 불러오기 지원 (JSON 파일)
  • 블록 데이터 수정 및 체인 재계산 기능
  • 직관적인 API와 예제 코드 제공

설치 방법

pip install blockchain_linker

빠른 시작 예제

from blockchain_linker import make_blockchain

users = [
    {"name": "Alice", "age": 30},
    {"name": "Bob", "age": 25}
]

chain = make_blockchain(users)
print(chain.to_list())
print('유효한 체인:', chain.is_valid())

# 체인 저장 및 불러오기
chain.save('chain.json')
loaded = chain.load('chain.json')
print(loaded.to_list())

주요 API

Block

  • 블록의 인덱스, 타임스탬프, 데이터, 이전 해시, 해시 정보를 가짐
  • to_dict(): 블록 정보를 딕셔너리로 반환

Blockchain

  • add_block(data): 새 블록 추가
  • is_valid(): 체인 유효성 검사
  • to_list(): 전체 체인을 리스트로 반환
  • save(filename): 체인 저장 (JSON)
  • load(filename): 저장된 체인 불러오기 (클래스 메서드)
  • modify_block_data(index, new_data): 특정 블록 데이터 수정 및 해시 재계산

make_blockchain(user_list)

  • 사용자 리스트로 블록체인 객체 생성

고급 사용 예시

from blockchain_linker import make_blockchain

users = [
    {"name": "Alice", "age": 30},
    {"name": "Bob", "age": 25}
]
chain = make_blockchain(users)

print("수정 전:", chain.to_list())

# 1번 블록(= Alice)의 데이터를 수정
new_data = {"name": "Alice", "age": 31, "city": "Seoul"}
success = chain.modify_block_data(1, new_data)
print("수정 성공 여부:", success)
print("수정 후:", chain.to_list())
print('유효한 체인:', chain.is_valid())

예제 실행

python examples/index.py

기여 방법

  1. 이슈/PR을 통해 자유롭게 의견을 남겨주세요.
  2. 코드 기여 전 반드시 테스트를 통과해주세요.

라이선스

MIT License

Metadata

Release files for blockchain-linker 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for blockchain-linker 0.1.0
File Size Uploaded
blockchain_linker-0.1.0.tar.gz 3.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for blockchain-linker 0.1.0
File Interpreter ABI Platform
blockchain_linker-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.1 kB

Release files / blockchain_linker-0.1.0.tar.gz

Download URL blockchain_linker-0.1.0.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5af26240a6aeb48fe1198b252456e6df01a2ad29fdef7f48670ad4d85450091e
BLAKE2b-256 checksum
How to use checksums
29c81a08dc44b7b51f9b64d659109ab3281dcc8dd93b21c61930831da9edcccf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.6

Release files / blockchain_linker-0.1.0-py3-none-any.whl

Download URL blockchain_linker-0.1.0-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1127f8cf845a338dd59747954a624d88f3d33163275eaa2e894fec9155e9106b
BLAKE2b-256 checksum
How to use checksums
225e934846cbbb3d849c85d3860e64421422cc51faa187eb20e2f9835ff2a818
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.6

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page